Skip to content

Commit

Permalink
[QUESTION] Suspend task should be optional (default should not allow …
Browse files Browse the repository at this point in the history
…the suspending) (#267)

* Create draft PR for #256

* again paths, paths and paths.... :(

* again paths, paths and paths.... :(

* messenger and logger optimization
- messenger now reduces the number of items need to be read from the controller by gouping message status into a single variable.
- logger now limits the reading of the messages to caret counter.

* performance improvements
- replaces context checks using simple expression

* test fix where improper context mock implementation

* adjust template.simple config + additions

* adjust template.simple config + additions

* _axoContext

* THIS._context_ in inherrited object to _context_

* THIS.GetContext() work in tasks with property _context_

* seq, axotask, axoobj

* sequncer init steps

* getContextUnsafe()

* ignore

* adjusts to lates AX# update

* cylinder init when context is nulll

* task execute optimalization

* cylinder init fix

* axo task inline

* axo task clean up

* updates to AX# 0.15.0-alpha.159

* messanger on conditition

* AxoCylinder optimize

* axo task status

* fix axotask

* sequencer optimalization

* sequncer cast

* var for opencycle count

* step inline calls

* fixing axostep

* AxoCylinder initialize only with AxoObject

* investigation for cylinder speed up

* wip for synch

* axo dataman performance opt.

-10% on cyclic calls

* AxoDataman - go back

* axodatatman optimized just object init

* axocomponent inlining

* AxoInsight optimalization - init of objects

* axo messanger inline optimalization

* fix cylinder app

* serve clean

* sets dotnet to 7.0.402

* updates ax# packages and remover -L due to apax 2

* fix an issue with string interpolation in remote task

* [wip] improvements to messaging add new UI

* nesting depth reduction in data

* nesting depth redution in inspectors

* template simple refactoring

* various asps

* additional fixies to axomessenger

* asp

* fixes an issue in log dequeue missing await

* fix some issues with data in template.simple

* additional visual improvement on AxoComponent and AxoMessenger details

* various template.simple additions

* add remote data handling for starer unit

* optimalization in Digital and Analog signals

* adds guiding feature to templates

* asp

* Create draft PR for #262

* Add Draggable project, with all component for draggable items

* Add readme

* Using mongo repo

* mono ref in twin, init repo on server side

* add proj ref to server app

* entityData, UnitHeader, estations

* unit process data

* snippets

* Changes in Draggable - added more customizing option. Updated readme

* context initialize entity repository

* unit template razor fix

* template service fix

* repository extension

* code tour

* split settings and data

* Unit tour

* added technology data on plc side

* try to fix tech data

* fix unit template service init

* fix tour

* fix template services

* tech settings to navigation menu

* technology data view

* starter unit technology data

* technology data in ground and auto seq

* fix technology data in template.simple

* Rename to VisualComposer.
Presentation options changed.

* add visual composer to template

* Unit object in unit

* UnitObject as a public class

- issue with accessibility on .net side

* Components member fix in Unit

* UnitTemplate - init repositories, naming

* checks for apax.yml existence in dirs

* Create draft PR for #222

* disable paralel build

* Abbility to abort task remotely disabled by default

* asp

---------

Co-authored-by: PTKu <[email protected]>
Co-authored-by: Peter <[email protected]>
Co-authored-by: blazej.kuhajda <[email protected]>
Co-authored-by: Lukas Kytka <[email protected]>
Co-authored-by: Brano5 <[email protected]>
Co-authored-by: Branko Zachemsky <[email protected]>
Co-authored-by: TomKovac <[email protected]>
Co-authored-by: TK <[email protected]>
  • Loading branch information
9 people authored Nov 10, 2023
1 parent 110828c commit 91a62ed
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 18 deletions.
2 changes: 1 addition & 1 deletion scripts/test_L1.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# run build

dotnet run --project cake/Build.csproj --do-test --test-level 1
dotnet run --project cake/Build.csproj --do-test --test-level 1 -x
exit $LASTEXITCODE;
6 changes: 3 additions & 3 deletions src/components.drives/app/ix-blazor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

Entry.Plc.Connector.SubscriptionMode = ReadSubscriptionMode.Polling;
Entry.Plc.Connector.BuildAndStart().ReadWriteCycleDelay = 250;
Entry.Plc.Connector.ConcurrentRequestMaxCount = 4;
Entry.Plc.Connector.ConcurrentRequestDelay = 100;
Entry.Plc.Connector.ConcurrentRequestMaxCount = 4;
Entry.Plc.Connector.ConcurrentRequestDelay = 100;
Entry.Plc.Connector.SetLoggerConfiguration(new LoggerConfiguration()
.WriteTo
.Console()
Expand Down Expand Up @@ -105,4 +105,4 @@ public static List<Role> CreateRoles()
public const string process_settings_access = nameof(process_settings_access);
public const string process_traceability_access = nameof(process_traceability_access);
public const string can_skip_steps_in_sequence = nameof(can_skip_steps_in_sequence);
}
}
76 changes: 74 additions & 2 deletions src/core/ctrl/src/AxoTask/AxoTask.st
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ NAMESPACE AXOpen.Core
{#ix-set:Help = "<#Check task calling in the code, task is called more then once.#>"}
_MultipleExecuteIsCalled : AXOpen.Messaging.Static.AxoMessenger;
_SuspendMultipleExecuteCallCheck : BOOL := FALSE;
_RemoteRestoreEnabled : BOOL := TRUE;
_RemoteAbortEnabled : BOOL := FALSE;
END_VAR

///<summary>
Expand Down Expand Up @@ -417,8 +419,16 @@ NAMESPACE AXOpen.Core

IF(_context_ = NULL) THEN RETURN; END_IF;
IF( RemoteInvoke) THEN THIS.Invoke(); RemoteInvoke := FALSE; END_IF;
IF( RemoteRestore) THEN THIS.Restore(); RemoteRestore := FALSE; END_IF;
IF( RemoteAbort) THEN THIS.Abort(); RemoteAbort := FALSE; END_IF;
IF _RemoteRestoreEnabled THEN
IF( RemoteRestore) THEN THIS.Restore(); RemoteRestore := FALSE; END_IF;
ELSE
RemoteRestore := FALSE;
END_IF;
IF _RemoteAbortEnabled THEN
IF( RemoteAbort ) THEN THIS.Abort(); RemoteAbort := FALSE; END_IF;
ELSE
RemoteAbort := FALSE;
END_IF;
IF( RemoteResume) THEN THIS.Resume(); RemoteResume := FALSE; END_IF;

_MultipleExecuteIsCalled.Serve(THIS);
Expand All @@ -431,6 +441,7 @@ NAMESPACE AXOpen.Core
END_IF;
END_IF;
_openCycleCountExecute := _openCycleCount;


// If the Invoke() method was called in more then one PLC cycle back without calling the Execute() method
// and the Execute() is subsequently called without calling the Invoke() method in the same PLC cycle,
Expand Down Expand Up @@ -479,6 +490,7 @@ NAMESPACE AXOpen.Core
END_IF;
END_IF;
THIS.UpdateState();
Execute := Status = eAxoTaskState#Busy;
_taskTimer.OnDelay(THIS, Execute, LT#99999D);
Expand Down Expand Up @@ -570,6 +582,66 @@ NAMESPACE AXOpen.Core
END_IF;
END_METHOD
///<summary>
/// Sets the remote restore functionality based on the provided input.
/// Enables or disables remote restoration based on the value of the 'Enable' parameter.
///</summary>
///<param name="Enable">A boolean value indicating whether remote restore functionality should be enabled (TRUE) or disabled (FALSE).</param>
///<remarks>
/// This method allows dynamic control over the ability to perform remote restoration tasks.
/// When enabled, remote restoration functionality is activated, allowing tasks to be restored remotely.
/// When disabled, remote restoration functionality is deactivated, preventing tasks from being restored remotely.
///</remarks>
METHOD PUBLIC SetRemoteRestoreEnabled
VAR_INPUT
Enable : BOOL; // Input parameter to enable or disable remote restore.
END_VAR
_RemoteRestoreEnabled := Enable; // Assign the input value to the variable.
END_METHOD
///<summary>
/// Retrieves the current status of remote restore functionality.
///</summary>
///<returns>A boolean value indicating whether remote restore functionality is enabled (TRUE) or disabled (FALSE).</returns>
///<remarks>
/// This method provides the current status of remote restore functionality.
/// It returns TRUE if remote restoration is enabled, allowing tasks to be restored remotely.
/// It returns FALSE if remote restoration is disabled, preventing tasks from being restored remotely.
///</remarks>
METHOD PUBLIC GetRemoteRestoreEnabled : BOOL
GetRemoteRestoreEnabled := _RemoteRestoreEnabled; // Returns the current status of remote restore functionality.
END_METHOD
///<summary>
/// Sets the remote abort functionality based on the provided input.
/// Enables or disables remote abort based on the value of the 'Enable' parameter.
///</summary>
///<param name="Enable">A boolean value indicating whether remote abort functionality should be enabled (TRUE) or disabled (FALSE).</param>
///<remarks>
/// This method allows dynamic control over the ability to perform remote abort tasks.
/// When enabled, remote abort functionality is activated, allowing tasks to be aborted remotely.
/// When disabled, remote abort functionality is deactivated, preventing tasks from being aborted remotely.
///</remarks>
METHOD PUBLIC SetRemoteAbortEnabled
VAR_INPUT
Enable : BOOL; // Input parameter to enable or disable remote abort.
END_VAR
_RemoteAbortEnabled := Enable; // Assign the input value to the variable.
END_METHOD
///<summary>
/// Retrieves the current status of remote abort functionality.
///</summary>
///<returns>A boolean value indicating whether remote abort functionality is enabled (TRUE) or disabled (FALSE).</returns>
///<remarks>
/// This method provides the current status of remote abort functionality.
/// It returns TRUE if remote abort is enabled, allowing tasks to be aborted remotely.
/// It returns FALSE if remote abort is disabled, preventing tasks from being aborted remotely.
///</remarks>
METHOD PUBLIC GetRemoteAbortEnabled : BOOL
GetRemoteAbortEnabled := _RemoteAbortEnabled; // Returns the current status of remote abort functionality.
END_METHOD
///<summary>
/// Executes once when the task is aborted.
///</summary>
Expand Down
90 changes: 90 additions & 0 deletions src/core/ctrl/test/AxoTask/AxoTaskTests.st
Original file line number Diff line number Diff line change
Expand Up @@ -897,5 +897,95 @@ NAMESPACE AXOpen.Core.AxoTask_Tests
// Act/Assert
Assert.Equal(FALSE, myTask.GetSuspendMultipleExecuteCallCheckState());
END_METHOD
{Test}
METHOD PUBLIC task_should_stay_at_busy_state_and_remote_abort_signal_should_be_reseted_as_the_abbility_to_abort_task_is_disabled_by_default
THIS.Initialize();
_context.Open();
myTask.Invoke();
myTask.Execute();
myTask.RemoteAbort := TRUE;
_context.Close();

THIS.Initialize();
_context.Open();
myTask.Invoke();
myTask.Execute();
Assert.Equal(TRUE,myTask.IsBusy());
Assert.Equal(FALSE,myTask.RemoteAbort);
Assert.Equal(FALSE,myTask.GetRemoteAbortEnabled());
END_METHOD

{Test}
METHOD PUBLIC task_should_be_aborted
THIS.Initialize();
_context.Open();
myTask.Invoke();
myTask.Execute();
myTask.SetRemoteAbortEnabled(TRUE);
myTask.RemoteAbort := TRUE;
_context.Close();

THIS.Initialize();
_context.Open();
myTask.Invoke();
myTask.Execute();
Assert.Equal(TRUE,myTask.IsAborted());
Assert.Equal(FALSE,myTask.RemoteAbort);
Assert.Equal(TRUE,myTask.GetRemoteAbortEnabled());
END_METHOD

{Test}
METHOD PUBLIC task_should_be_restored
THIS.Initialize();
_context.Open();
myTask.Invoke();
myTask.Execute();
myTask.RemoteRestore := TRUE;
_context.Close();

THIS.Initialize();
_context.Open();
myTask.Invoke();
myTask.Execute();
Assert.Equal(FALSE,myTask.IsBusy());
Assert.Equal(TRUE,myTask.IsReady());
Assert.Equal(FALSE,myTask.RemoteAbort);
Assert.Equal(TRUE,myTask.GetRemoteRestoreEnabled());
END_METHOD

{Test}
METHOD PUBLIC task_should_not_be_restored_as_the_remote_restore_is_disabled
THIS.Initialize();
_context.Open();
myTask.Invoke();
myTask.Execute();
myTask.SetRemoteRestoreEnabled(FALSE);
myTask.RemoteRestore := TRUE;
_context.Close();

THIS.Initialize();
_context.Open();
myTask.Invoke();
myTask.Execute();
Assert.Equal(TRUE,myTask.IsBusy());
Assert.Equal(FALSE,myTask.IsReady());
Assert.Equal(FALSE,myTask.RemoteAbort);
Assert.Equal(FALSE,myTask.GetRemoteRestoreEnabled());
END_METHOD

{Test}
METHOD PUBLIC task_should_not_be_remotely_abortable_by_default
THIS.Initialize();
_context.Open();
Assert.Equal(FALSE,myTask.GetRemoteAbortEnabled());
END_METHOD

{Test}
METHOD PUBLIC task_should_be_remotely_restorable_by_default
THIS.Initialize();
_context.Open();
Assert.Equal(TRUE,myTask.GetRemoteRestoreEnabled());
// Assert.Equal(TRUE,FALSE);
END_METHOD
END_CLASS
END_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Serilog;
using AXSharp.Presentation.Blazor.Controls.RenderableContent;
using System.Collections.Generic;
using AXOpen.ToolBox.Extensions;

namespace AXOpen.Core
{
Expand Down
12 changes: 0 additions & 12 deletions src/core/src/AXOpen.Core/Flattener.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using AXOpen.Core
@using AXOpen.Core.Blazor.Culture
@using AXOpen.Messaging.Static
@using AXOpen.ToolBox.Extensions
@inherits RenderableComplexComponentBase<AXSharp.Connector.ITwinObject>


Expand Down

0 comments on commit 91a62ed

Please sign in to comment.