Skip to content

Commit

Permalink
ENH: move mirror stats to stats task and comment it out
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwslac committed Feb 2, 2024
1 parent c228907 commit 8f4e474
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 148 deletions.
12 changes: 6 additions & 6 deletions 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="{916A7B6C-B4EB-3A58-E441-28321EF7D007}">
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="rixs_optics\rixs_optics.tmc" TmcHash="{AF746F3C-18E1-BB13-C597-9DE0DD4AE3BE}">
<Name>rixs_optics Instance</Name>
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
<Vars VarGrpType="1">
Expand All @@ -1370,6 +1370,10 @@ External Setpoint Generation:
</Vars>
<Vars VarGrpType="1" ContextId="1" AreaNo="16">
<Name>StatsTask Inputs</Name>
<Var>
<Name>Main.M6.Axis.NcToPlc</Name>
<Type GUID="{25521FAA-EA5F-4C7F-8864-BBCCDACD2E98}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
</Var>
<Var>
<Name>Main.M7.Axis.NcToPlc</Name>
<Type GUID="{25521FAA-EA5F-4C7F-8864-BBCCDACD2E98}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
Expand Down Expand Up @@ -2320,10 +2324,6 @@ Emergency Stop for MR1K1]]></Comment>
<Comment><![CDATA[ Raw encoder IO for INT (LVDT)]]></Comment>
<Type>INT</Type>
</Var>
<Var>
<Name>Main.M6.Axis.NcToPlc</Name>
<Type GUID="{25521FAA-EA5F-4C7F-8864-BBCCDACD2E98}" Namespace="MC">NCTOPLC_AXIS_REF</Type>
</Var>
<Var>
<Name>Main.M6.bLimitForwardEnable</Name>
<Comment><![CDATA[ NC Forward Limit Switch: TRUE if ok to move]]></Comment>
Expand Down Expand Up @@ -4957,8 +4957,8 @@ Emergency Stop for MR1K1]]></Comment>
<Link VarA="PlcTask Outputs^Main.M8.Axis.PlcToNc" VarB="Inputs^FromPlc"/>
</OwnerB>
<OwnerB Name="TINC^NC-Task 1 SAF^Axes^m_pi">
<Link VarA="PlcTask Inputs^Main.M6.Axis.NcToPlc" VarB="Outputs^ToPlc"/>
<Link VarA="PlcTask Outputs^Main.M6.Axis.PlcToNc" VarB="Inputs^FromPlc"/>
<Link VarA="StatsTask Inputs^Main.M6.Axis.NcToPlc" VarB="Outputs^ToPlc"/>
</OwnerB>
<OwnerB Name="TINC^NC-Task 1 SAF^Axes^s_io">
<Link VarA="PlcTask Inputs^Main.M10.Axis.NcToPlc" VarB="Outputs^ToPlc"/>
Expand Down
4 changes: 2 additions & 2 deletions lcls-plc-rixs-optics/lcls-plc-rixs-optics.tsproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
<Task Id="7" Priority="1" CycleTime="20000" AmsPort="352" AdtTasks="true">
<Name>SerialIO</Name>
</Task>
<Task Id="8" Priority="19" CycleTime="10000" AmsPort="353" Affinity="#x00000008" AdtTasks="true">
<Task Id="8" Priority="19" CycleTime="10000" AmsPort="353" Affinity="#x00000004" AdtTasks="true">
<Name>DaqTask</Name>
</Task>
<Task Id="9" Priority="2" CycleTime="20000" AmsPort="354" AdtTasks="true">
<Task Id="9" Priority="2" CycleTime="20000" AmsPort="354" Affinity="#x00000008" AdtTasks="true">
<Name>StatsTask</Name>
</Task>
</Tasks>
Expand Down
26 changes: 1 addition & 25 deletions lcls-plc-rixs-optics/rixs_optics/POUs/PRG_SP1K1_MONO.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -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
]]></Declaration>
<Implementation>
Expand All @@ -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
Expand Down
27 changes: 26 additions & 1 deletion lcls-plc-rixs-optics/rixs_optics/POUs/PRG_Stats.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -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
]]></Declaration>
<Implementation>
Expand All @@ -32,7 +43,7 @@ fbGpiPosDiffCollect(
bExecute:=TRUE,
pInputAdr:=ADR(fGpiEncoderPosDiff),
iInputSize:=SIZEOF(fGpiEncoderPosDiff),
iElemCount:=1000,
iElemCount:=10000,
pPartialAdr:=ADR(afGpiPosDiffBuffer),
pOutputAdr:=ADR(afGpiExtraBuffer),
);
Expand All @@ -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,
);*)
]]></ST>
</Implementation>
</POU>
Expand Down
Loading

0 comments on commit 8f4e474

Please sign in to comment.