Skip to content

Commit

Permalink
Merge pull request #93 from jyin999/VAT590
Browse files Browse the repository at this point in the history
Vat590
  • Loading branch information
jyin999 authored Mar 28, 2022
2 parents 2399d08 + d38d888 commit 0ecdade
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 33 deletions.
4 changes: 2 additions & 2 deletions L2SIVacuum/DUTs/Valves/VAT590/ST_VAT590_STATUS.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<Declaration><![CDATA[TYPE ST_VAT590_STATUS :
STRUCT
{attribute 'pytmc' := '
pv: CTRL_MODE_RBV
pv: CTRL_MODE
io: i
'}
eControlMode : E_ControlMode; // Valve control mode readback
{attribute 'pytmc' := '
pv: FATAL_ERR_RBV
pv: FATAL_ERR
io: i
'}
eFatalErrors : E_FatalErrors; // Valve Fatal Error status readback
Expand Down
29 changes: 16 additions & 13 deletions L2SIVacuum/DUTs/Valves/VAT590/ST_VCN_VAT590.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ STRUCT
(* VCN - Valve Controlled Needle
Used for VAT590 needle valves *)
{attribute 'pytmc' := '
pv: POS_RAW_RBV
pv: POS_RAW
io: i
'}
nRawPosition : DINT; //Position readback
{attribute 'pytmc' := '
pv: PRES_RAW_RBV
pv: PRES_RAW
io: i
'}
nRawPressure : DINT; //Pressure readback
{attribute 'pytmc' := '
pv: PRES_TORR_RBV
pv: PRES_TORR
field: EGU "TORR"
io: i
'}
fPressure : REAL; //Pressure readback in Torr units
{attribute 'pytmc' := '
pv: POS_SP_RBV
pv: POS_SP
io: i
'}
nPositionSP : DINT; //Position setpoint readback
{attribute 'pytmc' := '
pv: PRES_SP_RBV
pv: PRES_SP
io: i
'}
nPressureSP : DINT; //Pressure setpoint readback
Expand All @@ -41,17 +41,23 @@ STRUCT
'}
bIlkOK : BOOL := FALSE; // Interlock Bit status
{attribute 'pytmc' := '
pv: Limit
pv: POS_LIMIT
io: io
autosave_pass1: VAL DESC
'}
fUpperLimit : REAL := 100; // Percentage Upper limit on valve open
fPosSetLimit : REAL := 100; // Percentage Upper limit on valve open
{attribute 'pytmc' := '
pv: PresLimit
pv: PRES_SET_LIMIT
io: io
autosave_pass1: VAL DESC
'}
fPresUpperLimit : REAL := 1E-2; // Upper limit for pressure control
fPresSetLimit : REAL := 1E-2; // Upper limit for pressure control
{attribute 'pytmc' := '
pv: PRES_RDBK_LIMIT
io: io
autosave_pass1: VAL DESC
'}
fPresRdbkLimit : REAL := 1E-4; //upper limit for pressure reading before valve close
{attribute 'pytmc' := '
pv: POS_REQ
field: DRVL 0.0
Expand Down Expand Up @@ -91,10 +97,7 @@ STRUCT
io: o
'}
bZero : BOOL; // Activate Zero function bit
{attribute 'pytmc' := '
pv: GEN_STATUS
io: i
'}
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 removed L2SIVacuum/LineIDs.dbg
Binary file not shown.
14 changes: 14 additions & 0 deletions L2SIVacuum/POUs/Functions/Gauges/FB_972.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,19 @@ END_VAR
<ST><![CDATA[This^.iTermBits := TermBits;]]></ST>
</Implementation>
</Method>
<LineIds Name="FB_972">
<LineId Id="3" Count="22" />
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_972.ACT_IO">
<LineId Id="1" Count="0" />
</LineIds>
<LineIds Name="FB_972.ACT_Logger">
<LineId Id="2" Count="22" />
<LineId Id="1" Count="0" />
</LineIds>
<LineIds Name="FB_972.M_SetBits">
<LineId Id="2" Count="0" />
</LineIds>
</POU>
</TcPlcObject>
46 changes: 33 additions & 13 deletions L2SIVacuum/POUs/Functions/Valves/FB_VCN_VAT590.TcPOU
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.18">
<POU Name="FB_VCN_VAT590" Id="{4758ecab-cc0c-4c37-8981-9d3a1c0c082a}" SpecialFunc="None">
<Declaration><![CDATA[{attribute 'no_check'}
<Declaration><![CDATA[//{attribute 'no_check'}
(* This function implements the Basic functions for the VAT590 needle valve*)
FUNCTION_BLOCK FB_VCN_VAT590 EXTENDS FB_Valve
VAR_INPUT
Expand Down Expand Up @@ -57,6 +57,7 @@ END_VAR
VAR PERSISTENT
fUpperLimit : REAL; // Max position in % that can be requested
fPresMaxLim : REAL; // Max pressure in Torr that can be requested
fPresRbMaxLim : REAL; // Max pressure in Torr read by chamber gauge, valve will close above the pressure.
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[(* Needle valve control FB
Expand Down Expand Up @@ -84,9 +85,14 @@ IF bExtIlkOK THEN
E_VCN_VAT590.CloseValve:
eValveModeSP := E_ControlModeSP.CloseValve;
E_VCN_VAT590.ManualControl:
eValveModeSP := E_ControlModeSP.ManualControl;
IF IG.xPRESS_OK AND IG.rPRESS <= fPresRbMaxLim THEN
eValveModeSP := E_ControlModeSP.ManualControl;
ELSE
eValveModeSP := E_ControlModeSP.CloseValve; // Close valve if something is wrong with the gauge
stVcnVat590.eValveControl := E_VCN_VAT590.CloseValve;
END_IF
E_VCN_VAT590.PressureControl:
IF IG.eState = E_PressureState.Valid THEN
IF IG.xPRESS_OK AND IG.rPRESS <= fPresRbMaxLim THEN
eValveModeSP := E_ControlModeSP.PressureControl;
ELSE
eValveModeSP := E_ControlModeSP.CloseValve; // Close valve if something is wrong with the gauge
Expand Down Expand Up @@ -130,7 +136,7 @@ CASE stVcnVat590.ePressureSensor OF
END_CASE
(*Calculated Pressure SP and Pressure readback is 0 if Pressure sensor is not working*)
IF IG.eState <> E_PressureState.Valid THEN
IF NOT (IG.xPRESS_OK AND IG.rPRESS < fPresRbMaxLim ) THEN
fCalcPresSP := 0;
stVcnVat590.fPressure := 0;
END_IF
Expand Down Expand Up @@ -200,11 +206,16 @@ IF tAction.Q THEN fbLogger(sMsg:='Valve commanded to fully open', eSevr:=TcEvent
IF (bRestorePersistentData) THEN
bRestorePersistentData := FALSE;
IF (fUpperLimit <> 0) THEN
stVcnVat590.fUpperLimit := fUpperLimit;
stVcnVat590.fPosSetLimit := fUpperLimit;
END_IF;
IF (fPresMaxLim <> 0) THEN
stVcnVat590.fPresUpperLimit := fPresMaxLim;
stVcnVat590.fPresSetLimit := fPresMaxLim;
END_IF;
IF (fPresRbMaxLim <> 0) THEN
stVcnVat590.fPresRdbkLimit := fPresRbMaxLim;
END_IF;
END_IF]]></ST>
</Implementation>
</Action>
Expand All @@ -216,7 +227,7 @@ END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[
stVcnVat590.fUpperLimit := LIMIT(0, rUpperLimit, 100);]]></ST>
stVcnVat590.fPosSetLimit := LIMIT(0, rUpperLimit, 100);]]></ST>
</Implementation>
</Method>
<Method Name="M_ValveControl" Id="{25066385-eb5f-47fb-8ac4-a5fcdc50740f}">
Expand All @@ -232,8 +243,9 @@ END_VAR
<Action Name="ReadFromInput" Id="{2b46db7d-12fe-424a-afdf-e2d60ed01bdb}">
<Implementation>
<ST><![CDATA[(*Read from EPICS*)
fUpperLimit := LIMIT(0, stVcnVat590.fUpperLimit, 100);
fPresMaxLim := LIMIT(1.0E-10, stVcnVat590.fPresUpperLimit, 1.0E-2);
fUpperLimit := LIMIT(0, stVcnVat590.fPosSetLimit, 100);
fPresMaxLim := LIMIT(1.0E-10, stVcnVat590.fPresSetLimit, 1.0E-2);
fPresRbMaxLim := LIMIT(1.0E-10, stVcnVat590.fPresRdbkLimit, 1.0E-2);
fReqPos := LIMIT(0, stVcnVat590.fReqPosition, 100);
fReqPres := LIMIT(1.0E-10, stVcnVat590.fReqPressure, 1.0E-2);
Expand Down Expand Up @@ -277,8 +289,8 @@ stVcnVat590.nPositionSP := REAL_TO_DINT(fCalcPosSP);
stVcnVat590.nPressureSP := REAL_TO_DINT(fCalcPresSP);
stVcnVat590.fReqPosition := fReqPos;
stVcnVat590.fReqPressure := fReqPres;
stVcnVat590.fPresUpperLimit := fPresMaxLim;
stVcnVat590.fUpperLimit := fUpperLimit;
stVcnVat590.fPresSetLimit := fPresMaxLim;
stVcnVat590.fPosSetLimit := fUpperLimit;
(*Write to VAT valve*)
o_eCtrlModeSP := eValveModeSP;
Expand All @@ -291,7 +303,11 @@ o_stGenCtrlSP.Bit4AccessMode := bRemAcsToggle;]]></ST>
<LineIds Name="FB_VCN_VAT590">
<LineId Id="3" Count="12" />
<LineId Id="372" Count="0" />
<LineId Id="17" Count="11" />
<LineId Id="17" Count="10" />
<LineId Id="594" Count="0" />
<LineId Id="28" Count="0" />
<LineId Id="595" Count="0" />
<LineId Id="597" Count="2" />
<LineId Id="30" Count="0" />
<LineId Id="356" Count="0" />
<LineId Id="31" Count="0" />
Expand Down Expand Up @@ -341,6 +357,10 @@ o_stGenCtrlSP.Bit4AccessMode := bRemAcsToggle;]]></ST>
<LineId Id="2" Count="5" />
<LineId Id="17" Count="1" />
<LineId Id="16" Count="0" />
<LineId Id="22" Count="1" />
<LineId Id="21" Count="0" />
<LineId Id="20" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="9" Count="0" />
</LineIds>
<LineIds Name="FB_VCN_VAT590.M_SetThrottle">
Expand All @@ -352,7 +372,7 @@ o_stGenCtrlSP.Bit4AccessMode := bRemAcsToggle;]]></ST>
</LineIds>
<LineIds Name="FB_VCN_VAT590.ReadFromInput">
<LineId Id="2" Count="1" />
<LineId Id="38" Count="0" />
<LineId Id="38" Count="1" />
<LineId Id="4" Count="0" />
<LineId Id="37" Count="0" />
<LineId Id="5" Count="12" />
Expand Down

0 comments on commit 0ecdade

Please sign in to comment.