Skip to content

Commit

Permalink
Track manager (#37)
Browse files Browse the repository at this point in the history
Squashed feature branch

* Fix broken links
* Add Track object and integrate with existing motion commands
* Add mover lists for Track objects
* Track Activate doesn't complete
* Activate Track completes
* Split track to two parts
* Change to track 1
* Working on track 1 without positionTrigger
* Make trackId check more visible for debugging
* Rename Station.TrackPosition > Station.Position
* Rename PositionTrigger.TrackPosition > .Position
* Make currentTrackId compare more visible in PositionTrigger
* Position triggers need work
* Add activate track method and property to moverList
* Allow .ActivateTrack to be called cyclically
* Update MoverList.GetMoverByLocation for non-modulo position
* Add Track object documentation
* Fix non-registered mover else in PositionTrigger
* Fix PositionTrigger modulo calculation with track management
* Code cleanup
* Change to Track[0]
* documentation formatting cleanup
* Resolve position trigger first run only issue
---------

Co-authored-by: Matt Walsh <[email protected]>
  • Loading branch information
netbymatt and Matt Walsh authored Jul 14, 2023
1 parent 07eb6b1 commit 7689f28
Show file tree
Hide file tree
Showing 34 changed files with 7,780 additions and 4,769 deletions.
5,386 changes: 4,393 additions & 993 deletions Base Project/Base Project.tsproj

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Base Project/Main/DUTs/MainState_enum.TcDUT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.11">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="MainState_enum" Id="{62255fa4-5620-44dc-b5d1-8a2be4061452}">
<Declaration><![CDATA[{attribute 'strict'}
{attribute 'to_string'}
Expand All @@ -9,6 +9,8 @@ TYPE MainState_enum : (
MS_ONESHOT_ENABLE := 20,
MS_ENABLING_MOVERS := 30,
MS_INITIALIZING_OBJECTIVES := 40,
MS_ACTIVATE_TRACKS := 45,
MS_WAIT_FOR_TRACKS := 46,
MS_ENABLED := 50,
MS_RUN := 60,
MS_ONESHOT_STOP := 70,
Expand Down
14 changes: 14 additions & 0 deletions Base Project/Main/DUTs/TrackInfo.TcDUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="TrackInfo" Id="{e1df8d7d-bb5e-01fd-14ad-401c12b84a9f}">
<Declaration><![CDATA[TYPE TrackInfo :
STRUCT
TrackId : OTCID; // hardware id of mover's track read back from MC_ReadTrackPositions
PartId : OTCID; // hardware id of mover's part read back from MC_ReadTrackPositions
TrackPosition : LREAL; // track position read back from MC_ReadTrackPositions
PartPosition : LREAL; // part position read back from MC_ReadTrackPositions
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>
19 changes: 19 additions & 0 deletions Base Project/Main/DUTs/TrackState.TcDUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="TrackState" Id="{b8cf507c-0268-0834-24f4-900859769bcf}">
<Declaration><![CDATA[{attribute 'qualified_only'}
{attribute 'strict'}
TYPE TrackState :
(
WAIT_FOR_COMMAND := 0,
SETUP_FUNCTION := 100,
MONITOR_RESPONSE := 110,
REQUIRED_DELAY := 200,
CLEAN_UP := 300,
WAIT_END := 1000,
ERROR := 9000
);
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>
4 changes: 3 additions & 1 deletion Base Project/Main/GVLs/GVL.TcGVL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.11">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<GVL Name="GVL" Id="{ba655886-9947-4787-bd10-a16d0603440f}">
<Declaration><![CDATA[{attribute 'qualified_only'}
VAR_GLOBAL CONSTANT
Expand All @@ -11,6 +11,8 @@ VAR_GLOBAL CONSTANT
{attribute 'TcInitSymbol'}
pXtsProcessingUnit : OTCID:=0; // This pointer needs to be initialized in the Main Instance, under Symbol Initialization
NUM_TRACKS : USINT := 1; // This is the number of logical tracks in the system
END_VAR
VAR_GLOBAL
newCallTime: LREAL;
Expand Down
27 changes: 25 additions & 2 deletions Base Project/Main/GlobalTextList.TcGTLO
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.11">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<GlobalTextList Name="GlobalTextList" Id="{ddba5fa1-a348-0620-2b13-d8f26eaccc0a}">
<XmlArchive>
<Data>
<o xml:space="preserve" t="GlobalTextListObject">
<l n="TextList" t="ArrayList" />
<l n="TextList" t="ArrayList" cet="TextListRow">
<o>
<v n="TextID">"517"</v>
<v n="TextDefault">"Disable"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"232"</v>
<v n="TextDefault">"Enable"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"393"</v>
<v n="TextDefault">"Start"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"920"</v>
<v n="TextDefault">"Stop"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
</l>
<l n="Languages" t="ArrayList" />
<v n="GuidInit">{17b82ff9-95ff-49fb-ae19-11213e89ecc1}</v>
<v n="GuidReInit">{cea7e70d-8081-45df-90ee-394652fd7f67}</v>
Expand All @@ -15,6 +36,8 @@
<Type n="ArrayList">System.Collections.ArrayList</Type>
<Type n="GlobalTextListObject">{63784cbb-9ba0-45e6-9d69-babf3f040511}</Type>
<Type n="Guid">System.Guid</Type>
<Type n="String">System.String</Type>
<Type n="TextListRow">{53da1be7-ad25-47c3-b0e8-e26286dad2e0}</Type>
</TypeList>
</XmlArchive>
</GlobalTextList>
Expand Down
27 changes: 26 additions & 1 deletion Base Project/Main/ITFs/iMover.TcIO
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.11">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<Itf Name="iMover" Id="{30ffe45f-c01a-49ae-9d19-23395eddd7e8}">
<Declaration><![CDATA[INTERFACE iMover]]></Declaration>
<Folder Name="Methods" Id="{1b23c83c-1258-4c4f-a9ad-a029b20875d0}" />
<Folder Name="Properties" Id="{73a4fa43-0d07-4dea-a761-2d7dc373ee4f}" />
<Method Name="ActivateTrack" Id="{0340ebdc-9de8-0f0c-175a-ccd19ec99ec0}" FolderPath="Methods\">
<Declaration><![CDATA[METHOD ActivateTrack : BOOL
VAR_INPUT
Track : REFERENCE TO Track;
END_VAR
]]></Declaration>
</Method>
<Property Name="CurrentDestinationPosition" Id="{fd336655-1b12-4c85-8800-888e616a0190}" FolderPath="Properties\">
<Declaration><![CDATA[{attribute 'monitoring' := 'call'}
PROPERTY CurrentDestinationPosition : LREAL]]></Declaration>
Expand All @@ -24,11 +31,23 @@ PROPERTY CurrentMoveType : MoverCommandType_enum]]></Declaration>
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Property Name="CurrentTrack" Id="{6df508fb-5bd5-0e4f-32b6-ad8f8b706833}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY CurrentTrack : POINTER TO Track]]></Declaration>
<Get Name="Get" Id="{a9690824-dbea-0ac9-0859-6bf4b97c3449}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Method Name="Cyclic" Id="{b891277c-4d72-4aed-a650-47e395d59c1f}" FolderPath="Methods\">
<Declaration><![CDATA[METHOD Cyclic : iMover
VAR_IN_OUT
GroupReference : AXES_GROUP_REF;
END_VAR
]]></Declaration>
</Method>
<Method Name="CyclicTrack" Id="{3e3500dc-85cc-0f0e-23f9-0a487fad9df8}" FolderPath="Methods\">
<Declaration><![CDATA[METHOD CyclicTrack : BOOL
VAR
END_VAR
]]></Declaration>
</Method>
<Method Name="Disable" Id="{d596b2ea-b33b-4163-8d7c-887245d1fbda}" FolderPath="Methods\">
Expand Down Expand Up @@ -56,6 +75,12 @@ END_VAR
]]></Declaration>
</Method>
<Property Name="IsTrackReady" Id="{a749704e-a727-05fa-1be8-d11fd5732682}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY IsTrackReady : BOOL]]></Declaration>
<Get Name="Get" Id="{3d58532e-56d6-0a5a-0811-67af41cc16bc}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Method Name="LogUserEvent" Id="{24391ec1-ea2c-453c-9dee-5da9dcff0b7b}" FolderPath="Methods\">
<Declaration><![CDATA[METHOD LogUserEvent : iMover
VAR_INPUT
Expand Down
15 changes: 14 additions & 1 deletion Base Project/Main/ITFs/iMoverList.TcIO
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.11">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<Itf Name="iMoverList" Id="{9cc4a2ad-2506-4bdd-acf3-bfbfde25ab77}">
<Declaration><![CDATA[INTERFACE iMoverList]]></Declaration>
<Method Name="ActivateAllTrack" Id="{214d853b-c1b8-0faa-14bf-a2670bf33012}">
<Declaration><![CDATA[METHOD ActivateAllTrack : BOOL
VAR_INPUT
Track : REFERENCE TO Track;
END_VAR
]]></Declaration>
</Method>
<Method Name="GetMoverByLocation" Id="{08ab6dd2-55e6-476a-991b-26d3f0ccc58d}">
<Declaration><![CDATA[METHOD GetMoverByLocation : REFERENCE to Mover
VAR_INPUT
Expand All @@ -10,6 +17,12 @@ VAR_INPUT
Direction : Tc2_MC2.MC_Direction; // Positive = find the most positive mover whose position is less than the Input. Negative = find the most negative mover whose position is greater than the input
END_VAR]]></Declaration>
</Method>
<Property Name="IsAllTrackReady" Id="{a3e4944a-7607-0f5a-10b2-64b1616a1317}">
<Declaration><![CDATA[PROPERTY IsAllTrackReady : BOOL]]></Declaration>
<Get Name="Get" Id="{c87cec46-e2a4-0a12-2b5e-a6b05f1caa93}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Method Name="MoveAllToPosition" Id="{745a52d9-fa71-49ff-868a-52a3293e2e2d}">
<Declaration><![CDATA[METHOD MoveAllToPosition : iMoverList
VAR_INPUT
Expand Down
63 changes: 63 additions & 0 deletions Base Project/Main/ITFs/iTrack.TcIO
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<Itf Name="iTrack" Id="{41e6f11d-1951-01da-13f4-8ac69ce6b873}">
<Declaration><![CDATA[INTERFACE iTrack
]]></Declaration>
<Folder Name="Methods" Id="{cc616af7-fa5e-0721-3c8e-d062b484e0c8}" />
<Folder Name="Properties" Id="{332f2434-e8e7-012d-221e-b1241870310e}" />
<Property Name="CurrentMoverCount" Id="{7706471b-0127-0e08-2769-e211435d9cd2}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY CurrentMoverCount : DINT]]></Declaration>
<Get Name="Get" Id="{f904841d-fff0-0874-075a-461b289a34a3}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Property Name="CurrentMoverList" Id="{53b54c82-4385-0644-3c7a-fe140dee0acc}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY CurrentMoverList : iMoverList]]></Declaration>
<Get Name="Get" Id="{f55b5545-5b8d-060b-31cd-65f766a1eda0}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Property Name="Id" Id="{e69e0034-eced-090a-3e7c-cb98c2c8ba20}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY Id : INT]]></Declaration>
<Get Name="Get" Id="{fda8bdc8-fe34-01b4-33d1-6cb2adf3c8b1}">
<Declaration><![CDATA[]]></Declaration>
</Get>
<Set Name="Set" Id="{eedf83fb-7109-04ab-2166-7221f61f50a7}">
<Declaration><![CDATA[]]></Declaration>
</Set>
</Property>
<Property Name="OTCID" Id="{f6ce1703-ab1e-0aac-1a01-d494ff9596d6}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY OTCID : OTCID]]></Declaration>
<Get Name="Get" Id="{cabf5557-da38-0c45-31d8-9a1af06122f6}">
<Declaration><![CDATA[]]></Declaration>
</Get>
<Set Name="Set" Id="{d259f521-eb96-028c-3abd-b12cfa876b7e}">
<Declaration><![CDATA[]]></Declaration>
</Set>
</Property>
<Method Name="RegisterMover" Id="{aa379151-5a94-0a15-244b-4ddcbf268ca8}" FolderPath="Methods\">
<Declaration><![CDATA[METHOD RegisterMover : BOOL
VAR_INPUT
NewMover : REFERENCE TO Mover;
END_VAR
VAR
END_VAR
]]></Declaration>
</Method>
<Method Name="UnregisterAll" Id="{f2ab22b3-a027-08df-22f2-7e3232cd47f0}" FolderPath="Methods\">
<Declaration><![CDATA[METHOD UnregisterAll : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
</Method>
<Method Name="UnregisterMover" Id="{c8d25a54-3401-08fd-3ce2-76cee9dd2344}" FolderPath="Methods\">
<Declaration><![CDATA[METHOD UnregisterMover : BOOL
VAR_INPUT
RemovingMover : REFERENCE TO Mover;
END_VAR
VAR
END_VAR
]]></Declaration>
</Method>
</Itf>
</TcPlcObject>
16 changes: 16 additions & 0 deletions Base Project/Main/Main.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<Compile Include="DUTs\MoverState_enum.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="DUTs\TrackInfo.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="DUTs\TrackState.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="GlobalTextList.TcGTLO">
<SubType>Code</SubType>
</Compile>
Expand All @@ -47,6 +53,9 @@
<Compile Include="ITFs\iMover.TcIO">
<SubType>Code</SubType>
</Compile>
<Compile Include="ITFs\iTrack.TcIO">
<SubType>Code</SubType>
</Compile>
<Compile Include="PlcTask.TcTTO">
<SubType>Code</SubType>
</Compile>
Expand All @@ -56,6 +65,9 @@
<Compile Include="POUs\XTS\ErrorMover.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\XTS\ErrorTrack.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\XTS\Mover.TcPOU">
<SubType>Code</SubType>
</Compile>
Expand Down Expand Up @@ -83,6 +95,10 @@
<Compile Include="Visualization Manager.TcVMO">
<SubType>Code</SubType>
</Compile>
<Compile Include="VISUs\Controls.TcVIS">
<SubType>Code</SubType>
<DependentUpon>Visualization Manager.TcVMO</DependentUpon>
</Compile>
<Compile Include="VISUs\DiagnosticVisu.TcVIS">
<SubType>Code</SubType>
<DependentUpon>Visualization Manager.TcVMO</DependentUpon>
Expand Down
Loading

0 comments on commit 7689f28

Please sign in to comment.