-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
225 changed files
with
7,868 additions
and
1,853 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Git Repository File Ignore Specifications | ||
# B&R Automation Studio project directory files | ||
|
||
/AS/System/ | ||
# Ignore Binaries/ directory (the entire folder) | ||
/Binaries | ||
# Ignore (all) debugging content | ||
/Diagnosis/** | ||
# But save the watch windows and task trace configurations (if it should stay in the repository) | ||
!/Diagnosis/**/ | ||
!/Diagnosis/**/*.PVM | ||
!/Diagnosis/**/*.tc | ||
# Ignore Temp/ directory | ||
/Temp/ | ||
#Ignore Upgrades | ||
/Upgrades/ | ||
# Ignore all .set and .isopen files | ||
/*.set | ||
/*.isopen | ||
/debug.log | ||
|
||
# Ignore .zip files, for the moment | ||
/*.zip | ||
|
||
# ignore temp files | ||
*~ | ||
~* | ||
*.[Bb]ak | ||
*.[Oo]rig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
mappFramework/Logical/Infrastructure/Audit/AuditAlarms.tmx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<tmx version="1.4"> | ||
<header creationtool="B&R Automation Studio" creationtoolversion="4.2" datatype="unknown" segtype="sentence" adminlang="en" srclang="en" o-tmf="TMX"> | ||
<note>Change the namespace to define where this text module should be located within the logical structure of your texts</note> | ||
<prop type="x-BR-TS:Namespace">Audit/Alarms</prop> | ||
</header> | ||
<body> | ||
<tu tuid="Samples.HELLO_WORLD"> | ||
<tuv xml:lang="de"> | ||
<seg>Servus Welt!</seg> | ||
</tuv> | ||
<tuv xml:lang="en"> | ||
<seg>Hello world!</seg> | ||
</tuv> | ||
<tuv xml:lang="fr"> | ||
<seg>Bonjour tout le monde!</seg> | ||
</tuv> | ||
</tu> | ||
</body> | ||
</tmx> |
118 changes: 118 additions & 0 deletions
118
mappFramework/Logical/Infrastructure/Audit/AuditMgr/AuditMgr.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
//*********************************************************************** | ||
// Copyright: B&R Industrial Automation GmbH | ||
// Author: B&R Industrial Automation GmbH | ||
// Created: Sept 1, 2022 | ||
// Description: Task for audit management. | ||
//*********************************************************************** | ||
|
||
PROGRAM _INIT | ||
|
||
// Create folder for this component on the user file device | ||
DirCreate_0(enable := TRUE, pDevice := ADR('UserPartition'), pName := ADR(LOCAL_FOLDER)); | ||
|
||
// Check if folder already exist and if so disabled the function block call | ||
IF DirCreate_0.status = fiERR_DIR_ALREADY_EXIST THEN | ||
DirCreate_0(enable := FALSE); | ||
END_IF | ||
|
||
// Initialize mapp function blocks | ||
MpAuditTrail_0.Enable := TRUE; | ||
MpAuditTrail_0.MpLink := ADR(gMpLinkAuditTrail); | ||
MpAuditTrail_0.Language := ADR('en'); | ||
MpAuditTrail_0.DeviceName := ADR('mappAuditFiles'); | ||
MpAuditTrail_0(); | ||
|
||
MpAuditTrailConfig_0.Enable := TRUE; | ||
MpAuditTrailConfig_0.MpLink := ADR(gMpLinkAuditTrail); | ||
MpAuditTrailConfig_0.Configuration := ADR(AuditTrailConfig); | ||
MpAuditTrailConfig_0.Load := TRUE; | ||
MpAuditTrailConfig_0(); | ||
|
||
MpAuditTrail_CEvents.Enable := TRUE; | ||
MpAuditTrail_CEvents.MpLink := ADR(gMpLinkCustomEvents); | ||
MpAuditTrail_CEvents(); | ||
|
||
// Initialize custom events | ||
CustomEvent[0].Type := "Custom Event Type"; | ||
CustomEvent[0].Msg := "Custom Event Message"; | ||
CustomEvent[0].Comment := "Custom Event Comment"; | ||
|
||
CustomEvent[1].Type := "Audit Test"; | ||
CustomEvent[1].Msg := "This is a custom event test msg"; | ||
CustomEvent[1].Comment := "If you see this it was a success!"; | ||
|
||
CustomEvent[2].Type := "Cmd Exe"; | ||
CustomEvent[2].Msg := "The run query command was pressed on the HMI"; | ||
CustomEvent[2].Comment := "Result can be seen in the Query tab"; | ||
|
||
HmiAudit.Status.Query.Name := 'UserEvents'; | ||
HmiAudit.Status.Query.Option := 1; | ||
|
||
// Configuring the query selection, reading the available components | ||
HmiAudit.Parameters.QuerySelection[0] := 'UserXMgr'; | ||
HmiAudit.Parameters.QuerySelection[1] := 'RecipeMgr'; | ||
|
||
IF (ST_ident(ADR(HmiAudit.Parameters.QuerySelection[0]), 0, ADR(ident)) = 0) AND (ST_ident(ADR(HmiAudit.Parameters.QuerySelection[1]), 0, ADR(ident)) = 0) THEN | ||
HmiAudit.Status.DeviceDataProvider[0] := '{"value":"UserEvents","text":"User Events Query"}'; | ||
HmiAudit.Status.DeviceDataProvider[1] := '{"value":"RecipeEvents","text":"Recipe Events Query"}'; | ||
ELSIF (ST_ident(ADR(HmiAudit.Parameters.QuerySelection[0]), 0, ADR(ident)) <> 0) AND (ST_ident(ADR(HmiAudit.Parameters.QuerySelection[1]), 0, ADR(ident)) = 0) THEN | ||
HmiAudit.Status.DeviceDataProvider[0] := '{"value":"RecipeEvents","text":"Recipe Events Query"}'; | ||
ELSIF (ST_ident(ADR(HmiAudit.Parameters.QuerySelection[0]), 0, ADR(ident)) = 0) AND (ST_ident(ADR(HmiAudit.Parameters.QuerySelection[1]), 0, ADR(ident)) <> 0) THEN | ||
HmiAudit.Status.DeviceDataProvider[0] := '{"value":"UserEvents","text":"User Events Query"}'; | ||
END_IF | ||
|
||
END_PROGRAM | ||
|
||
PROGRAM _CYCLIC | ||
|
||
// Call all cyclic actions | ||
ExecuteQuery; | ||
QueryTableConfig; | ||
ArchiveExport; | ||
ArchiveSettings; | ||
ChangeConfiguration; | ||
|
||
// Sample code for how custom events can be triggered. Use custom events as needed around the application for debugging purposes. | ||
IF EDGEPOS(CustomEvent[0].Set) THEN | ||
MpAuditCustomEvent(gMpLinkCustomEvents,CustomEvent[0].Type,CustomEvent[0].Msg,CustomEvent[0].Comment); | ||
END_IF | ||
IF EDGENEG(CustomEvent[1].Set) THEN | ||
MpAuditCustomEvent(gMpLinkCustomEvents,CustomEvent[1].Type,CustomEvent[1].Msg,CustomEvent[1].Comment); | ||
END_IF | ||
|
||
// Change sample variable randomly to trigger a value change event | ||
IF VariableMonitorExample = 0 THEN | ||
VariableMonitorExample := 10.5; | ||
END_IF | ||
|
||
// Error reset | ||
IF NOT MpAuditTrail_0.Error THEN | ||
MpAuditTrail_0.ErrorReset := FALSE; | ||
END_IF | ||
|
||
// Assign MpLinks and HMI connections | ||
MpAuditTrail_0.MpLink := ADR(gMpLinkAuditTrail); | ||
MpAuditTrailConfig_0.MpLink := ADR(gMpLinkAuditTrail); | ||
MpAuditTrail_CEvents.MpLink := ADR(gMpLinkCustomEvents); | ||
|
||
// Call function blocks | ||
MpAuditTrail_0(); | ||
MpAuditTrailConfig_0(); | ||
MpAuditTrail_CEvents(); | ||
|
||
END_PROGRAM | ||
|
||
PROGRAM _EXIT | ||
|
||
// Disable the function blocks to unlink the MpLinks | ||
MpAuditTrail_0.Enable := FALSE; | ||
MpAuditTrailConfig_0.Enable := FALSE; | ||
MpAuditTrail_CEvents.Enable := FALSE; | ||
|
||
// Call function blocks | ||
MpAuditTrail_0(); | ||
MpAuditTrailConfig_0(); | ||
MpAuditTrail_CEvents(); | ||
|
||
END_PROGRAM | ||
|
73 changes: 73 additions & 0 deletions
73
mappFramework/Logical/Infrastructure/Audit/AuditMgr/AuditMgr.typ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
TYPE | ||
AuditQueryHMIType : STRUCT (*Datatype for the structure which rearranges the query data from AuditQuery into a structure of arrays for easy connection to the Table widget in mapp View*) | ||
EvTime : ARRAY[0..MAX_QUERY_RESULTS]OF DATE_AND_TIME; (*ActiveAudits query, Event-Time column*) | ||
Text : ARRAY[0..MAX_QUERY_RESULTS]OF WSTRING[100]; (*ActiveAudits query, Text column*) | ||
DText : ARRAY[0..MAX_QUERY_RESULTS]OF WSTRING[100]; (*ActiveAudits query, Display Text column*) | ||
Op : ARRAY[0..MAX_QUERY_RESULTS]OF WSTRING[100]; (*ActiveAudits query, Operator-Name column*) | ||
QueryCount : USINT; (*Count of query results for building the query table configuration string*) | ||
Name : STRING[80]; (*Name of the query to be executed*) | ||
Option : USINT; (*Index value of the selected query type in the dropdown on the query tab*) | ||
END_STRUCT; | ||
ActiveAuditStateEnum : | ||
( (*Enumeration for the state for the query state machine*) | ||
ACTIVE_AUDIT_WAIT, (*Wait state*) | ||
ACTIVE_AUDIT_QUERY, (*State to query the Audit data*) | ||
ACTIVE_AUDIT_NEXT (*State to check if more Audits meet the query criteria and need to be queried*) | ||
); | ||
AuditCustomEventType : STRUCT (*Structure for custom events handling*) | ||
Set : BOOL; (*Trigger the assigned function*) | ||
Type : WSTRING[100]; (*Entered when creating the entry under %typ*) | ||
Msg : WSTRING[100]; (*Entered when creating the entry under %msg *) | ||
Comment : WSTRING[100]; (*Entered when creating the entry under %cmt *) | ||
END_STRUCT; | ||
AuditQueryType : STRUCT (*Structure for query results and status*) | ||
State : ActiveAuditStateEnum; (*State variable for the query state machine*) | ||
LastUpdateCount : UDINT; (*Previous count of query results. Used to check for new query data. *) | ||
UpdateCountRecipe : UDINT; (*Count of query results. Increases each time new results are availble. *) | ||
UpdateCount : UDINT; (*Count of query results. Increases each time new results are availble. *) | ||
Audits : ARRAY[0..MAX_QUERY_RESULTS]OF AuditType; (*Query data*) | ||
Next : BOOL; (*Trigger to query the next data, if there are more results than MAX_QUERY_RESULTS*) | ||
END_STRUCT; | ||
AuditHmiInterfaceType : STRUCT (*Structure to hold commands and status from the HMI*) | ||
Commands : AuditCommandsType; (*HMI commands*) | ||
Parameters : AuditParType; (*HMI parameters*) | ||
Status : {REDUND_UNREPLICABLE} AuditStatusType; (*HMI status*) | ||
END_STRUCT; | ||
AuditCommandsType : STRUCT (*Structure to hold the commands from the HMI*) | ||
ExportArchives : BOOL; (*Triggers an Audit export of the Audit history. Connected to a button on the HMI. *) | ||
RunQuery : BOOL; (*Triggers the query to run. Connected to a button on the HMI. *) | ||
SaveConfig : BOOL; (*Starts the configuration for archives*) | ||
END_STRUCT; | ||
AuditStatusType : STRUCT (*Structure to hold status information from the mapp View HMI. (This structure is not compatible/relevant if you are using a VC4 visualization)*) | ||
AuditSortCfg : STRING[1000]; (*Sort configuration for the AuditList widget*) | ||
AuditFilterCfg : STRING[1000]; (*Filter configuration for the AuditList widget*) | ||
TableConfig : ARRAY[0..1]OF STRING[255]; (*Table configuration for the Audit query Table*) | ||
Query : AuditQueryHMIType; (*Structure which rearranges the query data from AuditQuery into a structure of arrays for easy connection to the Table widget*) | ||
CustomEventSortCfg : STRING[1000]; (*Sort configuration for the AuditList Custom Events widget*) | ||
CustomEventsFilterCfg : STRING[1000]; (*Filter configuration for the AuditList Custom Events widget*) | ||
ArchiveAvailable : BOOL; (*At least 1 archive is available for export*) | ||
NumberOfArchives : UINT; (*How many archives are available for export*) | ||
DeviceDataProvider : ARRAY[0..1]OF STRING[100]; (*Data provider for the file device selector*) | ||
END_STRUCT; | ||
AuditParType : STRUCT (*Structure to hold parameter data for the HMI*) | ||
ArchiveSettings : AuditArchiveParType; (*Parameter for archive configuration*) | ||
QuerySelection : ARRAY[0..MAX_QUERIES]OF STRING[10]; (*The selection in the query dropdown on the query tab of the Audit content*) | ||
END_STRUCT; | ||
AuditArchiveParType : STRUCT (*Automatic archive settings*) | ||
Enable : BOOL; (*Enable automatic archive feature*) | ||
MaxSize : UDINT; (*Name prefix for each automatic backup file*) | ||
Mode : MpAuditArchiveModeEnum; (*Mode (daily, Mo-Fr or by batch)*) | ||
Hour : USINT; (*Time (hour)*) | ||
Minute : USINT; (*Time (minutes)*) | ||
FileType : MpAuditFileTypeEnum := mpAUDIT_FILE_TYPE_XML; (*File type selection (XML, TXT, PDF)*) | ||
END_STRUCT; | ||
AuditType : STRUCT (*Structure to hold the Audit data for the query results*) | ||
EvTime : DATE_AND_TIME; (*ActiveAudits query, Event-Time column*) | ||
Text : WSTRING[100]; (*ActiveAudits query, Text column*) | ||
DText : WSTRING[100]; (*ActiveAudits query, Display Text column*) | ||
Op : WSTRING[100]; (*ActiveAudits query, Operator-Name column*) | ||
END_STRUCT; | ||
END_TYPE | ||
|
||
(*Enumerations*) |
28 changes: 28 additions & 0 deletions
28
mappFramework/Logical/Infrastructure/Audit/AuditMgr/AuditMgr.var
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(*Function Blocks*) | ||
VAR | ||
DirCreate_0 : DirCreate; (*DirCreate instance*) | ||
MpAuditTrail_0 : MpAuditTrail; (*AuditTrail for regular mapp events*) | ||
MpAuditTrailConfig_0 : MpAuditTrailConfig; (*AuditTrail configuration*) | ||
MpAuditTrail_CEvents : MpAuditTrail; (*AuditTrail for custom events*) | ||
QueryUserEvents_0 : {REDUND_UNREPLICABLE} MpAuditQuery; (*MpAlarmXQuery instance*) | ||
END_VAR | ||
(*Constants*) | ||
VAR CONSTANT | ||
MAX_QUERY_RESULTS : USINT := 19; (*Maximum number of query results (Value+1)*) | ||
LOCAL_FOLDER : STRING[10] := 'Audit'; (*Folder name on the file device for UserX files*) | ||
MAX_CUSTOM_EVENTS : USINT := 9; (*Maximum number of custom events*) | ||
MAX_QUERIES : USINT := 2; (*Maximum number of configured queries*) | ||
END_VAR | ||
(*Structure Types*) | ||
VAR | ||
HmiAudit : AuditHmiInterfaceType; (*HMI interface structure*) | ||
CustomEvent : ARRAY[0..MAX_CUSTOM_EVENTS] OF AuditCustomEventType; (*Custom events*) | ||
AuditQuery : {REDUND_UNREPLICABLE} AuditQueryType; (*Query results and status*) | ||
AuditTrailConfig : MpAuditTrailConfigType; (*Configuration structure for changing archiving setup*) | ||
END_VAR | ||
(*Variables*) | ||
VAR | ||
i : USINT; (*Index for loops*) | ||
ident : UDINT; (*Identifier for task deployment*) | ||
VariableMonitorExample : REAL; (*Used for the variable monitor example*) | ||
END_VAR |
Oops, something went wrong.