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

Add a local PMPS look up flag. #207

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion lcls-twincat-motion/Library/Library.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<CombineIds>false</CombineIds>
<Company>SLAC</Company>
<Released>false</Released>
<Title>lcls-twincat-motion</Title>
<Title>lcls-twincat-motion-nrw</Title>
<ProjectVersion>0.0.0</ProjectVersion>
<WriteProductVersion>false</WriteProductVersion>
<!-- <OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ VAR_INPUT
sDeviceName: STRING;
// For debug: set this to TRUE in online mode to read the database immediately.
bReadNow: BOOL;
// Set this to FALSE to load PMPS parameters locally
bUsePmpsDB: BOOL := TRUE;
// Local PMPSDB parameteres
astManualDbStateParams: ARRAY[0..GeneralConstants.MAX_STATES] OF ST_DbStateParams;
END_VAR
VAR_OUTPUT
// The raw lookup results from this FB. Index 0 is the transition beam, the rest of the indices match the state positions.
Expand Down Expand Up @@ -58,11 +62,15 @@ VAR
sTempBackfill: STRING;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[
SelectLookupKeys();
ReadDatabase();
RunFastFaults();
BackfillInfo();
<ST><![CDATA[IF bUsePmpsDB THEN
SelectLookupKeys();
ReadDatabase();
RunFastFaults();
BackfillInfo();
ELSE
astDbStateParams:=astManualDbStateParams;
END_IF

]]></ST>
</Implementation>
<Action Name="BackfillInfo" Id="{da77ffc7-a50e-48a0-9b32-806e7f647a44}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ VAR_INPUT
stPMPSEpicsToPlc: ST_StatePMPSEpicsToPlc;
// Set this to TRUE to re-read the loaded database immediately (useful for debug)
bReadDBNow: BOOL;
// Set this to FALSE to load PMPS parameters locally
bUsePmpsDB: BOOL := TRUE;
// Local PMPSDB parameteres
astManualDbStateParams: ARRAY[0..GeneralConstants.MAX_STATES] OF ST_DbStateParams;
END_VAR
VAR_OUTPUT
// Normal EPICS outputs, gathered into a single struct
Expand Down Expand Up @@ -109,6 +113,8 @@ fbPMPSCore(
nCurrGoal:=fbCore.nCurrGoal,
bReadDBNow:=bReadDBNow,
stDbStateParams=>stDbStateParams,
bUsePmpsDB:=bUsePmpsDB,
astManualDbStateParams:=astManualDbStateParams,
);

stMotionStage := astMotionStageMax[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ VAR_INPUT
stPMPSEpicsToPlc: ST_StatePMPSEpicsToPlc;
// Set this to TRUE to re-read the loaded database immediately (useful for debug)
bReadDBNow: BOOL;
// Set this to FALSE to load PMPS parameters locally
bUsePmpsDB: BOOL := TRUE;
// Local PMPSDB parameteres
astManualDbStateParams: ARRAY[0..GeneralConstants.MAX_STATES] OF ST_DbStateParams;
END_VAR
VAR_OUTPUT
// Normal EPICS outputs, gathered into a single struct
Expand Down Expand Up @@ -120,6 +124,8 @@ fbPMPSCore(
nCurrGoal:=fbCore.nCurrGoal,
bReadDBNow:=bReadDBNow,
stDbStateParams=>stDbStateParams,
bUsePmpsDB:=bUsePmpsDB,
astManualDbStateParams:=astManualDbStateParams,
);

stMotionStage1 := astMotionStageMax[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ VAR_INPUT
stPMPSEpicsToPlc: ST_StatePMPSEpicsToPlc;
// Set this to TRUE to re-read the loaded database immediately (useful for debug)
bReadDBNow: BOOL;
// Set this to FALSE to load PMPS parameters locally
bUsePmpsDB: BOOL := TRUE;
// Local PMPSDB parameteres
astManualDbStateParams: ARRAY[0..GeneralConstants.MAX_STATES] OF ST_DbStateParams;
END_VAR
VAR_OUTPUT
// Normal EPICS outputs, gathered into a single struct
Expand Down Expand Up @@ -131,6 +135,8 @@ fbPMPSCore(
nCurrGoal:=fbCore.nCurrGoal,
bReadDBNow:=bReadDBNow,
stDbStateParams=>stDbStateParams,
bUsePmpsDB:=bUsePmpsDB,
astManualDbStateParams:=astManualDbStateParams,
);

stMotionStage1 := astMotionStageMax[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ VAR_INPUT
nCurrGoal: UINT;
// Set this to TRUE to re-read the loaded database immediately (useful for debug)
bReadDBNow: BOOL;
// Set this to FALSE to load PMPS parameters locally
bUsePmpsDB: BOOL := TRUE;
// Local PMPSDB parameteres
astManualDbStateParams: ARRAY[0..GeneralConstants.MAX_STATES] OF ST_DbStateParams;
END_VAR
VAR_OUTPUT
// The PMPS database lookup associated with the current position state.
Expand Down Expand Up @@ -72,15 +76,29 @@ ELSE
eStatePMPSStatus := E_StatePMPSStatus.TRANSITION;
END_IF

fbMotionReadPMPSDB(
astPositionState:=astPositionStateMax,
fbFFHWO:=fbFFHWO,
sTransitionKey:=sTransitionKey,
sDeviceName:=sDeviceName,
bReadNow:=bReadDBNow,
astDbStateParams=>,
bError=>,
);
IF bUsePmpsDB THEN
fbMotionReadPMPSDB(
astPositionState:=astPositionStateMax,
fbFFHWO:=fbFFHWO,
sTransitionKey:=sTransitionKey,
sDeviceName:=sDeviceName,
bReadNow:=bReadDBNow,
astDbStateParams=>,
bError=>,
);
ELSE
fbMotionReadPMPSDB(
astPositionState:=astPositionStateMax,
fbFFHWO:=fbFFHWO,
sTransitionKey:=sTransitionKey,
sDeviceName:=sDeviceName,
bReadNow:=bReadDBNow,
astDbStateParams=>,
bError=>,
astManualDbStateParams:=astManualDbStateParams,
bUsePmpsDB:=bUsePmpsDB,
);
END_IF

fbMotionBPTM(
astMotionStage:=astMotionStageMax,
Expand Down
2 changes: 1 addition & 1 deletion lcls-twincat-motion/Library/Version/Global_Version.TcGVL
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// This function has been automatically generated from the project information.
VAR_GLOBAL CONSTANT
{attribute 'const_non_replaced'}
stLibVersion_lcls_twincat_motion : ST_LibVersion := (iMajor := 0, iMinor := 0, iBuild := 0, iRevision := 0, nFlags := 0, sVersion := '0.0.0');
stLibVersion_lcls_twincat_motion_nrw : ST_LibVersion := (iMajor := 0, iMinor := 0, iBuild := 0, iRevision := 0, nFlags := 0, sVersion := '0.0.0');
END_VAR
]]></Declaration>
</GVL>
Expand Down
2 changes: 1 addition & 1 deletion lcls-twincat-motion/_Config/PLC/Library.xti
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ External Setpoint Generation:
</DataType>
</DataTypes>
<Project GUID="{E61EF94A-CFE8-4DDF-B7C9-5F7AD2CF9D83}" Name="Library" PrjFilePath="..\..\Library\Library.plcproj" TmcFilePath="..\..\Library\Library.tmc" ReloadTmc="true" AmsPort="851" FileArchiveSettings="#x000e">
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="Library\Library.tmc" TmcHash="{0C997D26-FEC1-46B4-2438-632FFA910317}">
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="Library\Library.tmc" TmcHash="{9E14035E-8A52-F1A5-AC38-B76DFBAADB32}">
<Name>Library Instance</Name>
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
<Vars VarGrpType="1">
Expand Down
Loading