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

[NEW-FEATURE] Improve Button Behavior for Pneumatic Piston Movements #758

Merged
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
9 changes: 9 additions & 0 deletions src/TcoCore/src/TcoCore.Wpf/Properties/strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/TcoCore/src/TcoCore.Wpf/Properties/strings.cs-CZ.resx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
<data name="Status" xml:space="preserve">
<value>Stav</value>
</data>
<data name="Tasks" xml:space="preserve">
<value>Úlohy</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Áno</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions src/TcoCore/src/TcoCore.Wpf/Properties/strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
<data name="Status" xml:space="preserve">
<value>Status</value>
</data>
<data name="Tasks" xml:space="preserve">
<value>Tasks</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Yes</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions src/TcoCore/src/TcoCore.Wpf/Properties/strings.sk-Sk.resx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
<data name="Status" xml:space="preserve">
<value>Stav</value>
</data>
<data name="Tasks" xml:space="preserve">
<value>Úlohy</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Áno</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</Style.Triggers>
</Style>
</StackPanel.Resources>
<Expander IsExpanded="True"
<Expander IsExpanded="{Binding IsExpanded}"
Margin="5,0,5,0"
Background="Transparent"
materialDesign:ExpanderAssist.HorizontalHeaderPadding="0"
Expand Down Expand Up @@ -76,15 +76,17 @@

<RowDefinition />
</Grid.RowDefinitions>
<ItemsControl ItemsPanel="{StaticResource HorizontalWraped}" HorizontalAlignment="Left" ItemsSource="{Binding Tasks}">

<ItemsControl.ItemTemplate>
<DataTemplate>
<vortex:RenderableContentControl MinWidth="150" DataContext="{Binding}" Margin="5"></vortex:RenderableContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Expander Margin="5,0 " Grid.Row="2" Header="{x:Static p:strings.Details}">
<GroupBox Grid.ColumnSpan="2" Margin="10,0" Padding="10" Header="{x:Static p:strings.Tasks}" >
<ItemsControl ItemsPanel="{StaticResource HorizontalWraped}" HorizontalAlignment="Left" ItemsSource="{Binding Tasks}">

<ItemsControl.ItemTemplate>
<DataTemplate>
<vortex:RenderableContentControl MinWidth="150" DataContext="{Binding}" Margin="5"></vortex:RenderableContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GroupBox>
<Expander IsExpanded ="True" Margin="10,5 " Grid.Row="2" Header="{x:Static p:strings.Details}">

<WrapPanel Margin="10">
<WrapPanel.Resources>
Expand All @@ -109,7 +111,7 @@
<ItemsControl HorizontalAlignment="Left" ItemsSource="{Binding Components}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<vortex:RenderableContentControl MinWidth="150" DataContext="{Binding}" Margin="5"></vortex:RenderableContentControl>
<vortex:RenderableContentControl MinWidth="150" DataContext="{Binding}" Margin="5"></vortex:RenderableContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
xmlns:local="clr-namespace:TcOpen"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns:tcopneumatics="clr-namespace:TcoPneumatics"
xmlns:vortex="http://vortex.mts/xaml"
mc:Ignorable="d">
Expand All @@ -22,28 +21,34 @@
<Style TargetType="StackPanel">
<Setter Property="MinWidth" Value="200"></Setter>
</Style>
</WrapPanel.Resources>
<StackPanel>
</WrapPanel.Resources>
<StackPanel>
<Border
Height="5"
Background="{Binding _atHomePos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
CornerRadius="2" />
<vortex:RenderableContentControl DataContext="{Binding _moveHomeDefault}"/>
</StackPanel>
<Grid>
<vortex:RenderableContentControl DataContext="{Binding _moveHomeDefault}"/>
<materialDesign:PackIcon Margin="10,0" VerticalAlignment="Center" Visibility="{Binding _suspendedHome.Cyclic,Converter={vortex:BooleanToVisibilityConverter}}" Kind="WarningBox" Foreground="{StaticResource Warning}"/>
</Grid>
</StackPanel>
<StackPanel>
<Border
Height="5"
CornerRadius="2" />
<vortex:RenderableContentControl DataContext="{Binding _stopDefault, Mode=OneWay}"/>
</StackPanel>
<StackPanel>
<Border
Height="5"
Background="{Binding _atWorkPos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
CornerRadius="2" />
<vortex:RenderableContentControl DataContext="{Binding _moveWorkDefault}"/>
</StackPanel>
</WrapPanel>
<StackPanel>
<Border
Height="5"
Background="{Binding _atWorkPos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
CornerRadius="2" />
<Grid>
<vortex:RenderableContentControl DataContext="{Binding _moveWorkDefault}"/>
<materialDesign:PackIcon Margin="10,0" VerticalAlignment="Center" Visibility="{Binding _suspendedWork.Cyclic,Converter={vortex:BooleanToVisibilityConverter}}" Kind="WarningBox" Foreground="{StaticResource Warning}"/>
</Grid>
</StackPanel>
</WrapPanel>
</vortex:TcoComponentView.ComponentHeader>
<vortex:TcoComponentView.ComponentDetails >
<ScrollViewer MaxHeight="200" DataContext="{Binding Model}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
Height="5"
Background="{Binding _atHomePos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
CornerRadius="2" />
<vortex:RenderableContentControl DataContext="{Binding _moveHomeDefault}"/>
<Grid>
<vortex:RenderableContentControl DataContext="{Binding _moveHomeDefault}"/>
<materialDesign:PackIcon Margin="10,0" VerticalAlignment="Center" Visibility="{Binding _suspendedHome.Cyclic,Converter={vortex:BooleanToVisibilityConverter}}" Kind="WarningBox" Foreground="{StaticResource Warning}"/>
</Grid>
</StackPanel>
<StackPanel>
<Border
Expand All @@ -41,7 +44,10 @@
Height="5"
Background="{Binding _atWorkPos.Cyclic, Converter={vortex:SignalToBrushConverter}}"
CornerRadius="2" />
<vortex:RenderableContentControl DataContext="{Binding _moveWorkDefault}"/>
<Grid>
<vortex:RenderableContentControl DataContext="{Binding _moveWorkDefault}"/>
<materialDesign:PackIcon Margin="10,0" VerticalAlignment="Center" Visibility="{Binding _suspendedWork.Cyclic,Converter={vortex:BooleanToVisibilityConverter}}" Kind="WarningBox" Foreground="{StaticResource Warning}"/>
</Grid>
</StackPanel>
</WrapPanel>
</vortex:TcoComponentView.ComponentHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ VAR
{attribute addProperty Name "|[[1]Attribute_stopDefaultName]|"}
_stopDefault : TcoCore.TcoTask(THIS^);
increment: INT;
_suspendedHome:BOOL;
_suspendedWork:BOOL;
END_VAR
VAR
_config : TcoCylinderConfig;
Expand All @@ -21,6 +23,7 @@ VAR
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[SUPER^(inoAtHomePos := inoAtHomePos, inoAtWorkPos := inoAtWorkPos, inoToHomePos := inoToHomePos, inoToWorkPos := inoToWorkPos);


IF(_atHomePos AND _atWorkPos) THEN Messenger.Error('<#Home and work position sensors are both active. Check the position of sensors!#>'); END_IF;

Expand All @@ -32,12 +35,11 @@ _moveHomeDefault(PositionSensor := _atHomePos AND NOT _atWorkPos,
MoveToPositionSignal := _toHomePos,
InverseSignal := _toWorkPos,
TimeToRefill:=_config.TimeToRefill,
refInverseTask:=_moveWorkDefault,
MaxTimeToReachPosition := _config.TimeToReachHomePosition,
PositionName := '<#Home#>');

IF _moveHomeDefault.Execute() THEN
_moveWorkDefault.Restore();
END_IF


// Disables mutualy exclusive actions
_moveHomeDefault.Enabled := TRUE;//NOT _moveWorkDefault.Busy;
Expand All @@ -46,12 +48,10 @@ _moveWorkDefault(PositionSensor := _atWorkPos AND NOT _atHomePos,
MoveToPositionSignal := _toWorkPos,
InverseSignal := _toHomePos,
TimeToRefill:=_config.TimeToRefill,
refInverseTask:=_moveHomeDefault,
MaxTimeToReachPosition := _config.TimeToReachWorkPosition,
PositionName := '<#Work#>');

IF _moveWorkDefault.Execute() THEN
_moveHomeDefault.Restore();
END_IF

IF (_stopDefault.Execute()) THEN
_toHomePos := FALSE;
Expand All @@ -65,6 +65,8 @@ IF (_stopDefault.Execute()) THEN
_stopDefault.DoneWhen(TRUE);
END_IF



// For further discussion about Status
IF(_moveHomeDefault.Busy) THEN
_status.ActionDescription := 'Moving to home position';
Expand Down Expand Up @@ -307,7 +309,9 @@ VAR
_signalInfo : TcoSignalInfo;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[IF (_toHomePos OR _moveHomeDefault.Busy) AND inoDisableCondition THEN
<ST><![CDATA[_suspendedHome:=inoDisableCondition;

IF (_toHomePos OR _moveHomeDefault.Busy) AND inoDisableCondition THEN
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ' , _signalInfo.SymbolPath));
_toHomePos := FALSE;
Expand All @@ -324,7 +328,9 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (_toHomePos OR _moveHomeDefault.Busy) AND inDisableCondition THEN
<ST><![CDATA[_suspendedHome:=inDisableCondition;

IF (_toHomePos OR _moveHomeDefault.Busy) AND inDisableCondition THEN
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ' , inMessage));
_toHomePos := FALSE;
IF(__ISVALIDREF(THIS^.inoToHomePos)) THEN THIS^.inoToHomePos := FALSE; END_IF;
Expand Down Expand Up @@ -360,7 +366,9 @@ VAR
_signalInfo : TcoSignalInfo;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[IF (_toHomePos OR _moveHomeDefault.Busy) AND not inoDisableCondition THEN
<ST><![CDATA[_suspendedHome:=inoDisableCondition;

IF (_toHomePos OR _moveHomeDefault.Busy) AND not inoDisableCondition THEN
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
Messenger.Warning(CONCAT('<#Movement suspended due to NOT#> : ' , _signalInfo.SymbolPath));
_toHomePos := FALSE;
Expand Down Expand Up @@ -397,7 +405,8 @@ VAR
_signalInfo : TcoSignalInfo;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[IF (_toWorkPos OR _moveWorkDefault.Busy) AND inoDisableCondition THEN
<ST><![CDATA[_suspendedWork:=inoDisableCondition;
IF (_toWorkPos OR _moveWorkDefault.Busy) AND inoDisableCondition THEN
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ' , _signalInfo.SymbolPath));
_toWorkPos := FALSE;
Expand All @@ -414,11 +423,15 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (_toWorkPos OR _moveWorkDefault.Busy) AND inDisableCondition THEN
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ' , inMessage));
_toWorkPos := FALSE;
IF(__ISVALIDREF(THIS^.inoToWorkPos)) THEN THIS^.inoToWorkPos := FALSE; END_IF;

<ST><![CDATA[_suspendedWork := inDisableCondition;

IF (_toWorkPos OR _moveWorkDefault.Busy) AND inDisableCondition THEN
Messenger.Warning(CONCAT('<#Movement suspended due to#> : ', inMessage));
_toWorkPos := FALSE;
IF (__ISVALIDREF(THIS^.inoToWorkPos)) THEN
THIS^.inoToWorkPos := FALSE;
END_IF;

END_IF]]></ST>
</Implementation>
</Method>
Expand Down Expand Up @@ -450,11 +463,15 @@ VAR
_signalInfo : TcoSignalInfo;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[IF (_toWorkPos OR _moveWorkDefault.Busy) AND not inoDisableCondition THEN
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
Messenger.Warning(CONCAT('<#Movement suspended due to NOT#> : ' , _signalInfo.SymbolPath));
_toWorkPos := FALSE;
IF(__ISVALIDREF(THIS^.inoToWorkPos)) THEN THIS^.inoToWorkPos := FALSE; END_IF;
<ST><![CDATA[_suspendedWork := inoDisableCondition;

IF (_toWorkPos OR _moveWorkDefault.Busy) AND not inoDisableCondition THEN
_signalInfo.GetSignalInfo(SIZEOF(inoDisableCondition), ADR(inoDisableCondition));
Messenger.Warning(CONCAT('<#Movement suspended due to NOT#> : ', _signalInfo.SymbolPath));
_toWorkPos := FALSE;
IF (__ISVALIDREF(THIS^.inoToWorkPos)) THEN
THIS^.inoToWorkPos := FALSE;
END_IF;

END_IF]]></ST>
</Implementation>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.10">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<POU Name="TcoCylinderMoveTask" Id="{36f82742-ef83-064d-3f82-8df2b1eb7a0b}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK TcoCylinderMoveTask EXTENDS TcoCore.TcoTask
VAR_INPUT
PositionSensor : BOOL;
MaxTimeToReachPosition : TIME := T#10S;
TimeToRefill : TIME := T#100MS;
PositionName : STRING(25);
refInverseTask: REFERENCE TO TcoCore.TcoTask;
END_VAR
VAR_IN_OUT
MoveToPositionSignal : BOOL;
Expand Down Expand Up @@ -64,7 +65,9 @@ METHOD PROTECTED OnAbort
<Declaration><![CDATA[METHOD PROTECTED OnStart
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
<ST><![CDATA[IF __ISVALIDREF(refInverseTask) THEN
refInverseTask.Restore();
END_IF]]></ST>
</Implementation>
</Method>
</POU>
Expand Down
Loading
Loading