Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
langstonb committed Aug 31, 2022
2 parents 56b339c + fdb8ff2 commit ede1859
Show file tree
Hide file tree
Showing 225 changed files with 7,868 additions and 1,853 deletions.
29 changes: 0 additions & 29 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,8 @@
# Git Repository File Ignore Specifications
# B&R Automation Studio project directory files

*/AS/System/
# Ignore Binaries/ directory (the entire folder)
*/Binaries
# Ignore everything INSIDE Diagnosis/ directory
*/Diagnosis/**
# Ignore Temp/ directory
*/Temp

# Ignore all .set and .isopen files
*/*.set
*/*.isopen

# Ignore .zip files, for the moment
*.zip

# Exception for Diagnosis/ sub-directories -> these won't be committed anyways
# because there are no files inside that will be committed
# Credit: Jim G. on Stack Overflow https://stackoverflow.com/a/25916709/11402416
!**/Diagnosis/**/
# Exception for specific files within Diagnosis/
#!*.tc


# ******************************************************************************
# Project specific ignore paths
# ******************************************************************************
# Save watch windows and task trace configurations
!**/Diagnosis/**/*.PVM
!**/Diagnosis/**/*.tc


# ignore temp files
*~
~*
Expand Down
21 changes: 0 additions & 21 deletions LICENSE.txt

This file was deleted.

29 changes: 29 additions & 0 deletions mappFramework/.gitignore
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
2 changes: 1 addition & 1 deletion mappFramework/Logical/ChineseHelp/Package.pkg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=4.8.6.30 SP?>
<?AutomationStudio FileVersion="4.9"?>
<Package xmlns="http://br-automation.co.at/AS/Package">
<Objects>
<Object Type="File">mappFramwork.chm</Object>
Expand Down
Binary file modified mappFramework/Logical/ChineseHelp/mappFramwork.chm
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PROGRAM _INIT
END_IF

// Call action to intialize alarm samples
AlarmSampleInit;
AlarmSampleInit;

// Initialize mapp function blocks
MpAlarmXCore_0.Enable := TRUE;
Expand All @@ -29,12 +29,14 @@ PROGRAM _INIT
MpAlarmXHistory_0();

MpAlarmXListUI_0.Enable := TRUE;
MpAlarmXListUI_0.MpLink := ADR(gMpLinkAlarmXCore);
MpAlarmXListUI_0.UISetup.AlarmListScrollWindow := 10;
MpAlarmXListUI_0.UISetup.AlarmListSize := 50;
MpAlarmXListUI_0.UISetup.TimeStampPattern := '%Y %m %d %H:%M:%S';
MpAlarmXListUI_0();

MpAlarmXHistoryUI_0.Enable := TRUE;
MpAlarmXHistoryUI_0.MpLink := ADR(gMpLinkAlarmXHistory);
MpAlarmXHistoryUI_0.UISetup.AlarmListScrollWindow := 10;
MpAlarmXHistoryUI_0.UISetup.AlarmListSize := (SIZEOF(MpAlarmXListUIConnect.AlarmList.InstanceID) / SIZEOF(MpAlarmXListUIConnect.AlarmList.InstanceID[0]));
MpAlarmXHistoryUI_0.UISetup.TimeStampPattern := '%Y %m %d %H:%M:%S';
Expand All @@ -53,7 +55,7 @@ PROGRAM _CYCLIC
END_IF

// Call all cyclic actions
AlarmHandling;
AlarmHandling;
GetBacktraceInformation;
ExecuteQuery;
QueryTableConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ ACTION AlarmSampleInit:

// If AlarmExamples.LevelMonitoring gets less than 20 or more than 80, the LevelMonitoringExample alarm will trigger
// The Low limit is 20. The LowLow limit is 10. The High limit is 80. The HighHigh limit is 90.
AlarmExamples.LevelMonitoring := 50;
AlarmExamples.LevelMonitoring := 50;

// If AlarmExamples.DeviationMonitoring deviates from the setpoint (AlarmExamples.DeviationMonitoringSetpoint) by more than 5
// units in either direction, the DeviationMonitoringExample alarm will trigger
AlarmExamples.DeviationMonitoring := 15;
AlarmExamples.DeviationMonitoring := 15;
AlarmExamples.DeviationMonitoringSetpoint := 15;

// If AlarmExamples.RateOfChange increases at a rate of more than 5 units per second, the RateOfChangeExample alarm will trigger
AlarmExamples.RateOfChange := 0;
AlarmExamples.RateOfChange := 0;

// If AlarmExamples.SnippetValue gets between 50 and 100, an alarm will trigger and the current value will be shown in the alarm text
AlarmExamples.SnippetValue := 10;
AlarmExamples.SnippetValue := 10;

END_ACTION

Expand Down
20 changes: 20 additions & 0 deletions mappFramework/Logical/Infrastructure/Audit/AuditAlarms.tmx
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&amp;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 mappFramework/Logical/Infrastructure/Audit/AuditMgr/AuditMgr.st
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 mappFramework/Logical/Infrastructure/Audit/AuditMgr/AuditMgr.typ
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 mappFramework/Logical/Infrastructure/Audit/AuditMgr/AuditMgr.var
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
Loading

0 comments on commit ede1859

Please sign in to comment.