diff --git a/lcls-plc-rixs-optics/_Config/PLC/rixs_optics.xti b/lcls-plc-rixs-optics/_Config/PLC/rixs_optics.xti index 54caa62..c38b3a2 100644 --- a/lcls-plc-rixs-optics/_Config/PLC/rixs_optics.xti +++ b/lcls-plc-rixs-optics/_Config/PLC/rixs_optics.xti @@ -1349,7 +1349,7 @@ External Setpoint Generation: - + rixs_optics Instance {08500001-0000-0000-F000-000000000064} @@ -1370,6 +1370,10 @@ External Setpoint Generation: StatsTask Inputs + + Main.M6.Axis.NcToPlc + NCTOPLC_AXIS_REF + Main.M7.Axis.NcToPlc NCTOPLC_AXIS_REF @@ -2320,10 +2324,6 @@ Emergency Stop for MR1K1]]> INT - - Main.M6.Axis.NcToPlc - NCTOPLC_AXIS_REF - Main.M6.bLimitForwardEnable @@ -4957,8 +4957,8 @@ Emergency Stop for MR1K1]]> - + diff --git a/lcls-plc-rixs-optics/lcls-plc-rixs-optics.tsproj b/lcls-plc-rixs-optics/lcls-plc-rixs-optics.tsproj index 905729d..d51179b 100644 --- a/lcls-plc-rixs-optics/lcls-plc-rixs-optics.tsproj +++ b/lcls-plc-rixs-optics/lcls-plc-rixs-optics.tsproj @@ -31,10 +31,10 @@ SerialIO - + DaqTask - + StatsTask diff --git a/lcls-plc-rixs-optics/rixs_optics/POUs/PRG_SP1K1_MONO.TcPOU b/lcls-plc-rixs-optics/rixs_optics/POUs/PRG_SP1K1_MONO.TcPOU index 9979375..d7d933a 100644 --- a/lcls-plc-rixs-optics/rixs_optics/POUs/PRG_SP1K1_MONO.TcPOU +++ b/lcls-plc-rixs-optics/rixs_optics/POUs/PRG_SP1K1_MONO.TcPOU @@ -192,18 +192,6 @@ VAR '} fSP1K1_Press_1_val : LREAL; - - - - // SP1K1 Mirror Pitch Mono Vibration Stats - fMpiEncoderPosDiff: LREAL; - afMpiPosDiffBuffer: ARRAY[1..1000] OF LREAL; - afMpiExtraBuffer: ARRAY[1..1000] OF LREAL; - fbMpiPosDiffCollect: FB_DataBuffer; - {attribute 'pytmc' := ' - pv: SP1K1:MONO:MMS:M_PI:ENCDIFF - '} - fbMpiPosDiffStats: FB_BasicStats; END_VAR ]]> @@ -223,19 +211,7 @@ fbMotionStage_s_io (stMotionStage:=M10); fbMotionStage_s_r (stMotionStage:=M11); -fMpiEncoderPosDiff := M6.nEncoderCount - (M6.Axis.NcToPlc.SetPos - M6.stAxisParameters.fEncOffset) / 0.004505; -fbMpiPosDiffCollect( - bExecute:=TRUE, - pInputAdr:=ADR(fMpiEncoderPosDiff), - iInputSize:=SIZEOF(fMpiEncoderPosDiff), - iElemCount:=1000, - pPartialAdr:=ADR(afMpiPosDiffBuffer), - pOutputAdr:=ADR(afMpiExtraBuffer), -); -fbMpiPosDiffStats( - aSignal:=afMpiPosDiffBuffer, - bAlwaysCalc:=TRUE, -); + //S_R with no hardware limit switched diff --git a/lcls-plc-rixs-optics/rixs_optics/POUs/PRG_Stats.TcPOU b/lcls-plc-rixs-optics/rixs_optics/POUs/PRG_Stats.TcPOU index 657712f..580ba3b 100644 --- a/lcls-plc-rixs-optics/rixs_optics/POUs/PRG_Stats.TcPOU +++ b/lcls-plc-rixs-optics/rixs_optics/POUs/PRG_Stats.TcPOU @@ -16,6 +16,17 @@ VAR fGpiRangeMax: LREAL; rtNewGpiMove: R_TRIG; tonNewGpiMove: TON; + + + // SP1K1 Mirror Pitch Mono Vibration Stats + fMpiEncoderPosDiff: LREAL; + afMpiPosDiffBuffer: ARRAY[1..10000] OF LREAL; + afMpiExtraBuffer: ARRAY[1..10000] OF LREAL; + fbMpiPosDiffCollect: FB_DataBuffer; + {attribute 'pytmc' := ' + pv: SP1K1:MONO:MMS:M_PI:ENCDIFF + '} + fbMpiPosDiffStats: FB_BasicStats; END_VAR ]]> @@ -32,7 +43,7 @@ fbGpiPosDiffCollect( bExecute:=TRUE, pInputAdr:=ADR(fGpiEncoderPosDiff), iInputSize:=SIZEOF(fGpiEncoderPosDiff), - iElemCount:=1000, + iElemCount:=10000, pPartialAdr:=ADR(afGpiPosDiffBuffer), pOutputAdr:=ADR(afGpiExtraBuffer), ); @@ -45,6 +56,20 @@ tonNewGpiMove( IN:=M7.bExecute, PT:=T#15s, ); + +(*fMpiEncoderPosDiff := M6.nEncoderCount - (M6.Axis.NcToPlc.SetPos - M6.stAxisParameters.fEncOffset) / 0.004505; +fbMpiPosDiffCollect( + bExecute:=TRUE, + pInputAdr:=ADR(fMpiEncoderPosDiff), + iInputSize:=SIZEOF(fMpiEncoderPosDiff), + iElemCount:=1000, + pPartialAdr:=ADR(afMpiPosDiffBuffer), + pOutputAdr:=ADR(afMpiExtraBuffer), +); +fbMpiPosDiffStats( + aSignal:=afMpiPosDiffBuffer, + bAlwaysCalc:=TRUE, +);*) ]]> diff --git a/lcls-plc-rixs-optics/rixs_optics/rixs_optics.tmc b/lcls-plc-rixs-optics/rixs_optics/rixs_optics.tmc index eb6499a..b310694 100644 --- a/lcls-plc-rixs-optics/rixs_optics/rixs_optics.tmc +++ b/lcls-plc-rixs-optics/rixs_optics/rixs_optics.tmc @@ -1,5 +1,5 @@ - + ComSerialLineMode_t @@ -72326,7 +72326,7 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 0 SerialIO Inputs 0 - 164233216 + 164364288 GVL_SerialIO.Serial_stComIn_M1K2 Better have your inputs and outputs! @@ -72349,7 +72349,7 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 1 SerialIO Outputs 0 - 164233216 + 164364288 GVL_SerialIO.Serial_stComOut_M1K2 192 @@ -72370,7 +72370,7 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 3 SerialIO Internal 0 - 164233216 + 164364288 P_Serial_Com.fbSerialLineControl_EL6001_M1K2 10752 @@ -72468,7 +72468,19 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 16 StatsTask Inputs 1 - 164233216 + 164364288 + + Main.M6.Axis.NcToPlc + 2048 + NCTOPLC_AXIS_REF + + + TcAddressType + Input + + + 1295891392 + Main.M7.Axis.NcToPlc 2048 @@ -72486,7 +72498,7 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 19 StatsTask Internal 1 - 164233216 + 164364288 PRG_Stats.fGpiEncoderPosDiff SP1K1 Grating Mono Vibration Stats @@ -72532,6 +72544,44 @@ The BPTM will throw an error if the arbiter does not have enough space for the t TON 1271777536 + + Main.M6 + M_PI, urad + 21184 + DUT_MotionStage + + + .nEnableMode + ENUM_StageEnableMode.ALWAYS + + + .fVelocity + 200 + + + .bPowerSelf + true + + + + + pytmc + + pv: SP1K1:MONO:MMS:M_PI + + + + TcLinkTo + .bLimitForwardEnable:=TIIB[m_pi_m]^STM Status^Status^Digital input 1; + .bLimitBackwardEnable:=TIIB[m_pi_m]^STM Status^Status^Digital input 2; + .nRawEncoderULINT:=TIIB[m_pi_up_dwn_e]^FB Inputs Channel 2^Position + + + TcVarGlobal + + + 1295890304 + Main.M7 G_PI, urad @@ -72627,7 +72677,7 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 1 10000 - 1311032128 + 1310820160 PRG_Stats.afGpiExtraBuffer @@ -72637,14 +72687,14 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 1 10000 - 1311672128 + 1311460160 35 PiezoDriver Internal 2 - 164233216 + 164364288 PiezoSerial.fbE621SerialDriver_M1K2 PI Serial @@ -72741,7 +72791,7 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 48 DaqTask Inputs 3 - 164233216 + 164364288 PRG_DAQ_ENCODER.iLatchPos Inputs @@ -72796,7 +72846,7 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 51 DaqTask Internal 3 - 164233216 + 164364288 GVL_Logger.sIpTidbit 56 @@ -73273,7 +73323,7 @@ The BPTM will throw an error if the arbiter does not have enough space for the t 64 PlcTask Inputs 4 - 164233216 + 164364288 lcls_twincat_optics.GVL_TestStructs.TestPitch_LimitSwitches.diEncCnt Raw encoder count @@ -76476,18 +76526,6 @@ Emergency Stop for MR1K1 1295878288 - - Main.M6.Axis.NcToPlc - 2048 - NCTOPLC_AXIS_REF - - - TcAddressType - Input - - - 1295891392 - Main.M6.bLimitForwardEnable NC Forward Limit Switch: TRUE if ok to move @@ -81288,7 +81326,7 @@ Emergency Stop for MR1K1 65 PlcTask Outputs 4 - 164233216 + 164364288 PRG_MR1K1_BEND.fbM1K1PitchControl.fbMotionStage.fbDriveVirtual.MasterAxis.PlcToNc 1024 @@ -83400,7 +83438,7 @@ Emergency Stop for MR1K1 67 PlcTask Internal 4 - 164233216 + 164364288 DefaultGlobals.stSys Included for you @@ -90518,6 +90556,33 @@ Emergency Stop for MR1K1 FB_LogHandler 1265833152 + + PRG_Stats.fMpiEncoderPosDiff + SP1K1 Mirror Pitch Mono Vibration Stats + 64 + LREAL + 1271647744 + + + PRG_Stats.fbMpiPosDiffCollect + 448 + FB_DataBuffer + 1271711808 + + + PRG_Stats.fbMpiPosDiffStats + 1152 + FB_BasicStats + + + pytmc + + pv: SP1K1:MONO:MMS:M_PI:ENCDIFF + + + + 1271712256 + PRG_MR1K1_BEND.M1K1 23552 @@ -91999,53 +92064,6 @@ M1K1 BEND US ENC CNT 1284218688 - - PRG_SP1K1_MONO.fMpiEncoderPosDiff - SP1K1 Mirror Pitch Mono Vibration Stats - 64 - LREAL - 1284218752 - - - PRG_SP1K1_MONO.afMpiPosDiffBuffer - 64000 - LREAL - - 1 - 1000 - - 1284218816 - - - PRG_SP1K1_MONO.afMpiExtraBuffer - 64000 - LREAL - - 1 - 1000 - - 1284282816 - - - PRG_SP1K1_MONO.fbMpiPosDiffCollect - 448 - FB_DataBuffer - 1284346816 - - - PRG_SP1K1_MONO.fbMpiPosDiffStats - 1152 - FB_BasicStats - - - pytmc - - pv: SP1K1:MONO:MMS:M_PI:ENCDIFF - - - - 1284347264 - PRG_SL1K2_EXIT.FFO 25920 @@ -94872,44 +94890,6 @@ M4K2 KBV X ENC CNT 1295869120 - - Main.M6 - M_PI, urad - 21184 - DUT_MotionStage - - - .nEnableMode - ENUM_StageEnableMode.ALWAYS - - - .fVelocity - 200 - - - .bPowerSelf - true - - - - - pytmc - - pv: SP1K1:MONO:MMS:M_PI - - - - TcLinkTo - .bLimitForwardEnable:=TIIB[m_pi_m]^STM Status^Status^Digital input 1; - .bLimitBackwardEnable:=TIIB[m_pi_m]^STM Status^Status^Digital input 2; - .nRawEncoderULINT:=TIIB[m_pi_up_dwn_e]^FB Inputs Channel 2^Position - - - TcVarGlobal - - - 1295890304 - Main.M8 M_H, um @@ -96951,12 +96931,32 @@ M4K2 KBV X ENC CNT 1302861376 + + PRG_Stats.afMpiPosDiffBuffer + 640000 + LREAL + + 1 + 10000 + + 1312312128 + + + PRG_Stats.afMpiExtraBuffer + 640000 + LREAL + + 1 + 10000 + + 1313594368 + 68 PlcTask Retains 4 - 164233216 + 164364288 PMPS_GVL.SuccessfulPreemption Any time BPTM applies a new BP request which is confirmed @@ -97036,7 +97036,7 @@ M4K2 KBV X ENC CNT ChangeDate - 2024-01-30T11:21:31 + 2024-01-30T13:39:53 GeneratedCodeSize @@ -97044,7 +97044,7 @@ M4K2 KBV X ENC CNT GlobalDataSize - 162648064 + 162791424