Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes and Fixes for TMO vac #64

Merged
merged 4 commits into from
Oct 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions L2SIVacuum/L2SIVacuum.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
<Compile Include="POUs\ADS\FB_ADS_WATCHDOG.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\ADS\FB_TBOOL_ADS.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Deprecated\Gauges\FB_MKS317A.TcPOU">
<SubType>Code</SubType>
<LinkAlways>true</LinkAlways>
Expand Down Expand Up @@ -210,6 +213,9 @@
<Compile Include="POUs\Functions\Gauges\Interfaces\FB_TGCC_ADS.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Gauges\Interfaces\FB_TGPI_ADS.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Pumps\FB_EbaraDryPump.TcPOU">
<SubType>Code</SubType>
</Compile>
Expand Down Expand Up @@ -348,6 +354,9 @@
<SubType>Code</SubType>
<LinkAlways>true</LinkAlways>
</Compile>
<Compile Include="POUs\Functions\Valves\Interfaces\FB_TVGC_2S_ADS.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Functions\Valves\Interfaces\FB_VFS_Interface.TcPOU">
<SubType>Code</SubType>
</Compile>
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.
76 changes: 76 additions & 0 deletions L2SIVacuum/POUs/ADS/FB_TBOOL_ADS.TcPOU
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.18">
<POU Name="FB_TBOOL_ADS" Id="{55de7e0e-296a-42bd-8da3-0dfe79b7395a}" SpecialFunc="None">
<Declaration><![CDATA[(* This function block is created for interface a boolean singal between different PLCs*)
(* The variable values are read via ADS using the symbol name*)
FUNCTION_BLOCK FB_TBOOL_ADS Extends FB_ADS
VAR_INPUT
sNetId : String; //NetID of the Destination PLC controller
nPort : uint; // port number
sVarName : string;// the variable name of the declared pip/pin function block.
iWatchdog:UDINT;//The watchdog variable name written to by the remote plc
END_VAR
VAR_OUTPUT
{attribute 'pytmc' := 'pv: value'}
bBool : BOOL;
{attribute 'pytmc' := 'pv: error'}
bError: BOOL;
END_VAR
VAR
fb_CheckWatchdog: FB_CheckWatchdog;
fb_Read: FB_ReadAdsSymByName;
ftReset: F_TRIG;
xFirstPass: BOOL:= true;

END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[
ftReset(CLK:= fb_Read.bBusy OR xFirstPass);
xFirstPass := false;
(*calling ADS read function*)

fb_Read(
bRead:=ftReset.Q ,
sNetId:= sNetId,
nPort:= nPort,
sVarName:= sVarName,
nDestAddr:= ADR(bBool),
nLen:= SIZEOF(bBool),
tTimeout:= ,
eComMode:=eAdsComModeFastCom ,
bBusy=> ,
bError=> ,
nErrorId=> );


(*Error*)
fb_CheckWatchdog(
bEnable:= TRUE,
tWatchdogTime:= T#900ms,
nCnt:= iWatchdog ,
bWatchdog=> ,
nLastCnt=> );

bError:= fb_Read.bError OR fb_CheckWatchdog.bWatchdog;
tErrorPresent(CLK:=bError);

IF (fb_Read.bError OR fb_CheckWatchdog.bWatchdog) THEN
bBool := FALSE; // If there is an error in connection the signal turns to FALSE
END_IF;

(*Logger*)
ACT_Logger();
]]></ST>
</Implementation>
<Action Name="ACT_Logger" Id="{892f0adb-5f59-480d-b09f-897dbf477c82}">
<Implementation>
<ST><![CDATA[IF tErrorPresent.Q THEN
IF(fb_Read.bError) THEN fbLogger(sMsg:='ADS Read Error', eSevr:=TcEventSeverity.Critical); END_IF;
IF(fb_CheckWatchdog.bWatchdog) THEN fbLogger(sMsg:='ADS Watchdog Error', eSevr:=TcEventSeverity.Critical); END_IF;
END_IF
]]></ST>
</Implementation>
</Action>
</POU>
</TcPlcObject>
19 changes: 3 additions & 16 deletions L2SIVacuum/POUs/Functions/Gauges/FB_9XX.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ VAR
fbGaugeState : FB_PressureState;
rMaxPressure : REAL := 760; //Torr
rMinPressure : REAL := 1E-5; //Torr
rVMin : REAL:= 0.9;
(*Default set point 50 mT*)
rVAC_SP: REAL := 5E-2;
iTermBits: UINT := 30518 ; // The terminal's maximum value in bits default el3174 as per vacuum architecture
Expand All @@ -38,8 +39,8 @@ END_IF
If (iTermBits=0) THEN iTermBits := 30518;END_IF
rV := 10*INT_TO_REAL(PG.i_iPRESS_R)/iTermBits;

IF rV >= 0.99 THEN
IF rV >= 0.99 AND rV <= 1 THEN
IF rV >=rVMin THEN
IF rV >= rVMin AND rV <= 1 THEN
PG.rPRESS := 1E-5;
ELSE
PG.rPRESS := LREAL_TO_REAL(EXPT(10, rV-6));
Expand Down Expand Up @@ -105,19 +106,5 @@ END_VAR
<ST><![CDATA[This^.iTermBits := TermBits;]]></ST>
</Implementation>
</Method>
<LineIds Name="FB_9XX">
<LineId Id="3" Count="32" />
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_9XX.ACT_IO">
<LineId Id="1" Count="0" />
</LineIds>
<LineIds Name="FB_9XX.ACT_Logger">
<LineId Id="7" Count="22" />
<LineId Id="1" Count="0" />
</LineIds>
<LineIds Name="FB_9XX.M_SetBits">
<LineId Id="2" Count="0" />
</LineIds>
</POU>
</TcPlcObject>
76 changes: 76 additions & 0 deletions L2SIVacuum/POUs/Functions/Gauges/Interfaces/FB_TGPI_ADS.TcPOU
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.18">
<POU Name="FB_TGPI_ADS" Id="{784926da-1c7e-4157-a217-23bd3a2c5d2d}" SpecialFunc="None">
<Declaration><![CDATA[(* This function block is created for interface devices between different PLC*)
(* Not all the Variables in the original structure is required, just few signals *)
(* The variable values are read via ADS using the symbol name*)
FUNCTION_BLOCK FB_TGPI_ADS Extends FB_ADS
VAR_INPUT
sNetId : String; //NetID of the Destination PLC controller
nPort : uint; // port number
sVarName : string;// the variable name of the declared gauge function block.
iWatchdog:UDINT;//The watchdog variable name written to by the remote plc
END_VAR
VAR_OUTPUT
{attribute 'pytmc' := 'pv:'}
IG : ST_VG;
bError: BOOL;
END_VAR
VAR
fb_CheckWatchdog: FB_CheckWatchdog;
fb_Read_VG: FB_ReadAdsSymByName;
ftReset: F_TRIG;
xFirstPass: BOOL:= true;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[
ftReset(CLK:= fb_Read_VG.bBusy OR xFirstPass);
xFirstPass := false;
(*calling ADS read function*)

//IG.xPRESS_OK := false;

fb_Read_VG(
bRead:=ftReset.Q ,
sNetId:= sNetId,
nPort:= nPort,
sVarName:= CONCAT(sVarName,'.PG'),
nDestAddr:= ADR(IG),
nLen:= SIZEOF(IG),
tTimeout:= ,
eComMode:=eAdsComModeFastCom ,
bBusy=> ,
bError=> ,
nErrorId=> );


(*Error*)
fb_CheckWatchdog(
bEnable:= TRUE,
tWatchdogTime:= T#900ms,
nCnt:= iWatchdog ,
bWatchdog=> ,
nLastCnt=> );

bError:= fb_Read_VG.bError OR fb_CheckWatchdog.bWatchdog;
tErrorPresent(CLK:=bError);

IF (fb_Read_VG.bError OR fb_CheckWatchdog.bWatchdog) THEN
IG.xPRESS_OK := FALSE;
END_IF;

(*Logger*)
ACT_Logger();]]></ST>
</Implementation>
<Action Name="ACT_Logger" Id="{7bcc19d2-8a8c-4c0c-850c-ad26eee2984d}">
<Implementation>
<ST><![CDATA[IF tErrorPresent.Q THEN
IF(fb_Read_VG.bError) THEN fbLogger(sMsg:='ADS Read Error', eSevr:=TcEventSeverity.Critical); END_IF;
IF(fb_CheckWatchdog.bWatchdog) THEN fbLogger(sMsg:='ADS Watchdog Error', eSevr:=TcEventSeverity.Critical); END_IF;
END_IF
]]></ST>
</Implementation>
</Action>
</POU>
</TcPlcObject>
65 changes: 65 additions & 0 deletions L2SIVacuum/POUs/Functions/Valves/Interfaces/FB_TVGC_2S_ADS.TcPOU
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.4022.18">
<POU Name="FB_TVGC_2S_ADS" Id="{2d33fb71-254e-4ee8-8b31-f9715402f769}" SpecialFunc="None">
<Declaration><![CDATA[(* This function block is created for interface devices between different PLC*)
(* Not all the fields in the original structure is required, just few signals *)
(*Use with FB_ADS_WATCHDOG on remotePLC*)
FUNCTION_BLOCK FB_TVGC_2S_ADS extends FB_ADS
VAR_INPUT
sNetId : String; //NetID of the Destination PLC controller
nPort : UINT; // port number
sVarName : string;// the variable name of the (device) declared function block.
iWatchdog:UDINT;//The watchdog variable name written to by the remote plc
END_VAR
VAR_OUTPUT
{attribute 'pytmc' := 'pv: '}
VGC:ST_VGC_2S;
bError:BOOL;
END_VAR
VAR
fb_CheckWatchdog: FB_CheckWatchdog;
fb_Read_VGC: FB_ReadAdsSymByName;
ftReset: F_TRIG;
xFirstPass: bool:= true;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[ftReset(CLK:= fb_Read_VGC.bBusy OR xFirstPass);
xFirstPass:=false;
(*calling ADS read function*)
fb_Read_VGC(
bRead:= ftReset.Q,
sNetId:= sNetId,
nPort:= nPort,
sVarName:= CONCAT(sVarName,'.iq_stValve'),
nDestAddr:= ADR(VGC),
nLen:= SIZEOF(VGC),
tTimeout:= ,
eComMode:= eAdsComModeFastCom,
bBusy=> ,
bError=> ,
nErrorId=> );


(*Error*)
fb_CheckWatchdog(
bEnable:= TRUE,
tWatchdogTime:= T#900ms,
nCnt:= iWatchdog ,
bWatchdog=> ,
nLastCnt=> );
bError:= fb_Read_VGC.bError OR fb_CheckWatchdog.bWatchdog;

ACT_Logger();]]></ST>
</Implementation>
<Action Name="ACT_Logger" Id="{4dcca01b-a24b-4b1b-865e-ad4d9c835d32}">
<Implementation>
<ST><![CDATA[IF tErrorPresent.Q THEN
IF(fb_Read_VGC.bError) THEN fbLogger(sMsg:='ADS Read Error', eSevr:=TcEventSeverity.Critical); END_IF;
IF(fb_CheckWatchdog.bWatchdog) THEN fbLogger(sMsg:='ADS Watchdog Error', eSevr:=TcEventSeverity.Critical); END_IF;
END_IF
]]></ST>
</Implementation>
</Action>
</POU>
</TcPlcObject>