Skip to content

Commit

Permalink
#28 sStepforward, stepbackward restore call after reaching done state
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Kovac committed Apr 17, 2021
1 parent 5c16c46 commit 25c68db
Show file tree
Hide file tree
Showing 16 changed files with 341 additions and 124 deletions.
1 change: 1 addition & 0 deletions Examples.Webinar3.0
Submodule Examples.Webinar3.0 added at 708661
305 changes: 216 additions & 89 deletions TcOpen.sln

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<Namespace>Tc3_Module</Namespace>
</PlaceholderReference>
<PlaceholderReference Include="TcoCore">
<DefaultResolution>TcoCore, 0.1.0.217 (Vortex.Library)</DefaultResolution>
<DefaultResolution>TcoCore, 0.4.0.217 (Vortex.Library)</DefaultResolution>
<Namespace>TcoCore</Namespace>
</PlaceholderReference>
<PlaceholderReference Include="TcoPneumatics">
Expand All @@ -125,7 +125,7 @@
</ItemGroup>
<ItemGroup>
<PlaceholderResolution Include="TcoCore">
<Resolution>TcoCore, 0.1.0.217 (Vortex.Library)</Resolution>
<Resolution>TcoCore, 0.4.0.217 (Vortex.Library)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="TcoPneumatics">
<Resolution>TcoPneumatics, 0.1.0.217 (Vortex.Library)</Resolution>
Expand Down
6 changes: 3 additions & 3 deletions src/TcoCore/src/TcoCoreConnector/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Reflection;

[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0-init-dev.1+217.Branch.init-dev.Sha.8106cc8e723ce3612a1d08c4766c322c45e6cfeb")]
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: AssemblyInformationalVersion("0.4.0-init-dev.1+217.Branch.init-dev.Sha.8106cc8e723ce3612a1d08c4766c322c45e6cfeb")]



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@
<data name="___Invoke_request__" xml:space="preserve">
<value>Invoke request</value>
</data>
<data name="___Enabled__" xml:space="preserve">
<value>Enabled</value>
</data>
<data name="___Step_ID__" xml:space="preserve">
<value>Step ID</value>
</data>
<data name="___Step_Order__" xml:space="preserve">
<value>Step Order</value>
</data>
<data name="___Enabled__" xml:space="preserve">
<value>Enabled</value>
</data>
<data name="___Step_description__" xml:space="preserve">
<value>Step description</value>
</data>
Expand Down
60 changes: 60 additions & 0 deletions src/TcoCore/src/TcoCoreConnector/pex/TcoTask/TcoTask.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace TcoCore
{
public partial class TcoTask : ICommand,INotifyPropertyChanged
{

private bool isEnabled;
public event PropertyChangedEventHandler PropertyChanged;
public event EventHandler CanExecuteChanged;


private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}

public bool IsEnabled
{
get
{
isEnabled = this._enabled.Synchron;
NotifyPropertyChanged();
return isEnabled;
}
set
{
if (value != this.isEnabled)
{
this.isEnabled = value;
NotifyPropertyChanged();
}
}
}


public bool CanExecute(object parameter)
{
//return IsEnabled;
return true;
}

public void Execute(object parameter)
{
this._invokeRequest.Synchron = true;
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,10 @@ END_IF
// Cycle time measurement
_cycleTimer(IN:= TRUE, PT:= T#48D40H62M47S295MS);
_SequenceElapsedTime := _cycleTimer.ET;
// Step changed
IF(_theOrderOfTheCurrentlyExecutedStep <> _theOrderOfThePreviouslyExecutedStep) THEN
// Step changed in cyclic mode
_stepModeActive := _stepModeControler.Mode = eSequencerMode.StepMode;
IF(_theOrderOfTheCurrentlyExecutedStep <> _theOrderOfThePreviouslyExecutedStep) AND NOT _stepModeActive THEN
_theOrderOfThePreviouslyExecutedStep := _theOrderOfTheCurrentlyExecutedStep;
StepChanged(inStepID);
END_IF;
Expand All @@ -741,37 +743,41 @@ IF(_requestStepActive) THEN
END_IF
// STEP MODE COORDINATION
_stepModeActive := _stepModeControler.Mode = eSequencerMode.StepMode;
_stepInExecuting := _stepModeControler._stepIn.Busy;
_stepModeControler._stepForward.Execute();
_stepModeControler._stepBackward.Execute();
_stepModeControler._stepIn.Execute();
_stepModeControler(inCurrentStepRunning := _currentStep.Status = eStepStatus.Running);
IF(_stepModeActive) THEN
// StepForward
IF _stepModeControler._stepForward.Execute() THEN
_stepModeControler._stepIn.Restore();
_stepModeControler._stepBackward.Restore();
IF _theOrderOfTheCurrentlyExecutedStep < _numberOfStepsInSequence THEN
_theOrderOfTheCurrentlyExecutedStep := _theOrderOfTheCurrentlyExecutedStep + 1;
_stepModeControler._stepForward.DoneWhen(TRUE);
_stepModeControler._stepIn.Restore();
ELSE
_stepModeControler._stepForward.Restore();
END_IF
END_IF
// Step Backward
IF _stepModeControler._stepBackward.Execute() THEN
_stepModeControler._stepIn.Restore();
_stepModeControler._stepForward.Restore();
IF _theOrderOfTheCurrentlyExecutedStep > 0 THEN
_theOrderOfTheCurrentlyExecutedStep := _theOrderOfTheCurrentlyExecutedStep - 1;
_stepModeControler._stepBackward.DoneWhen(TRUE);
_stepModeControler._stepIn.Restore();
ELSE
_stepModeControler._stepForward.Restore();
END_IF
END_IF
END_IF
END_IF;
IF(_stepModeControler._stepForward.Done) THEN
_stepModeControler._stepForward.Restore();
END_IF
IF(_stepModeControler._stepBackward.Done) THEN
_stepModeControler._stepBackward.Restore();
END_IF
// Determine the step is in order of execution
_isInOrderOfExecution := (_theOrderOfTheCurrentlyExecutedStep =_theOrderOfTheCurrentlyEvaluatedStep);
Expand Down Expand Up @@ -843,7 +849,8 @@ IF(_isInOrderOfExecution) THEN
IF NOT inEnabled THEN
_currentStep.Status := eStepStatus.Disabled;
END_IF
_stepInExecuting := _stepModeControler._stepIn.Busy;
IF(NOT inEnabled AND NOT _stepInExecuting AND NOT _stepModeActive) THEN
_theOrderOfTheCurrentlyExecutedStep := _theOrderOfTheCurrentlyExecutedStep + 1;
END_IF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ VAR
_stepForward : TcoTask(THIS^);
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
<ST><![CDATA[THIS^._stepBackward.Enabled := THIS^.Mode = eSequencerMode.StepMode;
THIS^._stepIn.Enabled := THIS^.Mode = eSequencerMode.StepMode;
THIS^._stepForward.Enabled := THIS^.Mode = eSequencerMode.StepMode;
]]></ST>
</Implementation>
<Property Name="Mode" Id="{8d4cb1af-ba19-0bb8-1400-30d988d71fba}">
<Declaration><![CDATA[(*~
Expand Down Expand Up @@ -65,6 +68,7 @@ END_VAR
_stepIn.Restore();
IF inCurrentStepRunning THEN
_stepIn.Enabled := TRUE;
_stepIn.Invoke();
END_IF
END_IF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ VAR
~*)
{attribute addProperty Name "<#Invoke request#>"}
_invokeRequest : BOOL;
{attribute 'hide'}
(*~
<docu>
<summary>
Use to determine if the task execution is enabled for example from the HMI application.
This value is read only, to modify it use the property <see cref="TcoTask.PlcTcoTask.Enabled()"/>
</summary>
</docu>
~*)
{attribute addProperty Name "<#Enabled#>"}
{attribute clr [ReadOnly()]}
_enabled : BOOL := TRUE;
END_VAR]]></Declaration>
<Implementation>
Expand Down
2 changes: 1 addition & 1 deletion src/TcoCore/src/XaeTcoCore/TcoCore/TcoCore.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Company>Vortex.Library</Company>
<Released>false</Released>
<Title>TcoCore</Title>
<ProjectVersion>0.1.0.217</ProjectVersion>
<ProjectVersion>0.4.0.217</ProjectVersion>
<DefaultNamespace>TcoCore</DefaultNamespace>
<Placeholder>TcoCore</Placeholder>
<Author>Inxton</Author>
Expand Down
5 changes: 2 additions & 3 deletions src/TcoCore/src/XaeTcoCore/TcoCoreExamples/POUs/MAIN.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="MAIN" Id="{a7bd41fd-8dbf-4e6f-8b13-73b5ce6425f6}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM MAIN
VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[EXAMPLES_PRG();
MANIPULATOR();]]></ST>
MANIPULATOR();
]]></ST>
</Implementation>
</POU>
</TcPlcObject>
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@
<Namespace>Tc3_Module</Namespace>
</PlaceholderReference>
<PlaceholderReference Include="TcoCore">
<DefaultResolution>TcoCore, 0.1.0.217 (Vortex.Library)</DefaultResolution>
<DefaultResolution>TcoCore, 0.4.0.217 (Vortex.Library)</DefaultResolution>
<Namespace>TcoCore</Namespace>
</PlaceholderReference>
<PlaceholderReference Include="TcoPneumatics">
<DefaultResolution>TcoPneumatics, * (Vortex.Library)</DefaultResolution>
<Namespace>TcoPneumatics</Namespace>
</PlaceholderReference>
</ItemGroup>
<ItemGroup>
<None Include="TcoCoreExamples.tmc">
Expand All @@ -127,7 +131,7 @@
</ItemGroup>
<ItemGroup>
<PlaceholderResolution Include="TcoCore">
<Resolution>TcoCore, 0.1.0.217 (Vortex.Library)</Resolution>
<Resolution>TcoCore, 0.4.0.217 (Vortex.Library)</Resolution>
</PlaceholderResolution>
</ItemGroup>
<ProjectExtensions>
Expand Down
4 changes: 2 additions & 2 deletions src/TcoCore/src/XaeTcoCore/TcoCoreTests/TcoCoreTests.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<Namespace>Tc3_Module</Namespace>
</PlaceholderReference>
<PlaceholderReference Include="TcoCore">
<DefaultResolution>TcoCore, 0.1.0.217 (Vortex.Library)</DefaultResolution>
<DefaultResolution>TcoCore, 0.4.0.217 (Vortex.Library)</DefaultResolution>
<Namespace>TcoCore</Namespace>
</PlaceholderReference>
</ItemGroup>
Expand All @@ -113,7 +113,7 @@
</ItemGroup>
<ItemGroup>
<PlaceholderResolution Include="TcoCore">
<Resolution>TcoCore, 0.1.0.217 (Vortex.Library)</Resolution>
<Resolution>TcoCore, 0.4.0.217 (Vortex.Library)</Resolution>
</PlaceholderResolution>
</ItemGroup>
<ProjectExtensions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3540,8 +3540,11 @@ public void T693_SwitchStepModeStepForwardFromRunningStep()
plcCycle = 0;
tc.SequencerRunUntilEndConditionIsMet(action: () => //After execution of this method, actual StepId should have value of 3
{ //StepDescription should have value of "(>Step 3<)" and step status should be ReadyToRun
if(plcCycle== 0)
{
tc.StepForward();
}
plcCycle++;
tc.StepForward();
if (tc.Step(0, true, "Initial step")) { }
if (tc.Step(1, true, "Step 1")) { }
if (tc.Step(2, true, "Step 2"))
Expand Down Expand Up @@ -3611,8 +3614,11 @@ public void T695_SwitchStepModeStepBackwardFromRunningStep()
plcCycle = 0;
tc.SequencerRunUntilEndConditionIsMet(action: () => //After execution of this method, actual StepId should have value of 2
{ //StepDescription should have value of "(>Step 2<)" and step status should be ReadyToRun
if(plcCycle==0)
{
tc.StepBackward();
}
plcCycle++;
tc.StepBackward();
if (tc.Step(0, true, "Initial step")) { }
if (tc.Step(1, true, "Step 1")) { }
if (tc.Step(2, true, "Step 2"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<Namespace>Tc3_Module</Namespace>
</PlaceholderReference>
<PlaceholderReference Include="TcoCore">
<DefaultResolution>TcoCore, 0.1.0.217 (Vortex.Library)</DefaultResolution>
<DefaultResolution>TcoCore, 0.4.0.217 (Vortex.Library)</DefaultResolution>
<Namespace>TcoCore</Namespace>
</PlaceholderReference>
</ItemGroup>
Expand All @@ -66,7 +66,7 @@
</ItemGroup>
<ItemGroup>
<PlaceholderResolution Include="TcoCore">
<Resolution>TcoCore, 0.1.0.217 (Vortex.Library)</Resolution>
<Resolution>TcoCore, 0.4.0.217 (Vortex.Library)</Resolution>
</PlaceholderResolution>
</ItemGroup>
<ProjectExtensions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<Namespace>Tc3_Module</Namespace>
</PlaceholderReference>
<PlaceholderReference Include="TcoCore">
<DefaultResolution>TcoCore, 0.1.0.217 (Vortex.Library)</DefaultResolution>
<DefaultResolution>TcoCore, 0.4.0.217 (Vortex.Library)</DefaultResolution>
<Namespace>TcoCore</Namespace>
</PlaceholderReference>
<PlaceholderReference Include="TcoPneumatics">
Expand All @@ -73,7 +73,7 @@
</ItemGroup>
<ItemGroup>
<PlaceholderResolution Include="TcoCore">
<Resolution>TcoCore, 0.1.0.217 (Vortex.Library)</Resolution>
<Resolution>TcoCore, 0.4.0.217 (Vortex.Library)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="TcoPneumatics">
<Resolution>TcoPneumatics, 0.1.0.217 (Vortex.Library)</Resolution>
Expand Down

0 comments on commit 25c68db

Please sign in to comment.