-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from C0bit/eps
ENH: Add EPS structure for displaying interlock information and logic
- Loading branch information
Showing
2 changed files
with
105 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12"> | ||
<DUT Name="DUT_EPS" Id="{0134451e-57c2-478a-9365-5d6570cca7b2}"> | ||
<Declaration><![CDATA[TYPE DUT_EPS : | ||
STRUCT | ||
// Contains EPS flags | ||
{attribute 'pytmc' := ' | ||
pv: nFlags | ||
io: i | ||
field: DESC Contains EPS flags | ||
'} | ||
nFlags: UDINT := 16#FFFFFFFF; | ||
// Desciption of values nFlags contains | ||
{attribute 'pytmc' := ' | ||
pv: sFlagDesc | ||
io: i | ||
field: DESC of nFlag variable, using ';' seperated list. | ||
'} | ||
sFlagDesc: STRING; | ||
// Name to use for log messages. | ||
{attribute 'pytmc' := ' | ||
pv: sMessage | ||
io: i | ||
field: DESC Message from EPS to usr | ||
'} | ||
sMessage: STRING; | ||
// Keep Track if nFlags are all true | ||
{atribute 'pytmc' := ' | ||
pv: bEPS_OK | ||
io: i | ||
field: DESC check if nFlags are all true; | ||
'} | ||
bEPS_OK : BOOL := TRUE; | ||
END_STRUCT | ||
END_TYPE]]></Declaration> | ||
</DUT> | ||
</TcPlcObject> |
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,65 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12"> | ||
<POU Name="FB_EPS" Id="{0c78cf58-96ea-4c52-b0ca-64b7290d1ef9}" SpecialFunc="None"> | ||
<Declaration><![CDATA[FUNCTION_BLOCK FB_EPS | ||
VAR_IN_OUT | ||
eps : DUT_EPS; | ||
END_VAR | ||
VAR_OUTPUT | ||
END_VAR | ||
VAR | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[]]></ST> | ||
</Implementation> | ||
<Method Name="setBit" Id="{243035d2-b889-46d7-b89e-610b76586068}"> | ||
<Declaration><![CDATA[METHOD setBit : BOOL | ||
VAR_INPUT | ||
nBits : BYTE; | ||
bValue : BOOL; | ||
END_VAR | ||
VAR | ||
nMask : UDINT := 1; | ||
nBitValue : UDINT := 0; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[nMask := SHL(nMask, nBits); | ||
nBitValue := SHR((nMask AND eps.nFlags), nBits); | ||
IF (TO_BOOL(nBitValue)) <> bValue THEN | ||
eps.nFlags := eps.nFlags XOR nMask; | ||
END_IF | ||
// Check if all values are true | ||
IF eps.nFlags = 16#FFFFFFFF THEN | ||
eps.bEPS_OK := TRUE; | ||
ELSE | ||
eps.bEPS_OK := FALSE; | ||
END_IF | ||
]]></ST> | ||
</Implementation> | ||
</Method> | ||
<Method Name="setDescription" Id="{84797ad0-c375-4675-8998-ec2e912fbbdd}"> | ||
<Declaration><![CDATA[METHOD setDescription : BOOL | ||
VAR_INPUT | ||
desciption : STRING; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[eps.sFlagDesc := desciption;]]></ST> | ||
</Implementation> | ||
</Method> | ||
<Method Name="setMessage" Id="{50553b5a-8e8e-441f-8a78-c5cb5c67e718}"> | ||
<Declaration><![CDATA[METHOD setMessage : BOOL | ||
VAR_INPUT | ||
message : STRING; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[eps.sMessage := message;]]></ST> | ||
</Implementation> | ||
</Method> | ||
</POU> | ||
</TcPlcObject> |