Skip to content

Commit

Permalink
ENH: init mr1k1 states
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwslac committed Sep 24, 2024
1 parent 7137e74 commit fbb81cb
Show file tree
Hide file tree
Showing 6 changed files with 1,029 additions and 24 deletions.
146 changes: 145 additions & 1 deletion lcls-plc-rixs-optics/_Config/PLC/rixs_optics.xti
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ External Setpoint Generation:
</DataType>
</DataTypes>
<Project GUID="{85BF455D-934D-415A-B04C-6D4CDD9FF10E}" Name="rixs_optics" PrjFilePath="..\..\rixs_optics\rixs_optics.plcproj" TmcFilePath="..\..\rixs_optics\rixs_optics.tmc" ReloadTmc="true" AmsPort="851" FileArchiveSettings="#x000e" SymbolicMapping="true">
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="rixs_optics\rixs_optics.tmc" TmcHash="{6F7A53A0-C2D9-A16A-9BED-F44FF998AD64}">
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="rixs_optics\rixs_optics.tmc" TmcHash="{C148670C-B896-ACAA-DBAC-169C1BF0BF81}">
<Name>rixs_optics Instance</Name>
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
<Vars VarGrpType="1">
Expand Down Expand Up @@ -3708,6 +3708,123 @@ Emergency Stop for MR1K1]]></Comment>
<Name>Main.sio_load</Name>
<Type>UINT</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].Axis.NcToPlc</Name>
<Type GUID="{25521FAA-EA5F-4C7F-8864-BBCCDACD2E98}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].bLimitForwardEnable</Name>
<Comment><![CDATA[ NC Forward Limit Switch: TRUE if ok to move]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].bLimitBackwardEnable</Name>
<Comment><![CDATA[ NC Backward Limit Switch: TRUE if ok to move]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].bHome</Name>
<Comment><![CDATA[ NO Home Switch: TRUE if at home]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].bHardwareEnable</Name>
<Comment><![CDATA[ NC STO Input: TRUE if ok to move]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].nRawEncoderULINT</Name>
<Comment><![CDATA[ Raw encoder IO for ULINT (Biss-C)]]></Comment>
<Type>ULINT</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].nRawEncoderUINT</Name>
<Comment><![CDATA[ Raw encoder IO for UINT (Relative Encoders)]]></Comment>
<Type>UINT</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].nRawEncoderINT</Name>
<Comment><![CDATA[ Raw encoder IO for INT (LVDT)]]></Comment>
<Type>INT</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].Axis.NcToPlc</Name>
<Type GUID="{25521FAA-EA5F-4C7F-8864-BBCCDACD2E98}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].bLimitForwardEnable</Name>
<Comment><![CDATA[ NC Forward Limit Switch: TRUE if ok to move]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].bLimitBackwardEnable</Name>
<Comment><![CDATA[ NC Backward Limit Switch: TRUE if ok to move]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].bHome</Name>
<Comment><![CDATA[ NO Home Switch: TRUE if at home]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].bHardwareEnable</Name>
<Comment><![CDATA[ NC STO Input: TRUE if ok to move]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].nRawEncoderULINT</Name>
<Comment><![CDATA[ Raw encoder IO for ULINT (Biss-C)]]></Comment>
<Type>ULINT</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].nRawEncoderUINT</Name>
<Comment><![CDATA[ Raw encoder IO for UINT (Relative Encoders)]]></Comment>
<Type>UINT</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].nRawEncoderINT</Name>
<Comment><![CDATA[ Raw encoder IO for INT (LVDT)]]></Comment>
<Type>INT</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].Axis.NcToPlc</Name>
<Type GUID="{25521FAA-EA5F-4C7F-8864-BBCCDACD2E98}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].bLimitForwardEnable</Name>
<Comment><![CDATA[ NC Forward Limit Switch: TRUE if ok to move]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].bLimitBackwardEnable</Name>
<Comment><![CDATA[ NC Backward Limit Switch: TRUE if ok to move]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].bHome</Name>
<Comment><![CDATA[ NO Home Switch: TRUE if at home]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].bHardwareEnable</Name>
<Comment><![CDATA[ NC STO Input: TRUE if ok to move]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].nRawEncoderULINT</Name>
<Comment><![CDATA[ Raw encoder IO for ULINT (Biss-C)]]></Comment>
<Type>ULINT</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].nRawEncoderUINT</Name>
<Comment><![CDATA[ Raw encoder IO for UINT (Relative Encoders)]]></Comment>
<Type>UINT</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].nRawEncoderINT</Name>
<Comment><![CDATA[ Raw encoder IO for INT (LVDT)]]></Comment>
<Type>INT</Type>
</Var>
<Var>
<Name>PRG_MR1K2_SWITCH.fbCoatingStates.astMotionStageMax[1].Axis.NcToPlc</Name>
<Type GUID="{25521FAA-EA5F-4C7F-8864-BBCCDACD2E98}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
Expand Down Expand Up @@ -4501,6 +4618,33 @@ Emergency Stop for MR1K1]]></Comment>
<Name>Main.fbMotionStageM37.fbDriveVirtual.MasterAxis.PlcToNc</Name>
<Type GUID="{96B75FEB-2D84-43BE-A3EC-D9A681F27D52}" Namespace="MC">PLCTONC_AXIS_REF</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].Axis.PlcToNc</Name>
<Type GUID="{96B75FEB-2D84-43BE-A3EC-D9A681F27D52}" Namespace="MC">PLCTONC_AXIS_REF</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[1].bBrakeRelease</Name>
<Comment><![CDATA[ NC Brake Output: TRUE to release brake]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].Axis.PlcToNc</Name>
<Type GUID="{96B75FEB-2D84-43BE-A3EC-D9A681F27D52}" Namespace="MC">PLCTONC_AXIS_REF</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[2].bBrakeRelease</Name>
<Comment><![CDATA[ NC Brake Output: TRUE to release brake]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].Axis.PlcToNc</Name>
<Type GUID="{96B75FEB-2D84-43BE-A3EC-D9A681F27D52}" Namespace="MC">PLCTONC_AXIS_REF</Type>
</Var>
<Var>
<Name>PRG_MR1K1_BEND.fbCoatingStates.astMotionStageMax[3].bBrakeRelease</Name>
<Comment><![CDATA[ NC Brake Output: TRUE to release brake]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>PRG_MR1K2_SWITCH.fbCoatingStates.astMotionStageMax[1].Axis.PlcToNc</Name>
<Type GUID="{96B75FEB-2D84-43BE-A3EC-D9A681F27D52}" Namespace="MC">PLCTONC_AXIS_REF</Type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ TYPE E_B4C_Rh_CoatingStates :
(
Unknown := 0,
B4C := 1,
Rh := 2,
OUT := 3
Rh := 2
) UINT;
END_TYPE
]]></Declaration>
Expand Down
16 changes: 16 additions & 0 deletions lcls-plc-rixs-optics/rixs_optics/DUTs/E_MR1K1_States.TcDUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="E_MR1K1_States" Id="{b25f2d1e-112c-4694-92cb-fe3da2835bd9}">
<Declaration><![CDATA[{attribute 'qualified_only'}
{attribute 'strict'}
TYPE E_MR1K1_States :
(
Unknown := 0,
B4C := 1,
OUT := 2
) UINT;
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>
24 changes: 11 additions & 13 deletions lcls-plc-rixs-optics/rixs_optics/POUs/PRG_MR1K1_BEND.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -185,27 +185,25 @@ VAR
io: i
'}
fM1K1_Press_1_val : LREAL;
(*
{attribute 'pytmc' := 'pv: MR1K1:BEND:COATING'}
fbCoatingStates: FB_PositionStatePMPS2D;
{attribute 'pytmc' := '
pv: MR1K1:BEND:COATING:STATE:SET
io: io
'}
eStateSet: E_B4C_Rh_CoatingStates;
eStateSet: E_MR1K1_States;
{attribute 'pytmc' := '
pv: MR1K1:BEND:COATING:STATE:GET
io: i
'}
eStateGet: E_B4C_Rh_CoatingStates;
eStateGet: E_MR1K1_States;
fbYSetup: FB_StateSetupHelper;
fbXSetup: FB_StateSetupHelper;
astCoatingStatesY: ARRAY[1..GeneralConstants.MAX_STATES] OF ST_PositionState;
astCoatingStatesX: ARRAY[1..GeneralConstants.MAX_STATES] OF ST_PositionState;
*)
END_VAR
]]></Declaration>
<Implementation>
Expand Down Expand Up @@ -306,27 +304,27 @@ nEncRefPitchM1K1 := LREAL_TO_UDINT(ABS(fEncRefPitchM1K1_urad) * fEncLeverArm_mm)
fM1K1_Press_1(iTermBits:=15, fTermMax:=4.0, fTermMin:=0);
fM1K1_Press_1_val := fM1K1_Press_1.fReal;
(*
fbYSetup(stPositionState:=GVL_States.stDefaultOffsetY, bSetDefault:=TRUE);
fbXSetup(stPositionState:=GVL_States.stDefaultOffsetX, bSetDefault:=TRUE);
fbYSetup(stPositionState:=astCoatingStatesY[E_B4C_Rh_CoatingStates.B4C],
fbYSetup(stPositionState:=astCoatingStatesY[E_MR1K1_States.B4C],
sName:='B4C',
sPmpsState:='MR1K1:BEND-B4C',
nEncoderCount:=
nEncoderCount:=31911452
);
fbXSetup(stPositionState:=astCoatingStatesX[E_B4C_Rh_CoatingStates.B4C],
fbXSetup(stPositionState:=astCoatingStatesX[E_MR1K1_States.B4C],
sName:='B4C',
sPmpsState:='MR1K1:BEND-B4C',
nEncoderCount:=19829700
nEncoderCount:=19829647
);
fbYSetup(stPositionState:=astCoatingStatesY[E_B4C_Rh_CoatingStates.OUT],
fbYSetup(stPositionState:=astCoatingStatesY[E_MR1K1_States.OUT],
sName:='OUT',
sPmpsState:='MR1K1:BEND-OUT',
nEncoderCount:=13412630
);
// Out position determined soley by X Axis
fbXSetup(stPositionState:=astCoatingStatesX[E_B4C_Rh_CoatingStates.OUT],
fbXSetup(stPositionState:=astCoatingStatesX[E_MR1K1_States.OUT],
sName:='OUT',
sPmpsState:='MR1K1:BEND-OUT',
nEncoderCount:=ULINT_TO_UDINT(M14.nRawEncoderULINT)
Expand All @@ -345,7 +343,7 @@ fbCoatingStates(
sDeviceName:='MR1K1:BEND',
sTransitionKey:='MR1K1:BEND-TRANSITION',
);
*)]]></ST>
]]></ST>
</Implementation>
</POU>
</TcPlcObject>
3 changes: 3 additions & 0 deletions lcls-plc-rixs-optics/rixs_optics/rixs_optics.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
<Compile Include="DUTs\E_B4C_Rh_CoatingStates.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="DUTs\E_MR1K1_States.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="DUTs\E_Grating_States.TcDUT">
<SubType>Code</SubType>
</Compile>
Expand Down
Loading

0 comments on commit fbb81cb

Please sign in to comment.