Skip to content

Commit

Permalink
Hiding implementation TcoCore.TcoSequencer #32 and TcoCore.TcoState #33
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Kovac committed Apr 20, 2021
1 parent e66c830 commit c21e712
Show file tree
Hide file tree
Showing 25 changed files with 731 additions and 694 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ END_VAR
</summary>
</docu>
~*)
METHOD Main : BOOL
METHOD PROTECTED Main : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[IF Step(0,TRUE,'Send Thomas to ask Jack Woltz for granting the movie role.') THEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ END_VAR
</summary>
</docu>
~*)
METHOD Main : BOOL
METHOD PROTECTED Main : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[_components();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ END_VAR
</summary>
</docu>
~*)
METHOD Main : BOOL
METHOD PROTECTED Main : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[IF(Step(inStepID := 100,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<Itf Name="ITcoObjectRestorer" Id="{0b3638df-96b7-05c9-2091-ef8947995aad}">
<Declaration><![CDATA[INTERFACE ITcoObjectRestorer
]]></Declaration>
<Method Name="RestoreObject" Id="{1cade283-565b-0b0e-0667-0d22a5ebb137}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Ensures calling the <c>Restore()</c> method on the object entered.
<para>
<example>
<note type="Example">
<para>
Possibility to use the fluent syntax.
</para>
<code>ChangeState(newState).RestoreObject(myFirstChildObject).RestoreObject(mySecondChildObject);</code>
</note>
</example>
</para>
</summary>
</docu>
~*)
METHOD RestoreObject : ITcoObjectRestorer
VAR_INPUT
Obj : ITcoRestorable;
END_VAR
]]></Declaration>
</Method>
</Itf>
</TcPlcObject>
Original file line number Diff line number Diff line change
@@ -1,70 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<Itf Name="ITcoSequencer" Id="{a8c5aaea-ce66-4699-94d6-6fc2b0db7583}">
<Declaration><![CDATA[INTERFACE ITcoSequencer EXTENDS ITCoState
<Declaration><![CDATA[INTERFACE ITcoSequencer EXTENDS ITcoState
]]></Declaration>
<Method Name="RequestStep" Id="{a244bce3-185f-46eb-9036-dc127d26bd08}">
<Property Name="Mode" Id="{bc49d430-c9b7-0c6d-2206-7e426173182f}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Finishes the currently executed step and initiates to start the step with StepId equals to the value of the <c>inRequestedStepID</c>.
In case that the order of the requested step is higher than the order of the currently finished step (the requested step is "after" the current one)
the requested step is started in the same PLC cycle.
In case that the order of the requested step is lower than the order of the currently finished step (the requested step is "before" the current one)
the requested step is started in the next PLC cycle.
If the requested step is not found even in the next PLC cycle, the sequencer returns the error <c>StepWithRequestedIdDoesNotExists</c>.
<para>
See <see cref="eSequencerError"/> for detailed description.
</para>
</summary>
</docu>
~*)
METHOD RequestStep : ITcoSequencer
VAR_INPUT
(*~
<docu>
<summary>
StepId of the step to be executed.
</summary>
</docu>
~*)
inRequestedStepID : UINT;
END_VAR]]></Declaration>
</Method>
<Method Name="StepBackward" Id="{681ee00d-31c9-4717-8a4f-6c756dfb644e}">
<Declaration><![CDATA[(*~
<docu>
<summary>
This method triggers StepBackward task, that decrement current step (variable: <c>TcoSequencer._theOrderOfTheCurrentlyExecutedStep</c> ), in case the sequencer is in step mode, and the current step is greather than zero.
<summary>
Gets or sets sequencer mode.
<remarks>
<para>
See <see cref="eSequencerMode"/> for detailed description.
</para>
</remarks>
</summary>
</docu>
~*)
METHOD StepBackward
PROPERTY PUBLIC Mode : eSequencerMode
]]></Declaration>
</Method>
<Method Name="StepCompleteWhen" Id="{87266e09-a85e-45fc-bcc5-e3bf32501bbd}">
<Get Name="Get" Id="{218de5fd-5a3e-0996-0103-6387110463ee}">
<Declaration><![CDATA[]]></Declaration>
</Get>
<Set Name="Set" Id="{258e79ea-7624-0fec-2ee9-e4abfbe76668}">
<Declaration><![CDATA[]]></Declaration>
</Set>
</Property>
<Method Name="Run" Id="{c085653a-ddfd-0ace-0d80-e733121bd868}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Complete the actually running step, in the case the inCondition is met.
Method is typically called inside the step as the transition method.
<para>
Ensures calling the Open(), Main() and Close() methods in the desired order.
This method is final, so it cannot be overloaded. The InstanceName.Run() needs to be called cyclically inside the appropriate context.
</para>
</summary>
</docu>
~*)
METHOD PUBLIC FINAL StepCompleteWhen : ITcoSequencer
VAR_INPUT
(*~
METHOD PUBLIC FINAL Run]]></Declaration>
</Method>
<Method Name="StepBackward" Id="{a472d4af-8e1d-0a57-1b03-6f1e42dd354b}">
<Declaration><![CDATA[(*~
<docu>
<summary>
The condition under which the step is completed.
This method triggers StepBackward task, that decrements current step (variable: <c> TcoSequencer._theOrderOfTheCurrentlyExecutedStep</c> ), in case the sequencer is in step mode, and the current step is greather than zero.
</summary>
</docu>
~*)
inCondition : BOOL;
END_VAR
METHOD PUBLIC FINAL StepBackward
]]></Declaration>
</Method>
<Method Name="StepForward" Id="{e42d91dc-e4a6-4639-a3ad-03d2d977e251}">
<Method Name="StepForward" Id="{adfa3159-bea3-0d8f-0c7e-98c0f36b0b91}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Expand All @@ -73,19 +58,20 @@ END_VAR
</summary>
</docu>
~*)
METHOD StepForward
METHOD PUBLIC FINAL StepForward
]]></Declaration>
</Method>
<Method Name="StepIn" Id="{a6cd8de1-6571-4c77-9297-440aa85f6f9a}">
<Method Name="StepIn" Id="{0029d4e4-e6b3-04dd-3d60-ef3dc335a6eb}">
<Declaration><![CDATA[(*~
<docu>
<summary>
This method triggers StepIn task, that changes the current step status from ReadyToRun to Running.
Triggers StepIn task, that changes the current step status from ReadyToRun to Running.
This causes starting the execution of the body of the current step.
</summary>
</docu>
~*)
METHOD StepIn
METHOD PUBLIC FINAL StepIn
]]></Declaration>
</Method>
</Itf>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</summary>
</docu>
~*)
FUNCTION_BLOCK ABSTRACT TcoSequencer EXTENDS TcoState IMPLEMENTS ITcoSequencer
FUNCTION_BLOCK ABSTRACT TcoSequencer EXTENDS TcoStateExtendible IMPLEMENTS ITcoSequencer
VAR
(*~
<docu>
Expand Down Expand Up @@ -111,7 +111,9 @@ VAR
_stepModeControler : TcoStepModeControler(THIS^,FALSE);
{attribute 'hide'}
_checkStepIdRequestedInStepMode : BOOL;
END_VAR]]></Declaration>
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
Expand Down Expand Up @@ -176,6 +178,25 @@ IF _stepModeControler._stepIn.Done THEN
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="CompleteStep" Id="{772d43fc-5320-0adc-02b4-59560418f133}">
<Declaration><![CDATA[(*~
<docu>
<summary>
Completes the execution of the current step and moves the sequencer pointer to the next step in order of execution.
</summary>
<returns></returns>
</docu>
~*)
METHOD PROTECTED FINAL CompleteStep : ITcoObjectRestorer
]]></Declaration>
<Implementation>
<ST><![CDATA[_theOrderOfTheCurrentlyExecutedStep := _theOrderOfTheCurrentlyExecutedStep + 1;
_currentStep.Status := eStepStatus.Done;
PostStepComplete();
_stepModeControler._stepIn.DoneWhen(_stepModeControler._stepIn.Execute());
CompleteStep := THIS^;]]></ST>
</Implementation>
</Method>
<Method Name="FB_init" Id="{f2880318-c67a-0c39-0ff2-3dbccb0e13f7}">
<Declaration><![CDATA[METHOD FB_init : BOOL
VAR_INPUT
Expand Down Expand Up @@ -284,7 +305,6 @@ IF NOT _stepIdUniquenessChecked AND NOT _sequencerHasError THEN
_currentStep.Description := _message;
_currentStep.Status := eStepStatus.Error;
THIS^.Messenger.Post(_message, eMessageCategory.ProgrammingError);
// OnSequencerError(_sequencerErrorId);
_sequencerHasError := TRUE;
RETURN;
END_IF
Expand Down Expand Up @@ -330,7 +350,7 @@ END_IF
</summary>
</docu>
~*)
METHOD ABSTRACT Main : BOOL
METHOD PROTECTED ABSTRACT Main : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
Expand All @@ -349,7 +369,8 @@ METHOD ABSTRACT Main : BOOL
</summary>
</docu>
~*)
PROPERTY Mode : eSequencerMode]]></Declaration>
PROPERTY PUBLIC Mode : eSequencerMode
]]></Declaration>
<Get Name="Get" Id="{43259608-0866-0860-1707-21893efe0528}">
<Declaration><![CDATA[VAR
END_VAR
Expand Down Expand Up @@ -438,7 +459,6 @@ IF _requestStepCycle > 1 AND NOT _sequencerHasError THEN
_currentStep.Description := _message;
_currentStep.Status := eStepStatus.Error;
THIS^.Messenger.Post(_message, eMessageCategory.ProgrammingError);
// OnSequencerError(_sequencerErrorId);
_sequencerHasError := TRUE;
END_IF
Expand All @@ -462,7 +482,7 @@ END_IF]]></ST>
</summary>
</docu>
~*)
METHOD PUBLIC PostSequenceComplete
METHOD PROTECTED PostSequenceComplete
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
Expand All @@ -477,7 +497,7 @@ METHOD PUBLIC PostSequenceComplete
</summary>
</docu>
~*)
METHOD PUBLIC PostStepComplete
METHOD PROTECTED PostStepComplete
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
Expand All @@ -499,7 +519,7 @@ METHOD PUBLIC PostStepComplete
</summary>
</docu>
~*)
METHOD PUBLIC FINAL RequestStep : ITcoSequencer
METHOD PROTECTED FINAL RequestStep : ITcoSequencer
VAR_INPUT
(*~
<docu>
Expand Down Expand Up @@ -529,7 +549,6 @@ IF(inRequestedStepID <> 0) THEN
_currentStep.Description := _message;
_currentStep.Status := eStepStatus.Error;
THIS^.Messenger.Post(_message, eMessageCategory.ProgrammingError);
// OnSequencerError(_sequencerErrorId);
_sequencerHasError := TRUE;
END_IF
ELSE
Expand Down Expand Up @@ -627,7 +646,7 @@ THIS^.Close();]]></ST>
</summary>
</docu>
~*)
METHOD PUBLIC FINAL SequenceComplete
METHOD PROTECTED FINAL SequenceComplete
]]></Declaration>
<Implementation>
Expand Down Expand Up @@ -825,7 +844,6 @@ IF (_theOrderOfTheCurrentlyEvaluatedStep >= _stepCounter) AND _StepIdChanged OR
THIS^.Messenger.Post(_currentStep.Description, eMessageCategory.ProgrammingError);
_sequencerErrorId := eSequencerError.StepIdHasBeenChanged;
END_IF
// OnSequencerError(_sequencerErrorId);
_sequencerHasError := TRUE;
END_IF
Expand Down Expand Up @@ -950,7 +968,7 @@ _IdOfThePreviouslyExecutedStep := 0;
_StepTimer(IN:= FALSE);
SUPER^.ChangeState(newState);
SUPER^.ChangeStateProtected(newState);
]]></ST>
</Implementation>
</Method>
Expand All @@ -963,7 +981,7 @@ SUPER^.ChangeState(newState);
</summary>
</docu>
~*)
METHOD PUBLIC FINAL StepCompleteWhen : ITcoSequencer
METHOD PROTECTED FINAL StepCompleteWhen
VAR_INPUT
(*~
<docu>
Expand All @@ -977,17 +995,10 @@ END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF(inCondition) THEN
_theOrderOfTheCurrentlyExecutedStep := _theOrderOfTheCurrentlyExecutedStep + 1;
_currentStep.Status := eStepStatus.Done;
PostStepComplete();
_stepModeControler._stepIn.DoneWhen(_stepModeControler._stepIn.Execute());
THIS^.CompleteStep();
END_IF
StepCompleteWhen := THIS^;]]></ST>
]]></ST>
</Implementation>
</Method>
<Method Name="StepForward" Id="{94db3f77-b48c-045b-2839-79f6b0c18fbd}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ END_CASE
<Declaration><![CDATA[]]></Declaration>
<Implementation>
<ST><![CDATA[IF _EnableChangingMode THEN
SUPER^.ChangeState(Mode);
SUPER^.ChangeStateProtected(Mode);
END_IF]]></ST>
</Implementation>
</Set>
</Property>
<Method Name="OnStateChange" Id="{b7c60afe-dc93-0d5b-2752-c7f3e19a3b5e}">
<Declaration><![CDATA[METHOD PRIVATE OnStateChange
<Declaration><![CDATA[METHOD PROTECTED FINAL OnStateChange
VAR_INPUT
PreviousState : INT;
NewState : INT;
Expand Down

0 comments on commit c21e712

Please sign in to comment.