Skip to content

Commit

Permalink
Merge pull request #117 from janezg-SLAC/VAT590_2OO3
Browse files Browse the repository at this point in the history
Variable leak valve VAT590 and 2OO3 Reset function
  • Loading branch information
jyin999 authored Jan 18, 2024
2 parents 21e8fb5 + b5d4d41 commit 5439d35
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 15 deletions.
17 changes: 17 additions & 0 deletions L2SIVacuum/DUTs/Valves/VAT590/ST_VAT590_COE.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,23 @@ STRUCT
field: DRVH 100.0
'}
fPGain_SP : REAL;
(*Position Limit Parameters*)
{attribute 'pytmc' := '
pv: POSITION_LIMIT_OPN
io: io
field: EGU "%"
field: DRVL 0.0
field: DRVH 100.0
'}
fPositionLimitOpen : REAL;
{attribute 'pytmc' := '
pv: POSITION_LIMIT_OPN_CTRL
io: io
field: EGU "%"
field: DRVL 0.0
field: DRVH 100.0
'}
fPositionLimitOpenControl : REAL;
END_STRUCT
END_TYPE
]]></Declaration>
Expand Down
10 changes: 5 additions & 5 deletions L2SIVacuum/L2SIVacuum.tmc

Large diffs are not rendered by default.

Binary file modified L2SIVacuum/LineIDs.dbg
Binary file not shown.
28 changes: 27 additions & 1 deletion L2SIVacuum/POUs/Functions/Valves/FB_VCN_VAT590.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ VAR CONSTANT
cRampTime_SP : ST_CoEIndSub := (nIndex := 16#21B9, nSubIndex := 0); // Soft Pump controller Ramp Time CoE register
cRampMode_SP : ST_CoEIndSub := (nIndex := 16#21BA, nSubIndex := 0); // Soft Pump controller Ramp Time CoE register
cPGain_SP : ST_CoEIndSub := (nIndex := 16#21BC, nSubIndex := 0); // Soft Pump controller Ramp Time CoE register
cPosLimitOpen : ST_CoEIndSub := (nIndex := 16#56B3, nSubIndex := 0); // General open limit. It overides the PosLimitOpenCtrl if SET lower
cPosLimitOpenCtrl : ST_CoEIndSub := (nIndex := 16#56B4, nSubIndex := 0); // Open limit active during pressure control only
END_VAR
VAR
fCalcPosSP : REAL := 0;
Expand Down Expand Up @@ -391,14 +393,26 @@ IF tAction.Q THEN fbLogger(sMsg:='Valve commanded to fully open', eSevr:=TcEvent
fbCoeRead.pDstBuf := ADR(stVcnVat590.stCoeParameters.fPGain_SP);
fbCoeRead.cbBufLen := SIZEOF(stVcnVat590.stCoeParameters.fPGain_SP);
fbCoeRead.bExecute := TRUE;
19:
fbCoeRead.nIndex := cPosLimitOpen.nIndex;
fbCoeRead.nSubIndex := cPosLimitOpen.nSubIndex;
fbCoeRead.pDstBuf := ADR(stVcnVat590.stCoeParameters.fPositionLimitOpen);
fbCoeRead.cbBufLen := SIZEOF(stVcnVat590.stCoeParameters.fPositionLimitOpen);
fbCoeRead.bExecute := TRUE;
20:
fbCoeRead.nIndex := cPosLimitOpenCtrl.nIndex;
fbCoeRead.nSubIndex := cPosLimitOpenCtrl.nSubIndex;
fbCoeRead.pDstBuf := ADR(stVcnVat590.stCoeParameters.fPositionLimitOpenControl);
fbCoeRead.cbBufLen := SIZEOF(stVcnVat590.stCoeParameters.fPositionLimitOpenControl);
fbCoeRead.bExecute := TRUE;
END_CASE
ftCoeReadBusy(CLK:=fbCoeRead.bBusy);
IF ftCoeReadBusy.Q THEN
fbCoeRead.bExecute := FALSE;
IF NOT fbCoeRead.bError THEN
nCaseReadCoe := nCaseReadCoe + 1;
IF nCaseReadCoe > 18 THEN
IF nCaseReadCoe > 20 THEN
nCaseReadCoe := 1;
bFirstRead := FALSE; // Reset bFirstRead after successfull readout of all parameters
END_IF
Expand Down Expand Up @@ -600,6 +614,18 @@ ELSIF stVcnVat590.stCoeParameters.fPGain_SP <> stCoeParamsInternal.fPGain_SP THE
fbCoeWrite.pSrcBuf := ADR(stVcnVat590.stCoeParameters.fPGain_SP);
fbCoeWrite.cbBufLen := SIZEOF(stVcnVat590.stCoeParameters.fPGain_SP);
fbCoeWrite.bExecute := TRUE;
ELSIF stVcnVat590.stCoeParameters.fPositionLimitOpen <> stCoeParamsInternal.fPositionLimitOpen THEN
fbCoeWrite.nIndex := cPosLimitOpen.nIndex;
fbCoeWrite.nSubIndex := cPosLimitOpen.nSubIndex;
fbCoeWrite.pSrcBuf := ADR(stVcnVat590.stCoeParameters.fPositionLimitOpen);
fbCoeWrite.cbBufLen := SIZEOF(stVcnVat590.stCoeParameters.fPositionLimitOpen);
fbCoeWrite.bExecute := TRUE;
ELSIF stVcnVat590.stCoeParameters.fPositionLimitOpenControl <> stCoeParamsInternal.fPositionLimitOpenControl THEN
fbCoeWrite.nIndex := cPosLimitOpenCtrl.nIndex;
fbCoeWrite.nSubIndex := cPosLimitOpenCtrl.nSubIndex;
fbCoeWrite.pSrcBuf := ADR(stVcnVat590.stCoeParameters.fPositionLimitOpenControl);
fbCoeWrite.cbBufLen := SIZEOF(stVcnVat590.stCoeParameters.fPositionLimitOpenControl);
fbCoeWrite.bExecute := TRUE;
END_IF
ftCoeWriteBusy(CLK:=fbCoeWrite.bBusy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ END_IF
(*OPN OK evaluation bit *)
xOPN_OK := (i_xVAC_FAULT_OK) AND (NOT i_xTrigger OR (q_xVetoValveClosed AND NOT q_xVetoValveOpenDO));
(*Reset Fault counter, q_ResetFaultCounter output is TRUE for one plc cycle *)
rtResetFaultCounter(CLK := i_ResetFaultCounter);
IF rtResetFaultCounter.Q THEN
i_ResetFaultCounter := FALSE;
q_ResetFaultCounter := TRUE;
ELSE
q_ResetFaultCounter := FALSE;
END_IF
(*Soft IO Mapping*)
IO();
Expand Down Expand Up @@ -198,15 +207,7 @@ iq_stValve.sVetoDeviceName := Veto_Valve.sDevName;
(*2oo3 mode selector*)
q_e2OO3_MODE := i_e2OO3_MODE;
(*Reset Fault counter, q_ResetFaultCounter output is TRUE for one plc cycle *)
rtResetFaultCounter(CLK := i_ResetFaultCounter);
IF rtResetFaultCounter.Q THEN
i_ResetFaultCounter := FALSE;
q_ResetFaultCounter := TRUE;
ELSE
q_ResetFaultCounter := FALSE;
END_IF]]></ST>
]]></ST>
</Implementation>
</Action>
</POU>
Expand Down

0 comments on commit 5439d35

Please sign in to comment.