Skip to content

Commit

Permalink
mapp Framework project - 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
langstonb committed Apr 11, 2022
1 parent 61bae68 commit 30fd37d
Show file tree
Hide file tree
Showing 797 changed files with 67,943 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mappFramework/Logical/ChineseHelp/Package.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio FileVersion="4.9"?>
<Package xmlns="http://br-automation.co.at/AS/Package">
<Objects>
<Object Type="File">mappFramwork.chm</Object>
</Objects>
</Package>
Binary file not shown.
4 changes: 4 additions & 0 deletions mappFramework/Logical/Global.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

TYPE

END_TYPE
8 changes: 8 additions & 0 deletions mappFramework/Logical/Global.var
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

VAR

END_VAR

VAR CONSTANT

END_VAR
120 changes: 120 additions & 0 deletions mappFramework/Logical/Infrastructure/AlarmX/AlarmMgr/AlarmHandling.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
ACTION AlarmHandling:

// CommissioningModeActive = TRUE will inhibit Alarms[0]. The alarm will not trigger even if the alarm condition is active.
// CommissioningModeActive = FALSE will NOT inhibit Alarms[0]. The alarm will trigger when the alarm condition is active.
// See Alarm.mpalarmxcore (must enable Advanced Features)
CommissioningModeActive;

// Define the condition which triggers each alarm below.
Alarms[0];

// Alarms[1] := ;
// Alarms[2] := ;
// Alarms[3] := ;
// Alarms[4] := ;
// Alarms[5] := ;
// Alarms[6] := ;
// Alarms[7] := ;
// Alarms[8] := ;
// Alarms[9] := ;
//
// Alarms[10] := ;
// Alarms[11] := ;
// Alarms[12] := ;
// Alarms[13] := ;
// Alarms[14] := ;
// Alarms[15] := ;
// Alarms[16] := ;
// Alarms[17] := ;
// Alarms[18] := ;
// Alarms[19] := ;
//
// Alarms[20] := ;
// Alarms[21] := ;
// Alarms[22] := ;
// Alarms[23] := ;
// Alarms[24] := ;
// Alarms[25] := ;
// Alarms[26] := ;
// Alarms[27] := ;
// Alarms[28] := ;
// Alarms[29] := ;
//
// Alarms[30] := ;
// Alarms[31] := ;
// Alarms[32] := ;
// Alarms[33] := ;
// Alarms[34] := ;
// Alarms[35] := ;
// Alarms[36] := ;
// Alarms[37] := ;
// Alarms[38] := ;
// Alarms[39] := ;
//
// Alarms[40] := ;
// Alarms[41] := ;
// Alarms[42] := ;
// Alarms[43] := ;
// Alarms[44] := ;
// Alarms[45] := ;
// Alarms[46] := ;
// Alarms[47] := ;
// Alarms[48] := ;
// Alarms[49] := ;
//
// Alarms[50] := ;
// Alarms[51] := ;
// Alarms[52] := ;
// Alarms[53] := ;
// Alarms[54] := ;
// Alarms[55] := ;
// Alarms[56] := ;
// Alarms[57] := ;
// Alarms[58] := ;
// Alarms[59] := ;
//
// Alarms[60] := ;
// Alarms[61] := ;
// Alarms[62] := ;
// Alarms[63] := ;
// Alarms[64] := ;
// Alarms[65] := ;
// Alarms[66] := ;
// Alarms[67] := ;
// Alarms[68] := ;
// Alarms[69] := ;
//
// Alarms[70] := ;
// Alarms[71] := ;
// Alarms[72] := ;
// Alarms[73] := ;
// Alarms[74] := ;
// Alarms[75] := ;
// Alarms[76] := ;
// Alarms[77] := ;
// Alarms[78] := ;
// Alarms[79] := ;
//
// Alarms[80] := ;
// Alarms[81] := ;
// Alarms[82] := ;
// Alarms[83] := ;
// Alarms[84] := ;
// Alarms[85] := ;
// Alarms[86] := ;
// Alarms[87] := ;
// Alarms[88] := ;
// Alarms[89] := ;
//
// Alarms[90] := ;
// Alarms[91] := ;
// Alarms[92] := ;
// Alarms[93] := ;
// Alarms[94] := ;
// Alarms[95] := ;
// Alarms[96] := ;
// Alarms[97] := ;
// Alarms[98] := ;
// Alarms[99] := ;

END_ACTION
125 changes: 125 additions & 0 deletions mappFramework/Logical/Infrastructure/AlarmX/AlarmMgr/AlarmMgr.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
//***********************************************************************
// Copyright: B&R Industrial Automation GmbH
// Author: B&R Industrial Automation GmbH
// Created: April 12, 2022
// Description: Tasks for alarm 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

// Call action to intialize alarm samples
AlarmSampleInit;

// Initialize mapp function blocks
MpAlarmXCore_0.Enable := TRUE;
MpAlarmXCore_0.MpLink := ADR(gMpLinkAlarmXCore);
MpAlarmXCore_0();

MpAlarmXHistory_0.Enable := TRUE;
MpAlarmXHistory_0.DeviceName := ADR('mappAlarmXFiles');
MpAlarmXHistory_0.MpLink := ADR(gMpLinkAlarmXHistory);
MpAlarmXHistory_0();

MpAlarmXListUI_0.Enable := TRUE;
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.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';
MpAlarmXHistoryUI_0();

END_PROGRAM

PROGRAM _CYCLIC

IF EDGEPOS(SafetyInputs.AcknowledgeAlarms) THEN
MpAlarmXListUIConnect.AcknowledgeAll := TRUE;
END_IF

IF (HmiAlarmX.Commands.ExportAlarms = TRUE) THEN
MpAlarmXHistory_0.Export := TRUE;
END_IF

// Call all cyclic actions
AlarmHandling;
GetBacktraceInformation;
ExecuteQuery;
QueryTableConfig;
AlarmSampleFub;

// Check if any reactions are active.
// Typically the MpAlarmXCheckReaction() function is called from other tasks within the application.
// For example, the axis control task might check for the 'Error' reaction to determine whether to send a stop command to the axes.
// Therefore, copy/paste these IF statements to other places in the application as needed.
IF MpAlarmXCheckReaction(gMpLinkAlarmXCore, 'Error') THEN
// Error is active. Add code here to respond to error situation.
ELSIF MpAlarmXCheckReaction(gMpLinkAlarmXCore, 'Warning') THEN
// Warning is active. Add code here to respond to warning situation.
ELSIF MpAlarmXCheckReaction(gMpLinkAlarmXCore, 'Info') THEN
// Info is active. Add code here to resond to info situation.
END_IF

IF ((MpAlarmXHistory_0.Export = TRUE) AND (MpAlarmXHistory_0.CommandDone = TRUE)) THEN
HmiAlarmX.Commands.ExportAlarms := FALSE;
MpAlarmXHistory_0.Export := FALSE;
END_IF

// Error reset
IF NOT MpAlarmXCore_0.Error THEN
MpAlarmXCore_0.ErrorReset := FALSE;
END_IF
IF NOT MpAlarmXListUI_0.Error THEN
MpAlarmXListUI_0.ErrorReset := FALSE;
END_IF
IF NOT MpAlarmXHistory_0.Error THEN
MpAlarmXHistory_0.ErrorReset := FALSE;
END_IF
IF NOT MpAlarmXHistoryUI_0.Error THEN
MpAlarmXHistoryUI_0.ErrorReset := FALSE;
END_IF

// Assign MpLinks & UIConnects
MpAlarmXCore_0.MpLink := ADR(gMpLinkAlarmXCore);
MpAlarmXListUI_0.MpLink := ADR(gMpLinkAlarmXCore);
MpAlarmXListUI_0.UIConnect := ADR(MpAlarmXListUIConnect);
MpAlarmXHistory_0.MpLink := ADR(gMpLinkAlarmXHistory);
MpAlarmXHistoryUI_0.MpLink := ADR(gMpLinkAlarmXHistory);
MpAlarmXHistoryUI_0.UIConnect := ADR(MpAlarmXHistoryUIConnect);

// Call function blocks
MpAlarmXCore_0();
MpAlarmXListUI_0();
MpAlarmXHistory_0();
MpAlarmXHistoryUI_0();

END_PROGRAM

PROGRAM _EXIT

// Disable the function blocls to unlink the MpLinks
MpAlarmXCore_0.Enable := FALSE;
MpAlarmXListUI_0.Enable := FALSE;
MpAlarmXHistory_0.Enable := FALSE;
MpAlarmXHistoryUI_0.Enable := FALSE;
QueryActiveAlarms_0.Enable := FALSE;

// Call function blocks
MpAlarmXCore_0();
MpAlarmXListUI_0();
MpAlarmXHistory_0();
MpAlarmXHistoryUI_0();
QueryActiveAlarms_0();

END_PROGRAM
75 changes: 75 additions & 0 deletions mappFramework/Logical/Infrastructure/AlarmX/AlarmMgr/AlarmMgr.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
(*Structure types*)

TYPE
AlarmHmiInterfaceType : STRUCT (*Structure to hold commands and status from the HMI*)
Commands : AlarmCommandsType; (*HMI commands*)
Status : {REDUND_UNREPLICABLE} AlarmStatusType; (*HMI status*)
END_STRUCT;
AlarmCommandsType : STRUCT (*Structure to hold the commands from the HMI*)
ExportAlarms : BOOL; (*Triggers an alarm export of the alarm history. Connected to a button on the HMI. *)
RunQuery : BOOL; (*Triggers the query to run. Connected to a button on the HMI. *)
END_STRUCT;
AlarmStatusType : STRUCT (*Structure to hold status information from the mapp View HMI. (This structure is not compatible/relevant if you are using a VC4 visualization)*)
AlarmHistSortCfg : STRING[1000]; (*Sort configuration property for the AlarmHistory widget *)
AlarmHistFilterCfg : STRING[1000]; (*Filter configuration property for the AlarmHistory widget*)
AlarmSortCfg : STRING[1000]; (*Sort configuration for the AlarmList widget*)
AlarmFilterCfg : STRING[1000]; (*Filter configuration for the AlarmList widget*)
TableConfig : ARRAY[0..1]OF STRING[120]; (*Table configuration for the alarm query Table*)
Query : AlarmQueryHMIType; (*Structure which rearranges the query data from AlarmQuery into a structure of arrays for easy connection to the Table widget*)
InstanceID : UINT; (*The instanceID of the alarm that was most recently clicked in the AlarmList. Set by an eventbinding in mapp View*)
END_STRUCT;
AlarmQueryType : STRUCT (*Structure for query results and status*)
State : ActiveAlarmStateEnum; (*State variable for the query state machine*)
LastUpdateCount : UDINT; (*Previous count of query results. Used to check for new query data. *)
UpdateCount : UDINT; (*Count of query results. Increases each time new results are availble. *)
Alarms : ARRAY[0..MAX_QUERY_RESULTS]OF AlarmType; (*Query data*)
Next : BOOL; (*Trigger to query the next data, if there are more results than MAX_QUERY_RESULTS*)
END_STRUCT;
AlarmQueryHMIType : STRUCT (*Datatype for the structure which rearranges the query data from AlarmQuery into a structure of arrays for easy connection to the Table widget in mapp View*)
Active : ARRAY[0..MAX_QUERY_RESULTS]OF BOOL; (*StateActive array*)
Acknowledged : ARRAY[0..MAX_QUERY_RESULTS]OF BOOL; (*StateAcknowledged array*)
Scope : ARRAY[0..MAX_QUERY_RESULTS]OF WSTRING[80]; (*Scope array*)
Name : ARRAY[0..MAX_QUERY_RESULTS]OF STRING[80]; (*Name array*)
Message : ARRAY[0..MAX_QUERY_RESULTS]OF WSTRING[255]; (*Message array*)
AdditionalInfo : ARRAY[0..MAX_QUERY_RESULTS]OF WSTRING[255]; (*AdditionalInformation1 array*)
TimeStamp : ARRAY[0..MAX_QUERY_RESULTS]OF DATE_AND_TIME; (*TimeStamp array*)
Code : ARRAY[0..MAX_QUERY_RESULTS]OF UDINT; (*Code array*)
Severity : ARRAY[0..MAX_QUERY_RESULTS]OF UDINT; (*Severity array*)
QueryCount : USINT; (*Count of query results for building the query table configuration string*)
END_STRUCT;
AlarmType : STRUCT (*Structure to hold the alarm data for the query results*)
Active : BOOL; (*ActiveAlarms query, StateActive column*)
Acknowledged : BOOL; (*ActiveAlarms query, StateAcknowledged column*)
Scope : WSTRING[80]; (*ActiveAlarms query, Scope column*)
Name : STRING[80]; (*ActiveAlarms query, Name column*)
Message : WSTRING[255]; (*ActiveAlarms query, Message column*)
AdditionalInfo : WSTRING[255]; (*ActiveAlarms query, AdditionalInformation1*)
TimeStamp : DATE_AND_TIME; (*ActiveAlarms query, TimeStamp column*)
Code : UDINT; (*ActiveAlarms query, Code column*)
Severity : UDINT; (*ActiveAlarms query, Severity column*)
END_STRUCT;
MachineDigitalInputsType : STRUCT (*Safety related digital inputs *)
EmergencyStop : ARRAY[0..MAX_ESTOP]OF BOOL; (*Emergency stop input signals*)
SafetyDoor : ARRAY[0..MAX_SAFETY_DOOR]OF BOOL; (*Safety door input signals*)
AcknowledgeAlarms : BOOL; (*Reset button input signal*)
END_STRUCT;
AlarmExamplesType : STRUCT (*Structure for alarm samples*)
LevelMonitoring : INT; (*Triggers LevelMonitoringExample alarm depending on the value set (<20 or >80)*)
DeviationMonitoring : INT; (*Triggers the DeviationMonitoringExample alarm if this differs from DevationMonitoringSetpoint (below) by more than 5 units*)
DeviationMonitoringSetpoint : INT; (*Setpoint for the DeviationMonitoringExample alarm. If DeviationMonitoring (above) differs from this value by more than 5 units, the alarm triggers*)
RateOfChange : INT; (*Triggers the RateOfChangeExample alarm if this value changes at a rate of more than 5 units per second*)
SnippetValue : INT; (*Process variable used in the SnippetExample alarm for the snippet*)
SetControlExample : BOOL; (*Boolean to trigger the example alarm which is triggerd by MpAlarmXControlExample_0*)
END_STRUCT;
END_TYPE

(*Enumerations*)

TYPE
ActiveAlarmStateEnum :
( (*Enumeration for the state for the query state machine*)
ACTIVE_ALARM_WAIT, (*Wait state*)
ACTIVE_ALARM_QUERY, (*State to query the alarm data*)
ACTIVE_ALARM_NEXT (*State to check if more alarms meet the query criteria and need to be queried*)
);
END_TYPE
33 changes: 33 additions & 0 deletions mappFramework/Logical/Infrastructure/AlarmX/AlarmMgr/AlarmMgr.var
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
(*Function Blocks*)
VAR
MpAlarmXHistory_0 : MpAlarmXHistory; (*MpAlarmXHistory instance*)
MpAlarmXHistoryUI_0 : MpAlarmXHistoryUI; (*MpAlarmXHistoryUI instance*)
MpAlarmXListUI_0 : MpAlarmXListUI; (*MpAlarmXList instance*)
MpAlarmXCore_0 : MpAlarmXCore; (*MpAlarmXCore instance*) (*ChangeStyleAlarmButton : USINT := 0; (*changeStyle of a AlarmFlyout in mappView*)
MpAlarmXControlExample_0 : {REDUND_UNREPLICABLE} MpAlarmXAlarmControl; (*MpAlarmXAlarmControl instance*)
QueryActiveAlarms_0 : {REDUND_UNREPLICABLE} MpAlarmXQuery; (*MpAlarmXQuery instance*)
DirCreate_0 : DirCreate; (*DirCreate instance*)
END_VAR
(*Constants*)
VAR CONSTANT
MAX_QUERY_RESULTS : USINT := 19; (*Maximum number of query results (Value+1)*)
MAX_SAFETY_DOOR : UINT := 5; (*Maximum number of safety doors (Value+1)*)
MAX_ESTOP : UINT := 2; (*Maximum number of emergency stops (Value+1)*)
LOCAL_FOLDER : STRING[10] := 'AlarmX'; (*Folder name on the file device for AlarmX files*)
END_VAR
(*Structure Types*)
VAR
HmiAlarmX : AlarmHmiInterfaceType; (*HMI interface structure*)
MpAlarmXListUIConnect : MpAlarmXListUIConnectType := (0); (*AlarmX list connection to the UI*)
MpAlarmXHistoryUIConnect : MpAlarmXHistoryUIConnectType; (*AlarmX History connection to the UI*)
SafetyInputs : MachineDigitalInputsType; (*Safety related digital inputs*)
AlarmExamples : {REDUND_UNREPLICABLE} AlarmExamplesType; (*Sample alarms for different monitoring types*)
AlarmQuery : {REDUND_UNREPLICABLE} AlarmQueryType; (*Query results and status*)
END_VAR
(*Variables*)
VAR
Alarms : {REDUND_UNREPLICABLE} ARRAY[0..99] OF BOOL; (*Array of monitored alarm bits*)
CommissioningModeActive : {REDUND_UNREPLICABLE} BOOL; (*Boolean value to enable commissioning mode. By default, this inhibits the Alarms[0] alarm*)
i : USINT; (*Index for loops*)
MaxIndex : USINT; (*Maximum index for the alarm list*)
END_VAR
Loading

0 comments on commit 30fd37d

Please sign in to comment.