Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 383c4bf

Browse files
[NEW-FEATURE] Improve Button Behavior for Pneumatic Piston Movements (#758)
* Create draft PR for #747 * ***********TcoCore******** *service view of generic TcoComponent ,Details will be expanded by default if IsExpaded is selected **********TcoPneumatics******** +signalisation that movement is disabled by suspend method * MoveHomeTask automatically restores the opposite task, MoveWorkTask. This principle works in reverse as well * +resources --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: peterbarancek <[email protected]>
1 parent fd661f7 commit 383c4bf

File tree

11 files changed

+167
-84
lines changed

11 files changed

+167
-84
lines changed

src/TcoCore/src/TcoCore.Wpf/Properties/strings.Designer.cs

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/TcoCore/src/TcoCore.Wpf/Properties/strings.cs-CZ.resx

+3
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@
147147
<data name="Status" xml:space="preserve">
148148
<value>Stav</value>
149149
</data>
150+
<data name="Tasks" xml:space="preserve">
151+
<value>Úlohy</value>
152+
</data>
150153
<data name="Yes" xml:space="preserve">
151154
<value>Áno</value>
152155
</data>

src/TcoCore/src/TcoCore.Wpf/Properties/strings.resx

+3
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@
147147
<data name="Status" xml:space="preserve">
148148
<value>Status</value>
149149
</data>
150+
<data name="Tasks" xml:space="preserve">
151+
<value>Tasks</value>
152+
</data>
150153
<data name="Yes" xml:space="preserve">
151154
<value>Yes</value>
152155
</data>

src/TcoCore/src/TcoCore.Wpf/Properties/strings.sk-Sk.resx

+3
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@
147147
<data name="Status" xml:space="preserve">
148148
<value>Stav</value>
149149
</data>
150+
<data name="Tasks" xml:space="preserve">
151+
<value>Úlohy</value>
152+
</data>
150153
<data name="Yes" xml:space="preserve">
151154
<value>Áno</value>
152155
</data>

src/TcoCore/src/TcoCore.Wpf/TcoComponent/TcoComponentServiceView.xaml

+13-11
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</Style.Triggers>
3232
</Style>
3333
</StackPanel.Resources>
34-
<Expander IsExpanded="True"
34+
<Expander IsExpanded="{Binding IsExpanded}"
3535
Margin="5,0,5,0"
3636
Background="Transparent"
3737
materialDesign:ExpanderAssist.HorizontalHeaderPadding="0"
@@ -76,15 +76,17 @@
7676

7777
<RowDefinition />
7878
</Grid.RowDefinitions>
79-
<ItemsControl ItemsPanel="{StaticResource HorizontalWraped}" HorizontalAlignment="Left" ItemsSource="{Binding Tasks}">
80-
81-
<ItemsControl.ItemTemplate>
82-
<DataTemplate>
83-
<vortex:RenderableContentControl MinWidth="150" DataContext="{Binding}" Margin="5"></vortex:RenderableContentControl>
84-
</DataTemplate>
85-
</ItemsControl.ItemTemplate>
86-
</ItemsControl>
87-
<Expander Margin="5,0 " Grid.Row="2" Header="{x:Static p:strings.Details}">
79+
<GroupBox Grid.ColumnSpan="2" Margin="10,0" Padding="10" Header="{x:Static p:strings.Tasks}" >
80+
<ItemsControl ItemsPanel="{StaticResource HorizontalWraped}" HorizontalAlignment="Left" ItemsSource="{Binding Tasks}">
81+
82+
<ItemsControl.ItemTemplate>
83+
<DataTemplate>
84+
<vortex:RenderableContentControl MinWidth="150" DataContext="{Binding}" Margin="5"></vortex:RenderableContentControl>
85+
</DataTemplate>
86+
</ItemsControl.ItemTemplate>
87+
</ItemsControl>
88+
</GroupBox>
89+
<Expander IsExpanded ="True" Margin="10,5 " Grid.Row="2" Header="{x:Static p:strings.Details}">
8890

8991
<WrapPanel Margin="10">
9092
<WrapPanel.Resources>
@@ -109,7 +111,7 @@
109111
<ItemsControl HorizontalAlignment="Left" ItemsSource="{Binding Components}">
110112
<ItemsControl.ItemTemplate>
111113
<DataTemplate>
112-
<vortex:RenderableContentControl MinWidth="150" DataContext="{Binding}" Margin="5"></vortex:RenderableContentControl>
114+
<vortex:RenderableContentControl MinWidth="150" DataContext="{Binding}" Margin="5"></vortex:RenderableContentControl>
113115
</DataTemplate>
114116
</ItemsControl.ItemTemplate>
115117
</ItemsControl>

src/TcoPneumatics/src/TcoPneumatics.Wpf/Cylinders/TcoCylinderServiceView.xaml

+18-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
xmlns:local="clr-namespace:TcOpen"
77
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
88
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9-
109
xmlns:tcopneumatics="clr-namespace:TcoPneumatics"
1110
xmlns:vortex="http://vortex.mts/xaml"
1211
mc:Ignorable="d">
@@ -22,28 +21,34 @@
2221
<Style TargetType="StackPanel">
2322
<Setter Property="MinWidth" Value="200"></Setter>
2423
</Style>
25-
</WrapPanel.Resources>
26-
<StackPanel>
24+
</WrapPanel.Resources>
25+
<StackPanel>
2726
<Border
2827
Height="5"
2928
Background="{Binding _atHomePos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
3029
CornerRadius="2" />
31-
<vortex:RenderableContentControl DataContext="{Binding _moveHomeDefault}"/>
32-
</StackPanel>
30+
<Grid>
31+
<vortex:RenderableContentControl DataContext="{Binding _moveHomeDefault}"/>
32+
<materialDesign:PackIcon Margin="10,0" VerticalAlignment="Center" Visibility="{Binding _suspendedHome.Cyclic,Converter={vortex:BooleanToVisibilityConverter}}" Kind="WarningBox" Foreground="{StaticResource Warning}"/>
33+
</Grid>
34+
</StackPanel>
3335
<StackPanel>
3436
<Border
3537
Height="5"
3638
CornerRadius="2" />
3739
<vortex:RenderableContentControl DataContext="{Binding _stopDefault, Mode=OneWay}"/>
3840
</StackPanel>
39-
<StackPanel>
40-
<Border
41-
Height="5"
42-
Background="{Binding _atWorkPos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
43-
CornerRadius="2" />
44-
<vortex:RenderableContentControl DataContext="{Binding _moveWorkDefault}"/>
45-
</StackPanel>
46-
</WrapPanel>
41+
<StackPanel>
42+
<Border
43+
Height="5"
44+
Background="{Binding _atWorkPos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
45+
CornerRadius="2" />
46+
<Grid>
47+
<vortex:RenderableContentControl DataContext="{Binding _moveWorkDefault}"/>
48+
<materialDesign:PackIcon Margin="10,0" VerticalAlignment="Center" Visibility="{Binding _suspendedWork.Cyclic,Converter={vortex:BooleanToVisibilityConverter}}" Kind="WarningBox" Foreground="{StaticResource Warning}"/>
49+
</Grid>
50+
</StackPanel>
51+
</WrapPanel>
4752
</vortex:TcoComponentView.ComponentHeader>
4853
<vortex:TcoComponentView.ComponentDetails >
4954
<ScrollViewer MaxHeight="200" DataContext="{Binding Model}">

src/TcoPneumatics/src/TcoPneumatics.Wpf/Cylinders/TcoDoubleCylinderServiceView.xaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
Height="5"
2929
Background="{Binding _atHomePos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
3030
CornerRadius="2" />
31-
<vortex:RenderableContentControl DataContext="{Binding _moveHomeDefault}"/>
31+
<Grid>
32+
<vortex:RenderableContentControl DataContext="{Binding _moveHomeDefault}"/>
33+
<materialDesign:PackIcon Margin="10,0" VerticalAlignment="Center" Visibility="{Binding _suspendedHome.Cyclic,Converter={vortex:BooleanToVisibilityConverter}}" Kind="WarningBox" Foreground="{StaticResource Warning}"/>
34+
</Grid>
3235
</StackPanel>
3336
<StackPanel>
3437
<Border
@@ -41,7 +44,10 @@
4144
Height="5"
4245
Background="{Binding _atWorkPos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
4346
CornerRadius="2" />
44-
<vortex:RenderableContentControl DataContext="{Binding _moveWorkDefault}"/>
47+
<Grid>
48+
<vortex:RenderableContentControl DataContext="{Binding _moveWorkDefault}"/>
49+
<materialDesign:PackIcon Margin="10,0" VerticalAlignment="Center" Visibility="{Binding _suspendedWork.Cyclic,Converter={vortex:BooleanToVisibilityConverter}}" Kind="WarningBox" Foreground="{StaticResource Warning}"/>
50+
</Grid>
4551
</StackPanel>
4652
</WrapPanel>
4753
</vortex:TcoComponentView.ComponentHeader>

src/TcoPneumatics/src/XaeTcoPneumatics/TcoPneumatics/POUs/Cylinders/TcoCylinder.TcPOU

+37-20
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ VAR
1313
{attribute addProperty Name "|[[1]Attribute_stopDefaultName]|"}
1414
_stopDefault : TcoCore.TcoTask(THIS^);
1515
increment: INT;
16+
_suspendedHome:BOOL;
17+
_suspendedWork:BOOL;
1618
END_VAR
1719
VAR
1820
_config : TcoCylinderConfig;
@@ -21,6 +23,7 @@ VAR
2123
END_VAR]]></Declaration>
2224
<Implementation>
2325
<ST><![CDATA[SUPER^(inoAtHomePos := inoAtHomePos, inoAtWorkPos := inoAtWorkPos, inoToHomePos := inoToHomePos, inoToWorkPos := inoToWorkPos);
26+
2427
2528
IF(_atHomePos AND _atWorkPos) THEN Messenger.Error('<#Home and work position sensors are both active. Check the position of sensors!#>'); END_IF;
2629
@@ -32,12 +35,11 @@ _moveHomeDefault(PositionSensor := _atHomePos AND NOT _atWorkPos,
3235
MoveToPositionSignal := _toHomePos,
3336
InverseSignal := _toWorkPos,
3437
TimeToRefill:=_config.TimeToRefill,
38+
refInverseTask:=_moveWorkDefault,
3539
MaxTimeToReachPosition := _config.TimeToReachHomePosition,
3640
PositionName := '<#Home#>');
3741
38-
IF _moveHomeDefault.Execute() THEN
39-
_moveWorkDefault.Restore();
40-
END_IF
42+
4143
4244
// Disables mutualy exclusive actions
4345
_moveHomeDefault.Enabled := TRUE;//NOT _moveWorkDefault.Busy;
@@ -46,12 +48,10 @@ _moveWorkDefault(PositionSensor := _atWorkPos AND NOT _atHomePos,
4648
MoveToPositionSignal := _toWorkPos,
4749
InverseSignal := _toHomePos,
4850
TimeToRefill:=_config.TimeToRefill,
51+
refInverseTask:=_moveHomeDefault,
4952
MaxTimeToReachPosition := _config.TimeToReachWorkPosition,
5053
PositionName := '<#Work#>');
5154
52-
IF _moveWorkDefault.Execute() THEN
53-
_moveHomeDefault.Restore();
54-
END_IF
5555
5656
IF (_stopDefault.Execute()) THEN
5757
_toHomePos := FALSE;
@@ -65,6 +65,8 @@ IF (_stopDefault.Execute()) THEN
6565
_stopDefault.DoneWhen(TRUE);
6666
END_IF
6767
68+
69+
6870
// For further discussion about Status
6971
IF(_moveHomeDefault.Busy) THEN
7072
_status.ActionDescription := 'Moving to home position';
@@ -307,7 +309,9 @@ VAR
307309
_signalInfo : TcoSignalInfo;
308310
END_VAR]]></Declaration>
309311
<Implementation>
310-
<ST><![CDATA[IF (_toHomePos OR _moveHomeDefault.Busy) AND inoDisableCondition THEN
312+
<ST><![CDATA[_suspendedHome:=inoDisableCondition;
313+
314+
IF (_toHomePos OR _moveHomeDefault.Busy) AND inoDisableCondition THEN
311315
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
312316
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ' , _signalInfo.SymbolPath));
313317
_toHomePos := FALSE;
@@ -324,7 +328,9 @@ VAR_INPUT
324328
END_VAR
325329
]]></Declaration>
326330
<Implementation>
327-
<ST><![CDATA[IF (_toHomePos OR _moveHomeDefault.Busy) AND inDisableCondition THEN
331+
<ST><![CDATA[_suspendedHome:=inDisableCondition;
332+
333+
IF (_toHomePos OR _moveHomeDefault.Busy) AND inDisableCondition THEN
328334
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ' , inMessage));
329335
_toHomePos := FALSE;
330336
IF(__ISVALIDREF(THIS^.inoToHomePos)) THEN THIS^.inoToHomePos := FALSE; END_IF;
@@ -360,7 +366,9 @@ VAR
360366
_signalInfo : TcoSignalInfo;
361367
END_VAR]]></Declaration>
362368
<Implementation>
363-
<ST><![CDATA[IF (_toHomePos OR _moveHomeDefault.Busy) AND not inoDisableCondition THEN
369+
<ST><![CDATA[_suspendedHome:=inoDisableCondition;
370+
371+
IF (_toHomePos OR _moveHomeDefault.Busy) AND not inoDisableCondition THEN
364372
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
365373
Messenger.Warning(CONCAT('<#Movement suspended due to NOT#> : ' , _signalInfo.SymbolPath));
366374
_toHomePos := FALSE;
@@ -397,7 +405,8 @@ VAR
397405
_signalInfo : TcoSignalInfo;
398406
END_VAR]]></Declaration>
399407
<Implementation>
400-
<ST><![CDATA[IF (_toWorkPos OR _moveWorkDefault.Busy) AND inoDisableCondition THEN
408+
<ST><![CDATA[_suspendedWork:=inoDisableCondition;
409+
IF (_toWorkPos OR _moveWorkDefault.Busy) AND inoDisableCondition THEN
401410
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
402411
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ' , _signalInfo.SymbolPath));
403412
_toWorkPos := FALSE;
@@ -414,11 +423,15 @@ VAR_INPUT
414423
END_VAR
415424
]]></Declaration>
416425
<Implementation>
417-
<ST><![CDATA[IF (_toWorkPos OR _moveWorkDefault.Busy) AND inDisableCondition THEN
418-
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ' , inMessage));
419-
_toWorkPos := FALSE;
420-
IF(__ISVALIDREF(THIS^.inoToWorkPos)) THEN THIS^.inoToWorkPos := FALSE; END_IF;
421-
426+
<ST><![CDATA[_suspendedWork := inDisableCondition;
427+
428+
IF (_toWorkPos OR _moveWorkDefault.Busy) AND inDisableCondition THEN
429+
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ', inMessage));
430+
_toWorkPos := FALSE;
431+
IF (__ISVALIDREF(THIS^.inoToWorkPos)) THEN
432+
THIS^.inoToWorkPos := FALSE;
433+
END_IF;
434+
422435
END_IF]]></ST>
423436
</Implementation>
424437
</Method>
@@ -450,11 +463,15 @@ VAR
450463
_signalInfo : TcoSignalInfo;
451464
END_VAR]]></Declaration>
452465
<Implementation>
453-
<ST><![CDATA[IF (_toWorkPos OR _moveWorkDefault.Busy) AND not inoDisableCondition THEN
454-
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
455-
Messenger.Warning(CONCAT('<#Movement suspended due to NOT#> : ' , _signalInfo.SymbolPath));
456-
_toWorkPos := FALSE;
457-
IF(__ISVALIDREF(THIS^.inoToWorkPos)) THEN THIS^.inoToWorkPos := FALSE; END_IF;
466+
<ST><![CDATA[_suspendedWork := inoDisableCondition;
467+
468+
IF (_toWorkPos OR _moveWorkDefault.Busy) AND not inoDisableCondition THEN
469+
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
470+
Messenger.Warning(CONCAT('<#Movement suspended due to NOT#> : ', _signalInfo.SymbolPath));
471+
_toWorkPos := FALSE;
472+
IF (__ISVALIDREF(THIS^.inoToWorkPos)) THEN
473+
THIS^.inoToWorkPos := FALSE;
474+
END_IF;
458475
459476
END_IF]]></ST>
460477
</Implementation>

src/TcoPneumatics/src/XaeTcoPneumatics/TcoPneumatics/POUs/Cylinders/TcoCylinderMoveTask.TcPOU

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.10">
2+
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
33
<POU Name="TcoCylinderMoveTask" Id="{36f82742-ef83-064d-3f82-8df2b1eb7a0b}" SpecialFunc="None">
44
<Declaration><![CDATA[FUNCTION_BLOCK TcoCylinderMoveTask EXTENDS TcoCore.TcoTask
55
VAR_INPUT
66
PositionSensor : BOOL;
77
MaxTimeToReachPosition : TIME := T#10S;
88
TimeToRefill : TIME := T#100MS;
99
PositionName : STRING(25);
10+
refInverseTask: REFERENCE TO TcoCore.TcoTask;
1011
END_VAR
1112
VAR_IN_OUT
1213
MoveToPositionSignal : BOOL;
@@ -64,7 +65,9 @@ METHOD PROTECTED OnAbort
6465
<Declaration><![CDATA[METHOD PROTECTED OnStart
6566
]]></Declaration>
6667
<Implementation>
67-
<ST><![CDATA[]]></ST>
68+
<ST><![CDATA[IF __ISVALIDREF(refInverseTask) THEN
69+
refInverseTask.Restore();
70+
END_IF]]></ST>
6871
</Implementation>
6972
</Method>
7073
</POU>

0 commit comments

Comments
 (0)