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

FIX: All Motors fPosition to stAxisStatus.fActPosition #106

Merged
merged 4 commits into from
Nov 3, 2023
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
100 changes: 50 additions & 50 deletions lcls-plc-rixs-optics/_Config/PLC/rixs_optics.xti
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,24 @@
</SubItem>
</DataType>
<DataType>
<Name GUID="{DAE06558-BF28-4CCF-B9B3-66AEA51A8DEB}" Namespace="lcls_twincat_motion" AutoDeleteType="true">EL5042_Status</Name>
<Name GUID="{BD27D20D-BDD2-4BB8-8658-AB2FB492629A}" Namespace="lcls_twincat_motion" AutoDeleteType="true">EL5042_Status</Name>
<BitSize>0</BitSize>
<BaseType GUID="{FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}"/>
<Hides>
<Hide GUID="{B9C54B21-341C-4BA8-ABA0-BA81C6D823FD}"/>
<Hide GUID="{3AB19797-F134-46A4-913F-427383F8D393}"/>
</Hides>
</DataType>
<DataType>
<Name GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion" AutoDeleteType="true">ST_RenishawAbsEnc</Name>
<Name GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion" AutoDeleteType="true">ST_RenishawAbsEnc</Name>
<Comment>
<![CDATA[Renishaw BiSS-C absolute encoder used with an EL5042]]>
<![CDATA[ Renishaw BiSS-C absolute encoder used with an EL5042]]>
</Comment>
<BitSize>128</BitSize>
<SubItem>
<Name>Count</Name>
<Type GUID="{18071995-0000-0000-0000-00000000000B}">ULINT</Type>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
<BitSize>64</BitSize>
<BitOffs>0</BitOffs>
Expand All @@ -88,9 +88,9 @@
</SubItem>
<SubItem>
<Name>Status</Name>
<Type GUID="{DAE06558-BF28-4CCF-B9B3-66AEA51A8DEB}" Namespace="lcls_twincat_motion">EL5042_Status</Type>
<Type GUID="{BD27D20D-BDD2-4BB8-8658-AB2FB492629A}" Namespace="lcls_twincat_motion">EL5042_Status</Type>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
<BitSize>0</BitSize>
<BitOffs>64</BitOffs>
Expand All @@ -99,13 +99,13 @@
<Name>Ref</Name>
<Type GUID="{18071995-0000-0000-0000-00000000000B}">ULINT</Type>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
<BitSize>64</BitSize>
<BitOffs>64</BitOffs>
</SubItem>
<Hides>
<Hide GUID="{7F3F9A5F-5BE5-4CDD-8BF9-E212F3AFAB8C}"/>
<Hide GUID="{AE86CE9C-32E3-4311-9535-05836A2EF921}"/>
</Hides>
</DataType>
<DataType>
Expand Down Expand Up @@ -1352,89 +1352,89 @@ External Setpoint Generation:
<Comment>
<![CDATA[ Encoders]]>
</Comment>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.M1K1.fbRunHOMS.stYdwnEnc</Name>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.M1K1.fbRunHOMS.stXupEnc</Name>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.M1K1.fbRunHOMS.stXdwnEnc</Name>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
Expand Down Expand Up @@ -1648,89 +1648,89 @@ Emergency Stop for MR1K1]]>
<Comment>
<![CDATA[ Encoders]]>
</Comment>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
<Var>
<Name>PRG_MR1K2_SWITCH.M1K2.fbRunHOMS.stYdwnEnc</Name>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
<Var>
<Name>PRG_MR1K2_SWITCH.M1K2.fbRunHOMS.stXupEnc</Name>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
<Var>
<Name>PRG_MR1K2_SWITCH.M1K2.fbRunHOMS.stXdwnEnc</Name>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
Expand Down Expand Up @@ -2188,45 +2188,45 @@ External Setpoint Generation:
</Var>
<Var>
<Name>PRG_SP1K1_MONO.mpi_upe</Name>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
<Var>
<Name>PRG_SP1K1_MONO.gpi_upe</Name>
<Type GUID="{A1AF2E54-2B60-4775-BA9B-752B7A7C2594}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<Type GUID="{5E29AE2A-E129-4EA6-90AA-AE78934509B8}" Namespace="lcls_twincat_motion">ST_RenishawAbsEnc</Type>
<SubVar>
<Name>Count</Name>
<Comment>
<![CDATA[Connect to encoder "Position" input]]>
<![CDATA[ Connect to encoder "Position" input]]>
</Comment>
</SubVar>
<SubVar>
<Name>Status</Name>
<Comment>
<![CDATA[Status struct placeholder]]>
<![CDATA[ Status struct placeholder]]>
</Comment>
</SubVar>
<SubVar>
<Name>Ref</Name>
<Comment>
<![CDATA[Encoder zero position (useful for aligned position with gantries)]]>
<![CDATA[ Encoder zero position (useful for aligned position with gantries)]]>
</Comment>
</SubVar>
</Var>
Expand Down Expand Up @@ -8718,8 +8718,8 @@ External Setpoint Generation:
<TaskPouOids>
<TaskPouOid Prio="19" OTCID="#x08502004"/>
<TaskPouOid Prio="1" OTCID="#x08502001"/>
<TaskPouOid Prio="3" OTCID="#x08502002"/>
<TaskPouOid Prio="20" OTCID="#x08502003"/>
<TaskPouOid Prio="3" OTCID="#x08502002"/>
</TaskPouOids>
</Instance>
</Project>
Expand Down
20 changes: 10 additions & 10 deletions lcls-plc-rixs-optics/rixs_optics/POUs/PRG_ZeroOrder_PMPS.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
Theta_m1: LREAL;
Theta_m2: LREAL;
Theta_m3: LREAL;
{attribute 'pytmc' := '

Check warning on line 84 in lcls-plc-rixs-optics/rixs_optics/POUs/PRG_ZeroOrder_PMPS.TcPOU

View workflow job for this annotation

GitHub Actions / standard / Style check / Leading tabs

Leading tabs
pv: @(PREFIX)Delta
field: ZNAM FALSE
field: ONAM TRUE
Expand Down Expand Up @@ -141,19 +141,19 @@
<Implementation>
<ST><![CDATA[///calc
//Hm1 = 1400000+mr1k1 ben Y up
Hm1:= 1400000+M12.fPosition; //um
Hm1:= 1400000+M12.stAxisStatus.fActPosition; //um
//Pm1 = Pm1Offset + mr1k1 bend pitch
Pm1 := Pm1Offset + Main.M16.fPosition; //urad
Pm1 := Pm1Offset + Main.M16.stAxisStatus.fActPosition; //urad
//Hpiv = 1.620305 + 0.001 // m 0.001 is correction from nominal
Hpiv:= (1.620305 + 0.001)*1E6; //um
//Pm2 = mono mirror pitch + Pm2Offset urad
Pm2 := Main.M6.fPosition + Pm2Offset;//urad
Pm2 := Main.M6.stAxisStatus.fActPosition + Pm2Offset;//urad
//Hm3 = Hpiv + 0.006 m
Hm3:= Hpiv + (0.006*1E6); //um
//Pm3 = mono grating pitch + Pm3Offset urad
Pm3 := Main.M7.fPosition + Pm3Offset; //urad
Pm3 := Main.M7.stAxisStatus.fActPosition + Pm3Offset; //urad
//Hzos = 1824.3 + st1k1_zos mm
Hzos:= 1824.3 + M24.fPosition; //mm
Hzos:= 1824.3 + M24.stAxisStatus.fActPosition; //mm


//urad
Expand All @@ -179,21 +179,21 @@
<Action Name="ACT_ExitSlitsGap" Id="{72615217-f71d-41ee-b0dd-e3c54f411832}">
<Implementation>
<ST><![CDATA[// FAULT condition: Hzos -1.0mm <= Hb0m3) AND sl1k2 gap <= 8.0
ffZeroOrderBeamExitSlits.i_xOK := NOT( (( (Hzos*1E3) - 1) <= Hb0m3) AND ( M22.fPosition <= 8.0));
ffZeroOrderBeamExitSlits.i_xOK := NOT( (( (Hzos*1E3) - 1) <= Hb0m3) AND ( M22.stAxisStatus.fActPosition <= 8.0));
ffZeroOrderBeamExitSlits(io_fbFFHWO := GVL_PMPS.fbFastFaultOutput1);]]></ST>
</Implementation>
</Action>
<Action Name="ACT_LRG_Grating_IN" Id="{8babb51d-911c-461c-99fc-bb1adfccc9fe}">
<Implementation>
<ST><![CDATA[bLRG_Grating_IN := ((M9.nEncoderCount/1000) >= 36000) AND ((M9.nEncoderCount/1000) <= 43000);]]></ST>
<ST><![CDATA[bLRG_Grating_IN := ((M9.stAxisStatus.fActPosition) >= 36000) AND ((M9.stAxisStatus.fActPosition) <= 43000);]]></ST>
</Implementation>
</Action>
<Action Name="ACT_ZOS_IN" Id="{ea635b1c-413a-4430-b9a8-7a35a57ab8c1}">
<Implementation>
<ST><![CDATA[IF GVL_PMPS.rPhotonEnergy >1500 THEN bZOS_IN:= FALSE;
ELSIF (GVL_PMPS.rPhotonEnergy >1000 AND M24.fPosition>= 8.5) THEN bZOS_IN:= TRUE;
ELSIF (GVL_PMPS.rPhotonEnergy <=1000 AND GVL_PMPS.rPhotonEnergy >550 AND M24.fPosition>= 7.9) THEN bZOS_IN:= TRUE;
ELSIF (GVL_PMPS.rPhotonEnergy <=550 AND GVL_PMPS.rPhotonEnergy >200 AND M24.fPosition>= 6.9) THEN bZOS_IN:= TRUE;
ELSIF (GVL_PMPS.rPhotonEnergy >1000 AND M24.stAxisStatus.fActPosition>= 8.5) THEN bZOS_IN:= TRUE;
ELSIF (GVL_PMPS.rPhotonEnergy <=1000 AND GVL_PMPS.rPhotonEnergy >550 AND M24.stAxisStatus.fActPosition>= 7.9) THEN bZOS_IN:= TRUE;
ELSIF (GVL_PMPS.rPhotonEnergy <=550 AND GVL_PMPS.rPhotonEnergy >200 AND M24.stAxisStatus.fActPosition>= 6.9) THEN bZOS_IN:= TRUE;
ELSE bZOS_IN:= FALSE;
END_IF

Expand Down
Loading
Loading