-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into enh_bsd_pmpsdb
- Loading branch information
Showing
10 changed files
with
1,912 additions
and
2 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
lcls-twincat-motion/Library/DUTs/ST_AxisParameterSetExposed.TcDUT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1"> | ||
<DUT Name="ST_AxisParameterSetExposed" Id="{ee296551-543a-4bbb-98b7-123ff2229439}"> | ||
<Declaration><![CDATA[TYPE ST_AxisParameterSetExposed : | ||
// Collects the axis parameters that are intentionally exposed to EPICS. | ||
STRUCT | ||
// Maximum Dynamics | ||
{attribute 'pytmc' := ' | ||
pv: MaxVel | ||
io: i | ||
field: DESC Maximum commandable speed of the axis in EU/s. | ||
'} | ||
fVeloMaximum : LREAL; // Maximum commandable speed of the axis in EU/s. | ||
{attribute 'pytmc' := ' | ||
pv: MaxAccel | ||
io: i | ||
field: DESC Maximum rate of increase in speed of the axis in EU/s^2. | ||
'} | ||
fAccelerationMax : LREAL; // Maximum rate of increase in speed of the axis in EU/s^2. | ||
{attribute 'pytmc' := ' | ||
pv: MaxDecel | ||
io: i | ||
field: DESC Maximum rate of decrease in speed of the axis in EU/s^2. | ||
'} | ||
fDecelerationMax : LREAL; // Maximum rate of decrease in speed of the axis in EU/s^2. | ||
// Monitoring | ||
{attribute 'pytmc' := ' | ||
pv: PosLagEn | ||
io: i | ||
field: DESC TRUE if position lag monitor (also known as stall monitor) is enabled. | ||
'} | ||
bCtrlEnablePosDiffControl : WORD; // Enable/Disable state of Position Lag Monitor. | ||
{attribute 'pytmc' := ' | ||
pv: PosLagVal | ||
io: i | ||
field: DESC Maximum magnitude of position lag in EU. | ||
'} | ||
fCtrlPosDiffMax : LREAL; // Maximum magnitude of position lag in EU. | ||
{attribute 'pytmc' := ' | ||
pv: PosLagTime | ||
io: i | ||
field: DESC Maximum allowable duration outside of maximum position lag value in seconds. | ||
'} | ||
fCtrlPosDiffMaxTime : LREAL; // Maximum allowable duration outside of maximum position lag value in seconds. | ||
// Limit Switches | ||
{attribute 'pytmc' := ' | ||
pv: SLimMinEn | ||
io: i | ||
field: DESC TRUE if controller static minimum limit is enabled. | ||
'} | ||
bEncEnableSoftEndMinControl : WORD; // Enable/Disable state of controller static minimum limit. | ||
{attribute 'pytmc' := ' | ||
pv: SLimMaxEn | ||
io: i | ||
field: DESC TRUE if controller static maximum limit is enabled. | ||
'} | ||
bEncEnableSoftEndMaxControl : WORD; // Enable/Disable state of controller static maximum limit. | ||
{attribute 'pytmc' := ' | ||
pv: SLimMin | ||
io: i | ||
field: DESC Minimum commandable position of the axis in EU. | ||
'} | ||
fEncSoftEndMin : LREAL; // Minimum commandable position of the axis in EU. | ||
{attribute 'pytmc' := ' | ||
pv: SLimMax | ||
io: i | ||
field: DESC Maximum commandable position of the axis in EU. | ||
'} | ||
fEncSoftEndMax : LREAL; // Maximum commandable position of the axis in EU. | ||
// Encoder Evaluation | ||
{attribute 'pytmc' := ' | ||
pv: EncScaling | ||
io: i | ||
field: DESC Encoder scaling numerator / denominator in EU/COUNT. | ||
'} | ||
fEncScaleFactorInternal : LREAL; // Encoder scaling numerator / denominator in EU/COUNT. | ||
{attribute 'pytmc' := ' | ||
pv: EncOffset | ||
io: i | ||
field: DESC Encoder offset in EU. | ||
'} | ||
fEncOffset : LREAL; // Encoder offset in EU. | ||
END_STRUCT | ||
END_TYPE | ||
]]></Declaration> | ||
</DUT> | ||
</TcPlcObject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
lcls-twincat-motion/Library/Tests/FB_AxisParameterSetExposed_Test.TcPOU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1"> | ||
<POU Name="FB_AxisParameterSetExposed_Test" Id="{862cf200-7f25-43c6-8605-e66b08e38db7}" SpecialFunc="None"> | ||
<Declaration><![CDATA[FUNCTION_BLOCK FB_AxisParameterSetExposed_Test EXTENDS FB_MotorTestSuite | ||
(* | ||
Quick Check to verify exposed NC parameters are copied properly. | ||
*) | ||
VAR | ||
stMotionStage: ST_MotionStage; | ||
fbMotionStage: FB_MotionStage; | ||
nTestCounter: UINT; | ||
bOneTestDone: BOOL; | ||
tonTimer: TON; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[IF nTestCounter = 0 THEN | ||
nTestCounter := 1; | ||
END_IF | ||
// Test that parameters are copied to the exposed parameters properly. | ||
TestParameterCopy(1); | ||
IF bOneTestDone THEN | ||
bOneTestDone := FALSE; | ||
nTestCounter := nTestCounter + 1; | ||
tonTimer(IN:=FALSE); | ||
END_IF; | ||
// Use this timer to time out any tests that stall | ||
tonTimer( | ||
IN:=nTestCounter >= 1, | ||
PT:=T#2s, | ||
); | ||
]]></ST> | ||
</Implementation> | ||
<Method Name="TestParameterCopy" Id="{7caa7a7e-60eb-46a7-b83a-472b67bef094}"> | ||
<Declaration><![CDATA[METHOD TestParameterCopy | ||
VAR_INPUT | ||
nTestIndex: UINT; | ||
END_VAR | ||
VAR_INST | ||
bLocalInit: BOOL := TRUE; | ||
bAllModified: BOOL; | ||
bReady: BOOL; | ||
bDone: BOOL; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[TEST(CONCAT('TestParameterCopy', UINT_TO_STRING(nTestIndex))); | ||
IF nTestCounter <> nTestIndex OR bOneTestDone THEN | ||
RETURN; | ||
END_IF | ||
fbMotionStage(stMotionStage:=stMotionStage); | ||
IF bLocalInit THEN | ||
stMotionStage.stAxisParametersExposed.bCtrlEnablePosDiffControl := 100; | ||
stMotionStage.stAxisParametersExposed.bEncEnableSoftEndMaxControl := 101; | ||
stMotionStage.stAxisParametersExposed.bEncEnableSoftEndMinControl := 102; | ||
stMotionStage.stAxisParametersExposed.fAccelerationMax := 103; | ||
stMotionStage.stAxisParametersExposed.fCtrlPosDiffMax := 104; | ||
stMotionStage.stAxisParametersExposed.fCtrlPosDiffMaxTime := 105; | ||
stMotionStage.stAxisParametersExposed.fDecelerationMax := 106; | ||
stMotionStage.stAxisParametersExposed.fEncSoftEndMax := 107; | ||
stMotionStage.stAxisParametersExposed.fEncSoftEndMin := 108; | ||
stMotionStage.stAxisParametersExposed.fVeloMaximum := 109; | ||
stMotionStage.stAxisParametersExposed.fEncOffset := 110; | ||
stMotionStage.stAxisParametersExposed.fEncScaleFactorInternal := 111; | ||
bLocalInit := FALSE; | ||
bAllModified := | ||
stMotionStage.stAxisParametersExposed.bCtrlEnablePosDiffControl <> stMotionStage.stAxisParameters.bCtrlEnablePosDiffControl AND | ||
stMotionStage.stAxisParametersExposed.bEncEnableSoftEndMaxControl <> stMotionStage.stAxisParameters.bEncEnableSoftEndMaxControl AND | ||
stMotionStage.stAxisParametersExposed.bEncEnableSoftEndMinControl <> stMotionStage.stAxisParameters.bEncEnableSoftEndMinControl AND | ||
stMotionStage.stAxisParametersExposed.fAccelerationMax <> stMotionStage.stAxisParameters.fAccelerationMax AND | ||
stMotionStage.stAxisParametersExposed.fCtrlPosDiffMax <> stMotionStage.stAxisParameters.fCtrlPosDiffMax AND | ||
stMotionStage.stAxisParametersExposed.fCtrlPosDiffMaxTime <> stMotionStage.stAxisParameters.fCtrlPosDiffMaxTime AND | ||
stMotionStage.stAxisParametersExposed.fDecelerationMax <> stMotionStage.stAxisParameters.fDecelerationMax AND | ||
stMotionStage.stAxisParametersExposed.fEncSoftEndMax <> stMotionStage.stAxisParameters.fEncSoftEndMax AND | ||
stMotionStage.stAxisParametersExposed.fEncSoftEndMin <> stMotionStage.stAxisParameters.fEncSoftEndMin AND | ||
stMotionStage.stAxisParametersExposed.fVeloMaximum <> stMotionStage.stAxisParameters.fVeloMaximum AND | ||
stMotionStage.stAxisParametersExposed.fEncOffset <> stMotionStage.stAxisParameters.fEncOffset AND | ||
stMotionStage.stAxisParametersExposed.fEncScaleFactorInternal <> stMotionStage.stAxisParameters.fEncScaleFactorInternal; | ||
AssertTrue( | ||
Condition:=bAllModified, | ||
Message:='One or more parameters was not modified initially so the check is invalid.', | ||
); | ||
END_IF | ||
bReady := | ||
stMotionStage.stAxisParameters.bCtrlEnablePosDiffControl <> 0 AND | ||
stMotionStage.stAxisParameters.bEncEnableSoftEndMaxControl <> 0 AND | ||
stMotionStage.stAxisParameters.bEncEnableSoftEndMinControl <> 0 AND | ||
stMotionStage.stAxisParameters.fAccelerationMax <> 0 AND | ||
stMotionStage.stAxisParameters.fCtrlPosDiffMax <> 0 AND | ||
stMotionStage.stAxisParameters.fCtrlPosDiffMaxTime <> 0 AND | ||
stMotionStage.stAxisParameters.fDecelerationMax <> 0 AND | ||
stMotionStage.stAxisParameters.fEncSoftEndMax <> 0 AND | ||
stMotionStage.stAxisParameters.fEncSoftEndMin <> 0 AND | ||
stMotionStage.stAxisParameters.fVeloMaximum <> 0 AND | ||
stMotionStage.stAxisParameters.fEncOffset <> 0 AND | ||
stMotionStage.stAxisParameters.fEncScaleFactorInternal <> 0; | ||
IF bReady THEN | ||
bDone := | ||
stMotionStage.stAxisParametersExposed.bCtrlEnablePosDiffControl = stMotionStage.stAxisParameters.bCtrlEnablePosDiffControl AND | ||
stMotionStage.stAxisParametersExposed.bEncEnableSoftEndMaxControl = stMotionStage.stAxisParameters.bEncEnableSoftEndMaxControl AND | ||
stMotionStage.stAxisParametersExposed.bEncEnableSoftEndMinControl = stMotionStage.stAxisParameters.bEncEnableSoftEndMinControl AND | ||
stMotionStage.stAxisParametersExposed.fAccelerationMax = stMotionStage.stAxisParameters.fAccelerationMax AND | ||
stMotionStage.stAxisParametersExposed.fCtrlPosDiffMax = stMotionStage.stAxisParameters.fCtrlPosDiffMax AND | ||
stMotionStage.stAxisParametersExposed.fCtrlPosDiffMaxTime = stMotionStage.stAxisParameters.fCtrlPosDiffMaxTime AND | ||
stMotionStage.stAxisParametersExposed.fDecelerationMax = stMotionStage.stAxisParameters.fDecelerationMax AND | ||
stMotionStage.stAxisParametersExposed.fEncSoftEndMax = stMotionStage.stAxisParameters.fEncSoftEndMax AND | ||
stMotionStage.stAxisParametersExposed.fEncSoftEndMin = stMotionStage.stAxisParameters.fEncSoftEndMin AND | ||
stMotionStage.stAxisParametersExposed.fVeloMaximum = stMotionStage.stAxisParameters.fVeloMaximum AND | ||
stMotionStage.stAxisParametersExposed.fEncOffset = stMotionStage.stAxisParameters.fEncOffset AND | ||
stMotionStage.stAxisParametersExposed.fEncScaleFactorInternal = stMotionStage.stAxisParameters.fEncScaleFactorInternal; | ||
END_IF | ||
IF bDone OR tonTimer.Q THEN | ||
AssertFalse( | ||
Condition:=tonTimer.Q, | ||
Message:=CONCAT(CONCAT('Failed to update the parameters within ', TIME_TO_STRING(tonTimer.PT)),' seconds.'), | ||
); | ||
AssertTrue( | ||
Condition:=bDone, | ||
Message:='One or more parameters was not copied properly.', | ||
); | ||
bOneTestDone := TRUE; | ||
TEST_FINISHED(); | ||
END_IF | ||
]]></ST> | ||
</Implementation> | ||
</Method> | ||
</POU> | ||
</TcPlcObject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.