Skip to content

Commit 2b84d50

Browse files
Adding abstract StopperVetoable
1 parent aade622 commit 2b84d50

File tree

6 files changed

+62
-5
lines changed

6 files changed

+62
-5
lines changed

lcls-twincat-pmps/PMPS/DUTs/InternalDUT/K_Stopper.TcDUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ TYPE K_Stopper :
1717
MR2K3_IN := 10, // TXI MR2K3 Offset Mirror state
1818
MR2K3_OUT := 11, // TXI MR2K3 Offset Mirror horizontal state
1919
DEFAULT := PMPS_GVL.MAX_VETO_DEVICES // DO NOT USE FOR ANYTHING
20-
);
20+
)WORD;
2121
END_TYPE
2222
]]></Declaration>
2323
</DUT>

lcls-twincat-pmps/PMPS/DUTs/InternalDUT/L_Stopper.TcDUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TYPE L_Stopper :
1212
MR1L1_IN:= 5, // TXI Offset Mirror horizontal state
1313
MR1L1_OUT:= 6, // TXI Offset Mirror horizontal state
1414
DEFAULT := PMPS_GVL.MAX_VETO_DEVICES // DO NOT USE FOR ANYTHING
15-
);
15+
)WORD;
1616
END_TYPE
1717
]]></Declaration>
1818
</DUT>

lcls-twincat-pmps/PMPS/MajorComponents/Arbiter/FB_VetoArbiter.TcPOU

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.18">
33
<POU Name="FB_VetoArbiter" Id="{c3c91f40-d3bf-4445-afff-e5f72e704ac3}" SpecialFunc="None">
4-
<Declaration><![CDATA[FUNCTION_BLOCK FB_VetoArbiter IMPLEMENTS I_HigherAuthority
4+
<Declaration><![CDATA[FUNCTION_BLOCK FB_VetoArbiter EXTENDS FB_StopperVetoable IMPLEMENTS I_HigherAuthority
55
VAR_INPUT
66
bVeto : BOOL := FALSE; // Rising edge clears request, hold true to veto continuously, falling edge restores request
77
HigherAuthority : I_HigherAuthority; // Typically connected to a higher-level arbiter.
@@ -30,6 +30,7 @@ END_VAR
3030
]]></Declaration>
3131
<Implementation>
3232
<ST><![CDATA[
33+
bVeto := bVeto OR CheckStoppers();
3334
rtVeto(CLK:=bVeto);
3435
ftVeto(CLK:=bVeto);
3536
LowerAuthority.bLowerAuthorityVetoed := bVeto;
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.12">
3+
<POU Name="FB_StopperVetoable" Id="{9114ce33-096d-4859-8327-51a29b1b7c16}" SpecialFunc="None">
4+
<Declaration><![CDATA[FUNCTION_BLOCK ABSTRACT FB_StopperVetoable
5+
VAR
6+
{attribute 'pytmc' := '
7+
pv: StopperMask
8+
io: i
9+
field: DESC Bitmask of stoppers that veto this
10+
'}
11+
wStopperMask : WORD;
12+
END_VAR
13+
]]></Declaration>
14+
<Implementation>
15+
<ST><![CDATA[]]></ST>
16+
</Implementation>
17+
<Method Name="AddStopper" Id="{dfc9400d-efbb-4f3c-bb34-86649ddea037}">
18+
<Declaration><![CDATA[METHOD AddStopper : BOOL
19+
VAR_INPUT
20+
wStopper: WORD;
21+
END_VAR
22+
]]></Declaration>
23+
<Implementation>
24+
<ST><![CDATA[AddStopper := WORD_TO_BOOL(wStopperMask AND SHL(WORD#1, wStopper));
25+
wStopperMask := wStopperMask OR SHL(WORD#1, wStopper);]]></ST>
26+
</Implementation>
27+
</Method>
28+
<Method Name="CheckStoppers" Id="{1e391055-0614-47cf-92fe-50cbf0483ad1}">
29+
<Declaration><![CDATA[METHOD CheckStoppers : BOOL
30+
VAR
31+
i: WORD;
32+
END_VAR
33+
]]></Declaration>
34+
<Implementation>
35+
<ST><![CDATA[FOR i:=1 TO PMPS_GVL.MAX_VETO_DEVICES BY 1 DO
36+
CheckStoppers := CheckStoppers OR (PMPS_GVL.stCurrentBeamParameters.aVetoDevices[i] AND WORD_TO_BOOL(wStopperMask AND SHL(WORD#1, i)));
37+
END_FOR
38+
]]></ST>
39+
</Implementation>
40+
</Method>
41+
<Method Name="RemoveStopper" Id="{00072576-a6e6-4097-9bd8-6246e1ae5421}">
42+
<Declaration><![CDATA[METHOD RemoveStopper : BOOL
43+
VAR_INPUT
44+
wStopper: WORD;
45+
END_VAR
46+
]]></Declaration>
47+
<Implementation>
48+
<ST><![CDATA[RemoveStopper := WORD_TO_BOOL(wStopperMask AND SHL(WORD#1, wStopper));
49+
wStopperMask := wStopperMask AND NOT SHL(WORD#1, wStopper);]]></ST>
50+
</Implementation>
51+
</Method>
52+
</POU>
53+
</TcPlcObject>

lcls-twincat-pmps/PMPS/MajorComponents/FastFaults/FB_HardwareFFOutput.TcPOU

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<POU Name="FB_HardwareFFOutput" Id="{4c5345fc-1911-455c-a3d8-14bade73dcd8}" SpecialFunc="None">
44
<Declaration><![CDATA[{attribute 'reflection'}
55
{attribute 'no_check'}
6-
FUNCTION_BLOCK FB_HardwareFFOutput
6+
FUNCTION_BLOCK FB_HardwareFFOutput EXTENDS FB_StopperVetoable
77
VAR CONSTANT
88
FF_ARRAY_UPPER_BOUND : UINT := PMPS_PARAM.MAX_FAST_FAULTS;
99
END_VAR
@@ -324,7 +324,7 @@ stFF.rtReset(CLK:=stFF.Reset (*epics*) OR Reset (*from other PLC logic *) );
324324
stFF.Reset R= stFF.rtReset.Q;
325325
stFF.bsFF(SET := stFF.rtReset.Q OR stFF.Info.AutoReset, RESET1:= NOT OK);
326326
327-
BeamPermitted := stFF.bsFF.Q1 OR stFF.Ovrd.Active OR (i_xVeto AND stFF.Info.Vetoable);
327+
BeamPermitted := stFF.bsFF.Q1 OR stFF.Ovrd.Active OR ((i_xVeto OR CheckStoppers()) AND stFF.Info.Vetoable);
328328
329329
// Fault generation
330330
IF NOT BeamPermitted THEN

lcls-twincat-pmps/PMPS/PMPS.plcproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@
270270
<Compile Include="MajorComponents\FB_BeamClassFromEPICS.TcPOU">
271271
<SubType>Code</SubType>
272272
</Compile>
273+
<Compile Include="MajorComponents\FB_StopperVetoable.TcPOU">
274+
<SubType>Code</SubType>
275+
</Compile>
273276
<Compile Include="MajorComponents\I_LowerAuthority.TcIO">
274277
<SubType>Code</SubType>
275278
</Compile>

0 commit comments

Comments
 (0)