Skip to content

Commit

Permalink
[NEW-FEATURE] Create basic views an models for each components (#681)
Browse files Browse the repository at this point in the history
* Create draft PR for #680

* +view models  due wrapped components visualisiation (components lost datacontext in wrapped component)
+example of usage in sandbox
*find components types only on top level

* +view models for abb robots

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Peter Barancek <[email protected]>
  • Loading branch information
github-actions[bot] and peterbarancek authored Jan 21, 2024
1 parent c96a69d commit 521253e
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ public TcoIrc5_v_1_x_xServiceViewModel():base()

}
}
public class TcoIrc5_v_1_x_xViewModel : TcoIrc5_v_1_x_xServiceViewModel
{ }

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ public TcoOmnicore_v_1_x_xServiceViewModel():base()

}

public class TcoOmnicore_v_1_x_xViewModel : TcoOmnicore_v_1_x_xServiceViewModel
{ }
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public IEnumerable<TcoObject> Children

public IEnumerable<TcoObject> Components
{
get { if (_components == null) _components = this.GetDescendants<TcoComponent>(); return _components; }
get { if (_components == null) _components = this.GetChildren<TcoComponent>(); return _components; }
}

public bool HasComponents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ public TcoDriveSimpleServiceViewModel()

public override object Model { get => this.Component; set { this.Component = value as TcoDriveSimple; } }
}

public class TcoDriveSimpleViewModel : TcoDriveSimpleServiceViewModel
{ }
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,6 @@ public TcoMultiAxisMoveParam SelectedItem
public bool Axis4MoveAllowed { get => axis4MoveAllowed; set => SetProperty(ref axis4MoveAllowed, value); }
}

public class TcoMultiAxisViewModel : TcoMultiAxisServiceViewModel
{ }
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace TcoDrivesBeckhoff
{

public class TcoSingleAxisServiceViewModel : RenderableViewModel
{
private TcoMultiAxisMoveParam selectedItem;
Expand Down Expand Up @@ -175,4 +176,6 @@ public TcoMultiAxisMoveParam SelectedItem
public RelayCommand RefreshPositionsCommand { get; private set; }
}

public class TcoSingleAxisViewModel : TcoSingleAxisServiceViewModel
{ }
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@
<Compile Include="Tests\TcoContext\WpfContext.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\TcoContext\WrappedComponent\WrappedComponentExample.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\TcoContext\WrappedComponent\WrappedComponentExample_Config.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\TcoContext\WrappedComponent\WrappedComponentExample_Control.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\TcoContext\WrappedComponent\WrappedComponentExample_Status.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\TcoContext\WrappedComponent\WrappedComponentsExample.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tests\TcoDriveSimple\eTcoDriveSimpleTests.TcDUT">
<SubType>Code</SubType>
</Compile>
Expand Down Expand Up @@ -80,6 +95,7 @@
<Folder Include="DUTs" />
<Folder Include="GVLs" />
<Folder Include="Tests" />
<Folder Include="Tests\TcoContext\WrappedComponent" />
<Folder Include="Tests\TcoSingleAxis" />
<Folder Include="Tests\TcoContext" />
<Folder Include="Tests\TcoDriveSimple" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ VAR
{attribute addProperty Name "<#Test multi axis#>"}
_multiAxis : TcoDrivesBeckhoff.TcoMultiAxis(THIS^);
{attribute addProperty Name "<#Wrapped Component Example#>"}
_wrappedExample : WrappedComponentExample(THIS^);
_sequence1 : TcoCore.TcoSequence(THIS^, eRestoreMode.None);
_observer : TcoCore.TcoSequencerObserver(THIS^);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<POU Name="WrappedComponentExample" Id="{f443fe68-822c-036d-122a-3f9c9f3200c7}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK WrappedComponentExample EXTENDS TcoCore.TcoComponent
VAR_OUTPUT
END_VAR
VAR
_config:WrappedComponentExample_Config;
_status:WrappedComponentExample_Status;
_control:WrappedComponentExample_Control;
_components:WrappedComponentsExample:= (Parent := THIS^);
_throwTask:TcoCore.TcoTask(THIS^);
_restoreTask:TcoCore.TcoTask(THIS^);
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Property Name="Components" Id="{f2a63328-27cd-090c-37b1-a3ac64a01290}">
<Declaration><![CDATA[PROPERTY Components : REFERENCE TO WrappedComponentsExample
]]></Declaration>
<Get Name="Get" Id="{0c7dcdd5-c057-0b17-279d-c3102bfded2d}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[Components ref=_components;]]></ST>
</Implementation>
</Get>
</Property>
<Method Name="Restore" Id="{e7fc1b31-1ecd-0bb4-3914-4bad4e42e83f}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Restores this instance to the Ready state. Can be called explicitly or from within one of the restore mechanisms.
</summary>
</docu>
~*)
METHOD Restore : ITcoRestorable
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="ServiceMode" Id="{a27c0e07-b8aa-070e-2ec6-644188aae071}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Custom service (manual, maintenance) logic.
This method must be implemented in derived class.
</summary>
</docu>
~*)
METHOD PROTECTED ServiceMode
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
</POU>
</TcPlcObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="WrappedComponentExample_Config" Id="{fd4a1fe1-dfce-0359-2456-da059d207f84}">
<Declaration><![CDATA[TYPE WrappedComponentExample_Config EXTENDS TcoCore.TcoStruct:
STRUCT
VacuumReachedStabilisation:TIME:=T#100MS;
VacuumPushTime:TIME:=T#100MS;
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="WrappedComponentExample_Control" Id="{3f4ebb2e-dad9-0f41-1bf8-aea5e05727a4}">
<Declaration><![CDATA[TYPE WrappedComponentExample_Control EXTENDS TcoCore.TcoStruct:
STRUCT
Setpoint:INT;
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="WrappedComponentExample_Status" Id="{5b4807c6-cbbe-0ed2-2bbd-e81bc67735eb}">
<Declaration><![CDATA[TYPE WrappedComponentExample_Status EXTENDS TcoCore.TcoStruct:
STRUCT
ProgressThrow:INT;
ActionDescription:STRING;
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="WrappedComponentsExample" Id="{56c6929f-decd-0607-0880-6828e76cabf4}">
<Declaration><![CDATA[TYPE WrappedComponentsExample EXTENDS TcoCore.TcoStruct:
STRUCT
{attribute addProperty Name "Manipulator"}
Manipulator : TcoDrivesBeckhoff.TcoMultiAxis(THISSTRUCT);
{attribute addProperty Name "Axis"}
Axis : TcoDrivesBeckhoff.TcoSingleAxis(THISSTRUCT);
{attribute addProperty Name "Drive"}
Drive : TcoDrivesBeckhoff.TcoDriveSimple(THISSTRUCT);
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>
Original file line number Diff line number Diff line change
Expand Up @@ -2797,7 +2797,7 @@ External Setpoint Generation:
</Instance>
</Project>
<Project GUID="{4F0E1158-49EA-45D6-89E6-C1A4D3AF626F}" Name="TcoDrivesBeckhoffTests" PrjFilePath="TcoDrivesBeckhoffTests\TcoDrivesBeckhoffTests.plcproj" TmcFilePath="TcoDrivesBeckhoffTests\TcoDrivesBeckhoffTests.tmc" ReloadTmc="true" AmsPort="852" FileArchiveSettings="#x000e" SymbolicMapping="true">
<Instance Id="#x08502040" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="TcoDrivesBeckhoffTests\TcoDrivesBeckhoffTests.tmc" TmcHash="{E124D1B2-BF3D-920F-8570-5578024A4FF7}">
<Instance Id="#x08502040" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="TcoDrivesBeckhoffTests\TcoDrivesBeckhoffTests.tmc" TmcHash="{E7D9A918-0BC5-8AB4-E529-853A93A14D69}">
<Name>TcoDrivesBeckhoffTests Instance</Name>
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
<Vars VarGrpType="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@

<Grid>
<TabControl>
<TabItem Header="All">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<ScrollViewer>
<vortex:RenderableContentControl Grid.Row="0" DataContext="{Binding MAIN._wpfContext}" PresentationType="Base-Service"/>
</ScrollViewer>
</Grid>
</TabItem>
<TabItem Header="Drives">
<Grid>
<Grid.RowDefinitions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,7 @@
<data name="___Test_multi_axis__" xml:space="preserve">
<value>Test multi axis</value>
</data>
<data name="___Wrapped_Component_Example__" xml:space="preserve">
<value>Wrapped Component Example</value>
</data>
</root>

0 comments on commit 521253e

Please sign in to comment.