Skip to content

Commit

Permalink
Merge pull request #19 from ghalym/master
Browse files Browse the repository at this point in the history
Logger implemented in most pumps and some valves function blocks.
  • Loading branch information
slacAdpai authored Mar 18, 2020
2 parents e7b4882 + d5593c2 commit cae969c
Show file tree
Hide file tree
Showing 41 changed files with 1,223 additions and 323 deletions.
2 changes: 1 addition & 1 deletion L2SIVacuum/DUTs/Pumps/ST_PTM.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ NOTE: This is an archetype, use an extension of this structure for a specific pu
(* Readbacks *)
{attribute 'pytmc' := '
pv: ILK_STATUS;
pv: ILK_OK;
field: ZNAM ILK ACTIVE;
field: ONAM ILK OK;
io: i;
Expand Down
2 changes: 1 addition & 1 deletion L2SIVacuum/DUTs/Valves/ST_VCN.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ STRUCT
// Outputs
{attribute 'pytmc' := '
pv: POS_AO;
pv: POS_AO_R;
io: i ;
'}
q_iRawPosition : INT; //Position control
Expand Down
6 changes: 3 additions & 3 deletions L2SIVacuum/DUTs/Valves/ST_VGC.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ STRUCT
field: PREC 2
field: EGU "TORR"
'}
rAT_VAC_SP : REAL := 0.01; // Interlock setpoint for gauges on both sides of valve
rAT_VAC_SP_LAST : REAL :=0.01 ; // Interlock setpoint for gauges on both sides of valve
rAT_VAC_SP : REAL := 0.000001; // Interlock setpoint for gauges on both sides of valve
rAT_VAC_SP_LAST : REAL :=0.000001 ; // Interlock setpoint for gauges on both sides of valve
{attribute 'pytmc' := '
pv: AT_VAC_HYS;
io: o;
Expand All @@ -105,7 +105,7 @@ STRUCT
field: PREC 2
field: EGU "TORR"
'}
rAT_VAC_HYS : REAL :=0.01; // Hysteresis of the vacuum sp
rAT_VAC_HYS : REAL :=0.000001; // Hysteresis of the vacuum sp
{attribute 'pytmc' := '
pv: HYST_PERC ;
io: o;
Expand Down
9 changes: 8 additions & 1 deletion L2SIVacuum/DUTs/Valves/ST_VRC.TcDUT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.16">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.18">
<DUT Name="ST_VRC" Id="{ee6efa67-7be0-4e42-b045-50546d4578bb}">
<Declaration><![CDATA[TYPE ST_VRC :
STRUCT
Expand Down Expand Up @@ -88,6 +88,13 @@ STRUCT
bErrorPresent : BOOL;
iErrorCode: INT;
{attribute 'pytmc' := '
pv: ErrMsg;
io: o;
'}
sErrorMessage: STRING;
END_STRUCT
END_TYPE]]></Declaration>
</DUT>
Expand Down
15 changes: 14 additions & 1 deletion L2SIVacuum/L2SIVacuum.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<CombineIds>false</CombineIds>
<Company>SLAC</Company>
<Released>false</Released>
<Title>L2SI Vacuum Library</Title>
<Title>lcls-twincat-vacuum</Title>
<ProjectVersion>0.0.0</ProjectVersion>
</PropertyGroup>
<ItemGroup>
Expand Down Expand Up @@ -197,6 +197,9 @@
<Compile Include="POUs\Functions\Pumps\FB_PTM_TwisTorr.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Pumps\FB_Pump.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Pumps\FB_ScrollPump.TcPOU">
<SubType>Code</SubType>
</Compile>
Expand All @@ -212,6 +215,9 @@
<Compile Include="POUs\Functions\Pumps\functions\F_TurboExtILKLogic_2.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Pumps\Interfaces\FB_TPIP_ADS.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Valves\FB_Kashiyama_VRC.TcPOU">
<SubType>Code</SubType>
</Compile>
Expand All @@ -221,6 +227,9 @@
<Compile Include="POUs\Functions\Valves\FB_TurbVentvalve_NO.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Valves\FB_Valve.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Valves\FB_VCC.TcPOU">
<SubType>Code</SubType>
<LinkAlways>true</LinkAlways>
Expand Down Expand Up @@ -270,6 +279,9 @@
<Compile Include="POUs\Functions\Valves\functions\F_TurboGateValve_ILK.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Valves\functions\F_TurboGateValve_ILK_1.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Valves\functions\F_TurboGateValve_Protection_ILK.TcPOU">
<SubType>Code</SubType>
</Compile>
Expand Down Expand Up @@ -308,6 +320,7 @@
<Folder Include="POUs\Functions\Gauges" />
<Folder Include="POUs\Functions\Gauges\Interfaces" />
<Folder Include="POUs\Functions\Pumps\functions" />
<Folder Include="POUs\Functions\Pumps\Interfaces" />
<Folder Include="POUs\Functions\Valves" />
<Folder Include="POUs\Functions\Pumps" />
<Folder Include="POUs\Functions\Valves\functions" />
Expand Down
4 changes: 2 additions & 2 deletions L2SIVacuum/L2SIVacuum.tmc

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions L2SIVacuum/POUs/Functions/Gauges/FB_972.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ VAR_OUTPUT
{attribute 'pytmc' := '
pv:
'}
VG : ST_VG;
PG : ST_VG;
END_VAR
VAR_IN_OUT
Expand All @@ -24,23 +24,24 @@ END_VAR
<ST><![CDATA[(* Standard MKS 9XX series conversion *)
(* works for 972 and 925 *)
rV := 10*INT_TO_REAL(VG.i_iPRESS_R)/iTermBits;
If (iTermBits=0) THEN iTermBits := 32767;END_IF
rV := 10*INT_TO_REAL(PG.i_iPRESS_R)/iTermBits;
IF rV > 1 THEN
VG.rPRESS := LREAL_TO_REAL(EXPT(10, 2*rV-11));
VG.xPRESS_OK := TRUE;
VG.eState := Valid; //Press OK
PG.rPRESS := LREAL_TO_REAL(EXPT(10, 2*rV-11));
PG.xPRESS_OK := TRUE;
PG.eState := Valid; //Press OK
ELSE
VG.xPRESS_OK := FALSE;
VG.eState := OoR;
PG.xPRESS_OK := FALSE;
PG.eState := OoR;
END_IF
(* Soft IO Mapping*)
ACT_IO();]]></ST>
</Implementation>
<Action Name="ACT_IO" Id="{57edb1c8-c4ce-46a6-8329-dd1927c8ce8e}">
<Implementation>
<ST><![CDATA[VG.i_iPRESS_R :=i_iPRESS_R;]]></ST>
<ST><![CDATA[PG.i_iPRESS_R :=i_iPRESS_R;]]></ST>
</Implementation>
</Action>
<Method Name="M_SetBits" Id="{c873eda2-ce3a-4d08-a1f9-e53b8f43dbd9}">
Expand All @@ -54,7 +55,9 @@ END_VAR
</Implementation>
</Method>
<LineIds Name="FB_972">
<LineId Id="3" Count="11" />
<LineId Id="3" Count="1" />
<LineId Id="53" Count="0" />
<LineId Id="5" Count="9" />
<LineId Id="2" Count="0" />
<LineId Id="33" Count="0" />
<LineId Id="32" Count="0" />
Expand Down
2 changes: 1 addition & 1 deletion L2SIVacuum/POUs/Functions/Gauges/FB_9XX.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ END_VAR
IF PG.rVAC_SP = 0 THEN
PG.rVAC_SP := rVAC_SP;
END_IF
If (iTermBits=0) THEN iTermBits := 32767;END_IF
rV := 10*INT_TO_REAL(PG.i_iPRESS_R)/iTermBits;
IF rV >= 0.99 THEN
Expand Down
22 changes: 11 additions & 11 deletions L2SIVacuum/POUs/Functions/Gauges/FB_CMR362.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VAR_INPUT
END_VAR
VAR_OUTPUT
{attribute 'pytmc' := 'pv:'}
VG : ST_VG;
PG : ST_VG;
END_VAR
VAR
MinPressure: REAL := 7.5E-3; //Torr
Expand All @@ -25,32 +25,32 @@ END_VAR
ACT_IO();
(* Real-value calculation *)
V := 10*INT_TO_REAL(VG.i_iPRESS_R)/iTermBits;
If (iTermBits=0) THEN iTermBits := 32767;END_IF
V := 10*INT_TO_REAL(PG.i_iPRESS_R)/iTermBits;
IF V < 0.4 THEN
VG.eState := GaugeDisconnected; //Most likely not connected
PG.eState := GaugeDisconnected; //Most likely not connected
ELSIF V >= 0.4 AND V <= 1.0 THEN
VG.rPRESS := MinPressure;
VG.eState := ValidLo;
PG.rPRESS := MinPressure;
PG.eState := ValidLo;
ELSIF V > 1 AND V <= 9.8 THEN
VG.rPRESS := LREAL_TO_REAL((V-1)*0.125*FullScale);
VG.eState := Valid;
PG.rPRESS := LREAL_TO_REAL((V-1)*0.125*FullScale);
PG.eState := Valid;
ELSE
VG.eState := OoR; //Larger voltage, probably out of range?
PG.eState := OoR; //Larger voltage, probably out of range?
END_IF
(* Pressure OK check *)
VG.xPRESS_OK := (VG.rPRESS >= MinPressure);
PG.xPRESS_OK := (PG.rPRESS >= MinPressure);
(*Soft IO Mapping*)
ACT_IO();
Expand All @@ -59,7 +59,7 @@ ACT_IO();
</Implementation>
<Action Name="ACT_IO" Id="{f7bdedec-d365-42ba-8021-29225073f9cd}">
<Implementation>
<ST><![CDATA[VG.i_iPRESS_R :=i_iPRESS_R;]]></ST>
<ST><![CDATA[PG.i_iPRESS_R :=i_iPRESS_R;]]></ST>
</Implementation>
</Action>
<Method Name="M_SetBits" Id="{945a4b7c-0383-4407-a003-10a045f5720a}">
Expand Down
20 changes: 10 additions & 10 deletions L2SIVacuum/POUs/Functions/Gauges/FB_GCM.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ VAR_IN_OUT
END_VAR
VAR_OUTPUT
{attribute 'pytmc' := 'pv:'}
VG : ST_VG;
PG : ST_VG;
END_VAR
VAR_INPUT
i_rFULL_SCALE : REAL;
Expand All @@ -32,25 +32,25 @@ A. Wallace
The full-scale pressure times the ratio of the meas.
voltage to full-scale voltage (10V).
The minimum pressure is always going to be 5e-4 * F.S.V.*)
VG.rFULL_SCALE := i_rFULL_SCALE;
rMinPressure := VG.rFULL_SCALE * 5E-4;
PG.rFULL_SCALE := i_rFULL_SCALE;
rMinPressure := PG.rFULL_SCALE * 5E-4;
If (iTermBits=0) THEN iTermBits := 32767;END_IF
rV :=MAX((10*INT_TO_REAL(PG.i_iPRESS_R)/iTermBits),0);
rV :=MAX((10*INT_TO_REAL(VG.i_iPRESS_R)/iTermBits),0);
VG.rPRESS := (VG.rFULL_SCALE/10)*rV;
IF VG.rPRESS > (rMinPressure)THEN
VG.xPRESS_OK := TRUE;
PG.rPRESS := (PG.rFULL_SCALE/10)*rV;
IF PG.rPRESS > (rMinPressure)THEN
PG.xPRESS_OK := TRUE;
ELSE
VG.xPRESS_OK := FALSE;
PG.xPRESS_OK := FALSE;
END_IF
(*IO soft linking*)
ACT_IO();]]></ST>
</Implementation>
<Action Name="ACT_IO" Id="{c1214d74-d1dc-47d0-8d43-06819891a8d4}">
<Implementation>
<ST><![CDATA[VG.i_iPRESS_R :=i_iPRESS_R;]]></ST>
<ST><![CDATA[PG.i_iPRESS_R :=i_iPRESS_R;]]></ST>
</Implementation>
</Action>
<Method Name="M_SetBits" Id="{ef0f5032-cc49-4110-b8a4-5e654a7699b0}">
Expand Down
6 changes: 4 additions & 2 deletions L2SIVacuum/POUs/Functions/Gauges/FB_ITR90.TcPOU
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.16">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.18">
<POU Name="FB_ITR90" Id="{d1491968-690d-4aa1-ab30-fd64b81089f0}" SpecialFunc="None">
<Declaration><![CDATA[(* This function block implements the Oerlikon Leybold IONVAC Hot Cathode ITR 90*)
FUNCTION_BLOCK FB_ITR90
Expand Down Expand Up @@ -69,7 +69,8 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[This^.iTermBits := TermBits;]]></ST>
<ST><![CDATA[If (iTermBits=0) THEN iTermBits := 32767;END_IF
This^.iTermBits := TermBits;]]></ST>
</Implementation>
</Method>
<LineIds Name="FB_ITR90">
Expand All @@ -85,6 +86,7 @@ END_VAR
<LineId Id="1" Count="0" />
</LineIds>
<LineIds Name="FB_ITR90.M_SetBits">
<LineId Id="10" Count="0" />
<LineId Id="5" Count="0" />
</LineIds>
</POU>
Expand Down
2 changes: 1 addition & 1 deletion L2SIVacuum/POUs/Functions/Gauges/FB_MKS275.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ IF PG.rVAC_SP = 0 THEN
END_IF
(* Real-value calculation *)
If (iTermBits=0) THEN iTermBits := 32767;END_IF
V := 10*INT_TO_REAL(PG.i_iPRESS_R)/iTermBits;
Vlowest := MIN(V, Vlowest);
Expand Down
10 changes: 5 additions & 5 deletions L2SIVacuum/POUs/Functions/Gauges/FB_MKS392.TcPOU
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.16">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.18">
<POU Name="FB_MKS392" Id="{afeb32df-f2b5-4c42-9623-5607aedfb59f}" SpecialFunc="None">
<Declaration><![CDATA[(* This function block implements the MKS392 gauge*)
FUNCTION_BLOCK FB_MKS392
Expand All @@ -13,15 +13,14 @@ VAR_OUTPUT
END_VAR
VAR
rV : REAL; // input voltage
iTermBits: UINT := 32767 ; // The terminal's maximum value in bits
(*IO*)
i_iPRESS_R AT%I* :INT; // input Pressure // Link to analog Input
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[(* Real-value calculation *)
rV := 10*INT_TO_REAL(PG.i_iPRESS_R)/32767;
rV := 10*INT_TO_REAL(PG.i_iPRESS_R)/iTermBits;
PG.rPRESS := (LREAL_TO_REAL(EXPT(10,(2*rV)-11)));
Expand Down Expand Up @@ -57,7 +56,8 @@ ACT_IO();
</Implementation>
</Action>
<LineIds Name="FB_MKS392">
<LineId Id="24" Count="6" />
<LineId Id="24" Count="0" />
<LineId Id="26" Count="4" />
<LineId Id="33" Count="22" />
<LineId Id="9" Count="0" />
</LineIds>
Expand Down
6 changes: 3 additions & 3 deletions L2SIVacuum/POUs/Functions/Gauges/FB_MKS500.TcPOU
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.16">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.18">
<POU Name="FB_MKS500" Id="{7585aac8-a989-4785-918b-438600204b3a}" SpecialFunc="None">
<Declaration><![CDATA[(* This function is for the Cold Cathode MKS 500 connected to Beckhoff EL terminals*)
(* 500 Logarithmic Output Conversion, factory default configuration *)
Expand All @@ -26,7 +26,7 @@ VAR
MinPressure: REAL := 1E-10;
cDefaultPressure : REAL := 0;
timer:TON;
iTermBits: UINT := 32767 ; // The terminal's maximum value in bits
iTermBits: UINT := 32767 ; // The terminal's maximum value in bits
(*IOs to be linked*)
/// Controls and I/Os
i_iPRESS_R AT %I* :INT; // input Pressure // Link to analog Input
Expand All @@ -38,7 +38,7 @@ END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[(* 500 Logarithmic Output Conversion, factory default configuration *)
If (iTermBits=0) THEN iTermBits := 32767;END_IF
rV := 10*INT_TO_REAL(IG.i_iPRESS_R)/iTermBits;
(*
Expand Down
Loading

0 comments on commit cae969c

Please sign in to comment.