diff --git a/build_docu.ps1 b/build_docu.ps1 index d98c25c63..e280b5f18 100644 --- a/build_docu.ps1 +++ b/build_docu.ps1 @@ -1,4 +1,4 @@ # dotnet run --project ..\ix\src\ix.compiler\src\ixd\Ix.ixd.csproj --framework net7.0 -x .\src\core\ctrl\ -o .\docfx\apictrl\ -dotnet ixd -x .\src\abstractions\ctrl .\src\data\ctrl\ .\src\core\ctrl -o .\docfx\apictrl\ +dotnet ixd -x .\src\abstractions\ctrl .\src\data\ctrl\ .\src\core\ctrl .\src\inspectors\ctrl -o .\docfx\apictrl\ dotnet docfx .\docfx\docfx.json --debug dotnet docfx serve .\docs\ diff --git a/cake/BuildContext.cs b/cake/BuildContext.cs index 205548e30..0e00672c1 100644 --- a/cake/BuildContext.cs +++ b/cake/BuildContext.cs @@ -144,6 +144,7 @@ public BuildContext(ICakeContext context, BuildParameters buildParameters) ("core", "axopen.core"), ("data", "axopen.data"), ("probers", "axopen.probers"), + ("inspectors", "axopen.inspectors"), ("components.abstractions", "axopen.components.abstractions"), ("components.cognex.vision", "axopen.cognex.vision"), }; diff --git a/docfx/articles/inspectors/AXOANALOGUEINSPECTOR.md b/docfx/articles/inspectors/AXOANALOGUEINSPECTOR.md new file mode 100644 index 000000000..233501ebf --- /dev/null +++ b/docfx/articles/inspectors/AXOANALOGUEINSPECTOR.md @@ -0,0 +1,16 @@ +## AxoAnalogueInspector + +Provides evaluation of *continuous* values. The inspector checks that the input value falls within the limit of *Min* and *Max*. The inspection passes when the input value is within the required limit without interruption for the duration of stabilization time. + +![Analog inspector](~/images/analog-inspector.png) + + +Common inspector data are extended with following analogue inspector data: + +```C# +RequiredMin : LREAL; // min required value for inspection + +DetectedStatus : LREAL; // detected value + +RequiredMax: LREAL; // max required value for inspection +``` \ No newline at end of file diff --git a/docfx/articles/inspectors/AXODATAINSPECTOR.md b/docfx/articles/inspectors/AXODATAINSPECTOR.md new file mode 100644 index 000000000..60c05428b --- /dev/null +++ b/docfx/articles/inspectors/AXODATAINSPECTOR.md @@ -0,0 +1,16 @@ +## AxoDataInspector + +Provides evaluation of alphanumerical values. The input value compares against the Required value. The inspection passes when the input value matches the required value without interruption for the duration of stabilization time. In addition to exact comparison, data inspector allows for simple pattern matching where # = any number and * = any character. + +![Data inspector](~/images/data-inspector.png) + +Common inspector data are extended with following data inspector data: + +```C# +RequiredStatus : STRING; //required value for inspection + +DetectedStatus : STRING; //detected value for inspection + +StarNotationEnabled: BOOL; //star notation enable/disable + +``` \ No newline at end of file diff --git a/docfx/articles/inspectors/AXODIGITALINSPECTOR.md b/docfx/articles/inspectors/AXODIGITALINSPECTOR.md new file mode 100644 index 000000000..031a27595 --- /dev/null +++ b/docfx/articles/inspectors/AXODIGITALINSPECTOR.md @@ -0,0 +1,13 @@ +## AxoDigitalInspector + +Inspector provides evaluation of *discrete* value. The input value compares against the *Required* value. The inspection passes when the input value matches the required value without interruption for the duration of stabilization time. + +![Digital inspector](~/images/digital-inspector.png) + +Common inspector data are extended with following digital inspector data: + +```C# +RequiredStatus : BOOL; //required value for inspection + +DetectedStatus : BOOL; //detected value for inspection +``` \ No newline at end of file diff --git a/docfx/articles/inspectors/README.md b/docfx/articles/inspectors/README.md new file mode 100644 index 000000000..070728221 --- /dev/null +++ b/docfx/articles/inspectors/README.md @@ -0,0 +1,114 @@ +# **AXOpen.Inspectors** + +**AXOpen.Inspectors** provides mechanism of inspection of different types of data. The input value is compared to required value. If input value is the same as required value for a *stabilization* time period, the inspection will succeed. If values are different, *timeout* will occur and inspection will fail. + +Inspectors can integrate with coordination primitives like [AxoSequencer](../core/AXOSEQUENCER.md). In consequence, inspectors offer extended capabilities in decision flow for failed checks. + +Each inspector contains: + +1. `Inspect` method, which input is current parent and inspection variable +2. `OnFail` method, which provides methods for making a decision after a failed inspection (see Handling failure section) +3. `UpdateComprehensiveResult` method, which input is object of type `AxoComprehesiveResult`, which can be used to gather results of all inspections. + +4. `Common data` about inspection inputs and result. See below. + +## Example inspection +Example of inspection within a sequencer in PLC: +``` + _presenceInspector.WithCoordinator(THIS).Inspect(THIS,_inspectionResult) + .UpdateComprehensiveResult(_comprehensiveResult) + .OnFail().CarryOn(); +``` + +1. A _presenceInspector is created instance of `AxoDigitalInspector` + +2. A coordinator is passed to this inspector with `WithCoordinator(THIS)` method, in this case it is a sequencer, a parent object. +3. `Inspect` methods takes parent and inspection variable, on which inspection is performing. +4. If inspection fails, the result is updated to `_comprehensiveResult` object with `UpdateComprehensiveResult` method. +5. If inspection fails, `OnFail` method provides `CarryOn` method, which tells the coordinator to continue in execution. + +## Common inspector data + +Inspectors contain common data, which are used to store data about inspection. Each inspector contain following data: + +```C# +Timestamp: LDATE_AND_TIME; // timestamp of inspection + +PassTime : TIME; // stabilization time, inspection must be success for this period of time + +FailTime : TIME; // timeout, after which inspection fails + +Result : eInspectorResult; // result of inspection + +IsExcluded: BOOL; // inspection will be performed, however result will be omitted in overall result + +IsByPassed : BOOL; // inspection will be skipped + +NumberOfAllowedRetries : UINT; // maximum number of retries of inspection, from which overinspection will occur + +RetryAttemptsCount : UINT; // actual number of retries, if RetryAttemptsCount > NumberOfAllowedRetries, overinspection occurs + +``` + + + +[!INCLUDE [AxoDigitalInspector](AXODIGITALINSPECTOR.md)] + +[!INCLUDE [AxoAnalogueInspector](AXOANALOGUEINSPECTOR.md)] + +[!INCLUDE [AxoDataInspector](AXODATAINSPECTOR.md)] + + + +## Handling failure + +When an inspector fails, OnFail() provides a series of methods for making decisions about the process. In order for this is feature to work the inspector needs to be aware of the coordinator of `IAxoCoordinator`. The coordinator must be passed to the inspector by `WithCoordinator(coordinator)` method. + + +| Syntax | Description | +| ----------- | ----------- | +| Dialog(inRetryStep, inTerminateStep) | Opens dialog for the user to take a decision. Parameter `inRetryStep` represent state from which the inspection should start again. Parameter `inTerminateStep` represent terminate state of coordinator. | +| Retry(inRetryStep) | Retries the inspector. Retry state parameter tells from which state the inspection should start again. | +| Override() | Marks the inspection as failed but continues with the following states of the coordinator. | +| Terminate(inTerminateStep) | Marks the inspection as failed and aborts the execution of the coordinator. | + +The following example specify, that when inspection fails, dialog is shown and is requesting user decision. + +``` + _valueInspector.WithCoordinator(THIS).Inspect(THIS,_inspectionValue).OnFail().Dialog(Steps[20], Steps[145]); +``` + +![Inspection failure](~/images/inspection-failure-dialog.png) + +## Over-inspection +When `RetryAttemptsCount` is same as `NumberOfAllowedRetries`, no more inspection are allowed, as data are overinspected. + +![Overinspected](~/images/overinspected.png) + + +## Preserving overall result + +Overall result of a series of inspections can be preserved in `AxoComprehensiveResult`. Each inspector has `UpdateComprehensiveResult` method that provides the update function. Once the `UpdateComprehensiveResult` marks the overall result as Failed, successive inspection will not overwrite the result. + +``` + +IF (Steps[30].Execute(THIS, TRUE, 'Example Digital inspection')) THEN + + _presenceInspector.WithCoordinator(THIS).Inspect(THIS,_inspectionResult) + .UpdateComprehensiveResult(_comprehensiveResult) + .OnFail().CarryOn(); + + END_IF; + + IF (Steps[40].Execute(THIS, TRUE, 'Example Analog inspection')) THEN + + _valueInspector.WithCoordinator(THIS).Inspect(THIS,_inspectionValue) + .UpdateComprehensiveResult(_comprehensiveResult) + .OnFail().CarryOn(); + + END_IF; + + +END_IF; +``` + diff --git a/docfx/articles/toc.yml b/docfx/articles/toc.yml index e0f379480..5d2ebe8dc 100644 --- a/docfx/articles/toc.yml +++ b/docfx/articles/toc.yml @@ -36,6 +36,16 @@ href: ~/articles/data/AxoDataExchange.md - name: Data fragmets exchange href: ~/articles/data/AxoDataFragmentExchange.md + +- name: AXOpen.Inspectors + href: ~/articles/inspectors/README.md + items: + - name: AxoDigitalInspector + href: ~/articles/inspectors/AXODIGITALINSPECTOR.md + - name: AxoAnalogueInspector + href: ~/articles/inspectors/AXOANALOGUEINSPECTOR.md + - name: AxoDataInspector + href: ~/articles/inspectors/AXODATAINSPECTOR.md - name: AXOpen.Messaging href: ~/articles/messaging/README.md items: diff --git a/docfx/images/analog-inspector.png b/docfx/images/analog-inspector.png new file mode 100644 index 000000000..64ff0e65d Binary files /dev/null and b/docfx/images/analog-inspector.png differ diff --git a/docfx/images/data-inspector.png b/docfx/images/data-inspector.png new file mode 100644 index 000000000..1d599e30b Binary files /dev/null and b/docfx/images/data-inspector.png differ diff --git a/docfx/images/digital-inspector.png b/docfx/images/digital-inspector.png new file mode 100644 index 000000000..2ba874d00 Binary files /dev/null and b/docfx/images/digital-inspector.png differ diff --git a/docfx/images/inspection-failure-dialog.png b/docfx/images/inspection-failure-dialog.png new file mode 100644 index 000000000..db45c7b48 Binary files /dev/null and b/docfx/images/inspection-failure-dialog.png differ diff --git a/docfx/images/overinspected.png b/docfx/images/overinspected.png new file mode 100644 index 000000000..a61c38fc6 Binary files /dev/null and b/docfx/images/overinspected.png differ diff --git a/docs/articles/timers/OFFDELAYTIMER.html b/docs/articles/timers/OFFDELAYTIMER.html new file mode 100644 index 000000000..c15067870 --- /dev/null +++ b/docs/articles/timers/OFFDELAYTIMER.html @@ -0,0 +1,165 @@ + + + + + + + + AxOpen.Timers.OffDelayTimer | System.Dynamic.ExpandoObject + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+ +
+
Search Results for
+
+

+
+
    +
    +
    + + + +
    + + + + + + + + diff --git a/docs/articles/timers/ONDELAYTIMER.html b/docs/articles/timers/ONDELAYTIMER.html new file mode 100644 index 000000000..4390ac63c --- /dev/null +++ b/docs/articles/timers/ONDELAYTIMER.html @@ -0,0 +1,165 @@ + + + + + + + + AxOpen.Timers.OnDelayTimer | System.Dynamic.ExpandoObject + + + + + + + + + + + + + + + + +
    +
    + + + + +
    +
    + +
    +
    Search Results for
    +
    +

    +
    +
      +
      +
      + + + +
      + + + + + + + + diff --git a/docs/articles/timers/PULSETIMER.html b/docs/articles/timers/PULSETIMER.html new file mode 100644 index 000000000..2ec188795 --- /dev/null +++ b/docs/articles/timers/PULSETIMER.html @@ -0,0 +1,165 @@ + + + + + + + + AxOpen.Timers.PulseTimer | System.Dynamic.ExpandoObject + + + + + + + + + + + + + + + + +
      +
      + + + + +
      +
      + +
      +
      Search Results for
      +
      +

      +
      +
        +
        +
        + + + +
        + + + + + + + + diff --git a/docs/articles/timers/README.html b/docs/articles/timers/README.html new file mode 100644 index 000000000..e969cbc4f --- /dev/null +++ b/docs/articles/timers/README.html @@ -0,0 +1,244 @@ + + + + + + + + AXOpen.Timers | System.Dynamic.ExpandoObject + + + + + + + + + + + + + + + + +
        +
        + + + + +
        +
        + +
        +
        Search Results for
        +
        +

        +
        +
          +
          +
          + + + +
          + + + + + + + + diff --git a/src/AXOpen.sln b/src/AXOpen.sln index 4de56e4e4..d089199ba 100644 --- a/src/AXOpen.sln +++ b/src/AXOpen.sln @@ -155,6 +155,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "clientchat", "clientchat", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "clientchat", "clientchat\clientchat.csproj", "{B3B2A1D3-A1A5-443A-975F-C44F7C2648E6}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "inspectors", "inspectors", "{E644E81B-36C4-44B3-837F-AC1DDDB609C5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6B847420-D488-4E16-B599-14F7558EBD66}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{ACDBA197-69BA-49E9-9624-DC7B912E4C3D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxOpen.Inspectors.Blazor", "inspectors\src\AxOpen.Inspectors.Blazor\AxOpen.Inspectors.Blazor.csproj", "{6A796A98-F570-4F35-B46B-177B4C0178DC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_inspectors", "inspectors\src\AxOpen.Inspectors\ix_ax_axopen_inspectors.csproj", "{358D781D-BE42-4298-A60F-BE0358B5B405}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -309,6 +319,14 @@ Global {B3B2A1D3-A1A5-443A-975F-C44F7C2648E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {B3B2A1D3-A1A5-443A-975F-C44F7C2648E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {B3B2A1D3-A1A5-443A-975F-C44F7C2648E6}.Release|Any CPU.Build.0 = Release|Any CPU + {6A796A98-F570-4F35-B46B-177B4C0178DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6A796A98-F570-4F35-B46B-177B4C0178DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6A796A98-F570-4F35-B46B-177B4C0178DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6A796A98-F570-4F35-B46B-177B4C0178DC}.Release|Any CPU.Build.0 = Release|Any CPU + {358D781D-BE42-4298-A60F-BE0358B5B405}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {358D781D-BE42-4298-A60F-BE0358B5B405}.Debug|Any CPU.Build.0 = Debug|Any CPU + {358D781D-BE42-4298-A60F-BE0358B5B405}.Release|Any CPU.ActiveCfg = Release|Any CPU + {358D781D-BE42-4298-A60F-BE0358B5B405}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -373,6 +391,10 @@ Global {4D4B57A7-55C4-4AE2-8991-250937389412} = {7A82F34B-A479-47D4-8FB6-F9A66FE6591A} {D3094A68-880C-4637-8F90-6034951E141B} = {E2BFDC17-38C1-43AD-9CB5-4FA440D2DEEA} {B3B2A1D3-A1A5-443A-975F-C44F7C2648E6} = {FEF28A3F-E141-4492-8055-3B21A1BDDAAB} + {6B847420-D488-4E16-B599-14F7558EBD66} = {E644E81B-36C4-44B3-837F-AC1DDDB609C5} + {ACDBA197-69BA-49E9-9624-DC7B912E4C3D} = {E644E81B-36C4-44B3-837F-AC1DDDB609C5} + {6A796A98-F570-4F35-B46B-177B4C0178DC} = {6B847420-D488-4E16-B599-14F7558EBD66} + {358D781D-BE42-4298-A60F-BE0358B5B405} = {6B847420-D488-4E16-B599-14F7558EBD66} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {292B45BE-E9CB-443B-979D-C0AFCD8D5675} diff --git a/src/core/ctrl/src/AxoCoordination/AxoSequencer/AxoSequencer.st b/src/core/ctrl/src/AxoCoordination/AxoSequencer/AxoSequencer.st index 86561467e..21c7cd045 100644 --- a/src/core/ctrl/src/AxoCoordination/AxoSequencer/AxoSequencer.st +++ b/src/core/ctrl/src/AxoCoordination/AxoSequencer/AxoSequencer.st @@ -160,6 +160,8 @@ NAMESPACE AXOpen.Core END_IF; END_METHOD + + /// /// Terminates the currently executed step and initiates the RequestedStep to be executed /// diff --git a/src/core/ctrl/src/abstractions/AxoCoordination/IAxoCoordinator.st b/src/core/ctrl/src/abstractions/AxoCoordination/IAxoCoordinator.st index aa36855f0..5577bd7d1 100644 --- a/src/core/ctrl/src/abstractions/AxoCoordination/IAxoCoordinator.st +++ b/src/core/ctrl/src/abstractions/AxoCoordination/IAxoCoordinator.st @@ -1,5 +1,17 @@ NAMESPACE AXOpen.Core INTERFACE IAxoCoordinator EXTENDS IAxoObject METHOD GetCoordinatorState : AxoCoordinatorStates END_METHOD + + + METHOD MoveNext + END_METHOD + + METHOD RequestStep + VAR_INPUT + RequestedStep : IAxoStep; + END_VAR + END_METHOD + + END_INTERFACE END_NAMESPACE diff --git a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogBaseView.cs b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogBaseView.cs index 5144ad8b0..c4ea83c8d 100644 --- a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogBaseView.cs +++ b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogBaseView.cs @@ -24,9 +24,12 @@ public partial class AxoDialogBaseView : RenderableComplexComponentBase w public override void AddToPolling(ITwinElement element, int pollingInterval = 250) { - var task = (AxoDialog)element; + var task = (AxoDialogBase)element; var kids = task.GetValueTags().ToList(); + //var task1 = (AxoDialog)element; + //var kids1 = task.GetValueTags().ToList(); + kids.ForEach(p => { diff --git a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor index 48e2e27a5..7977603bd 100644 --- a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor +++ b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor @@ -1,7 +1,6 @@ @namespace AXOpen.Core @using AXOpen.Core.Blazor.AxoDialogs; @using AXOpen.Dialogs; -@using Microsoft.JSInterop; @inject NavigationManager _navigationManager @inherits AxoDialogBaseView @inject AuthenticationStateProvider _asp diff --git a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor.cs b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor.cs index ea799b996..650a78a5c 100644 --- a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor.cs +++ b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogDialogView/AxoDialogDialogView.razor.cs @@ -22,6 +22,7 @@ protected override void OnInitialized() base.OnInitialized(); } + // experimental stuff for external closings private async void OnCloseSignal(object sender, EventArgs e) { if (Component._closeSignal.Cyclic) @@ -57,8 +58,6 @@ public override void Dispose() { base.Dispose(); Component._answer.ValueChangeEvent -= OnCloseSignal; - _dialogContainer.DialogClient.MessageReceivedDialogClose -= OnCloseDialogMessage; - _dialogContainer.DialogClient.MessageReceivedDialogOpen -= OnOpenDialogMessage; } } } diff --git a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogLocator.razor.cs b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogLocator.razor.cs index 7ffb88105..50eab5a5a 100644 --- a/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogLocator.razor.cs +++ b/src/core/src/AXOpen.Core.Blazor/AxoDialogs/AxoDialogLocator.razor.cs @@ -74,8 +74,11 @@ private async void OnDialogInvoked(object? sender, AxoDialogEventArgs e) /// public void Dispose() { - _axoDialogProxyService.DialogInvoked -= OnDialogInvoked; - _axoDialogProxyService.Dispose(); + if (_axoDialogProxyService != null) + { + _axoDialogProxyService.DialogInvoked -= OnDialogInvoked; + _axoDialogProxyService.Dispose(); + } } } } diff --git a/src/core/src/AXOpen.Core.Blazor/axopen_core_blazor.csproj b/src/core/src/AXOpen.Core.Blazor/axopen_core_blazor.csproj index 19590bf3a..85b921c43 100644 --- a/src/core/src/AXOpen.Core.Blazor/axopen_core_blazor.csproj +++ b/src/core/src/AXOpen.Core.Blazor/axopen_core_blazor.csproj @@ -32,7 +32,6 @@ - diff --git a/src/data/src/AXOpen.Data.Blazor/axopen_data_blazor.csproj b/src/data/src/AXOpen.Data.Blazor/axopen_data_blazor.csproj index 86333dd80..815f40913 100644 --- a/src/data/src/AXOpen.Data.Blazor/axopen_data_blazor.csproj +++ b/src/data/src/AXOpen.Data.Blazor/axopen_data_blazor.csproj @@ -30,8 +30,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/src/inspectors/ctrl/.gitignore b/src/inspectors/ctrl/.gitignore new file mode 100644 index 000000000..0228acd94 --- /dev/null +++ b/src/inspectors/ctrl/.gitignore @@ -0,0 +1,8 @@ +.apax +.env +bin + +obj +testresult + +*.apax.tgz diff --git a/src/inspectors/ctrl/.npmrc b/src/inspectors/ctrl/.npmrc new file mode 100644 index 000000000..72534ba37 --- /dev/null +++ b/src/inspectors/ctrl/.npmrc @@ -0,0 +1 @@ +@ix-ax:registry=https://npm.pkg.github.com \ No newline at end of file diff --git a/src/inspectors/ctrl/AXSharp.config.json b/src/inspectors/ctrl/AXSharp.config.json new file mode 100644 index 000000000..da8b5f062 --- /dev/null +++ b/src/inspectors/ctrl/AXSharp.config.json @@ -0,0 +1 @@ +{"OutputProjectFolder":"..\\src\\AXOpen.Inspectors"} \ No newline at end of file diff --git a/src/inspectors/ctrl/apax.yml b/src/inspectors/ctrl/apax.yml new file mode 100644 index 000000000..4aa8b8e42 --- /dev/null +++ b/src/inspectors/ctrl/apax.yml @@ -0,0 +1,17 @@ +name: "@ix-ax/axopen.inspectors" +version: '0.1.4-alpha.79' +type: lib +targets: + - axunit-llvm + - llvm +files: + - src +devDependencies: + "@ax/sdk": ^4.0.3 +scripts: + postbuild: + - dotnet ixc +dependencies: + "@ax/system-timer": ^4.0.1 + "@ix-ax/axopen.core": '0.1.4-alpha.79' + "@ix-ax/axopen.simatic1500": '0.1.4-alpha.79' diff --git a/src/inspectors/ctrl/dw.ps1 b/src/inspectors/ctrl/dw.ps1 new file mode 100644 index 000000000..d7c96dc7c --- /dev/null +++ b/src/inspectors/ctrl/dw.ps1 @@ -0,0 +1,3 @@ +apax install +apax build +apax sld --accept-security-disclaimer -t 192.168.0.1 -i .\bin\1500\ \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoAnalogueInspector/AxoAnalogueInspector.st b/src/inspectors/ctrl/src/AxoAnalogueInspector/AxoAnalogueInspector.st new file mode 100644 index 000000000..01bbb831c --- /dev/null +++ b/src/inspectors/ctrl/src/AxoAnalogueInspector/AxoAnalogueInspector.st @@ -0,0 +1,123 @@ +NAMESPACE AXOpen.Inspectors + + + + /// + /// Class representing inspection of value within an interval. + /// + CLASS AxoAnalogueInspector EXTENDS AxoInspector IMPLEMENTS IAxoAnalogueInspector + + VAR PUBLIC + {#ix-set:AttributeName = "<#Inspector data#>"} + _data : AxoAnalogueInspectorData; + // result data of inspection + {#ix-attr:[RenderIgnore()]} + _lastOutValue : LREAL; + END_VAR + + + /// + /// Inspection method, which contains main logic of inspection. + /// + METHOD PUBLIC Inspect : IInspector + VAR_INPUT + _parent : AXOpen.Core.IAxoObject; + Status : LREAL; + END_VAR + + VAR + tmpResult : BOOL; + _minimum : LREAL; + _value : LREAL; + _maximum : LREAL; + END_VAR + + VAR CONSTANT + epsilon : REAL := 10000; + END_VAR + + THIS.Initialize(_parent); + _inspectorTask.Initialize(_parent); + + //return this instance + Inspect := THIS; + + // pass address of data to set an inspection data + _inspectorTask.SetInspectionData(REF(_data)); + + //check for overinspection + IF(THIS.IsOverInspected())THEN + RETURN; + END_IF; + + //initialize and invoke inspector task + _inspectorTask.Invoke(); + + //do inspection + IF (_inspectorTask.Execute()) THEN + IF (_data.IsByPassed) THEN + _data.Result := eInspectorResult#Bypassed; + _data.TimeStamp := THIS.GetContext().GetRtc().NowUTC(); + _inspectorTask.DoneWhen(TRUE); + RETURN; + END_IF; + + _data.Result := eInspectorResult#Running; + + _minimum := (_data.RequiredMin * epsilon); + _value := (Status * epsilon); + _maximum := (_data.RequiredMax * epsilon); + + _data.DetectedStatus := Status; + + tmpResult := (_minimum <= _value) AND (_maximum >= _value); + + IF(NOT tmpResult) THEN + _lastOutValue := Status; + END_IF; + + _inspectorTask._failTimer(TRUE, _data.FailTime); + _inspectorTask._passTimer(tmpResult, _data.PassTime); + + IF(_inspectorTask._passTimer.output OR _inspectorTask._failTimer.output) THEN + _inspectorTask.DoneWhen(TRUE); + THIS.OnDone(); + END_IF; + + END_IF; + END_METHOD + + /// + /// Set coordinator to this instance + /// + METHOD PUBLIC WithCoordinator : IAxoAnalogueInspector + VAR_INPUT + inCoordinator : AXOpen.Core.IAxoCoordinator; + END_VAR + + _coordinator := inCoordinator; + THIS._WithCoordinator(inCoordinator); + + WithCoordinator := THIS; + END_METHOD + + /// + /// If inspection fails, set result to data + /// + METHOD OnDone + IF (_data.Result = eInspectorResult#Failed) THEN + _data.DetectedStatus := _lastOutValue; + END_IF; + END_METHOD + + /// + /// Set coordinator to this instance + /// + METHOD PUBLIC Data : REF_TO AxoAnalogueInspectorData + + Data := REF(_data); + END_METHOD + +END_CLASS + + END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoAnalogueInspector/AxoAnalogueInspectorData.st b/src/inspectors/ctrl/src/AxoAnalogueInspector/AxoAnalogueInspectorData.st new file mode 100644 index 000000000..426715761 --- /dev/null +++ b/src/inspectors/ctrl/src/AxoAnalogueInspector/AxoAnalogueInspectorData.st @@ -0,0 +1,24 @@ +NAMESPACE AXOpen.Inspectors + + /// + /// Data subjected to each analogue inspector instance. + /// + CLASS AxoAnalogueInspectorData EXTENDS AxoInspectorData + + VAR PUBLIC + + {#ix-set:AttributeName = "<#Min#>"} + RequiredMin : LREAL; + + {#ix-set:AttributeName = "<#Detected#>"} + DetectedStatus : LREAL; + + {#ix-set:AttributeName = "<#Max#>"} + RequiredMax: LREAL; + + END_VAR + + END_CLASS + + +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoAnalogueInspector/IAxoAnalogueInspector.st b/src/inspectors/ctrl/src/AxoAnalogueInspector/IAxoAnalogueInspector.st new file mode 100644 index 000000000..2b95e0113 --- /dev/null +++ b/src/inspectors/ctrl/src/AxoAnalogueInspector/IAxoAnalogueInspector.st @@ -0,0 +1,13 @@ +USING AXOpen.Core; +NAMESPACE AXOpen.Inspectors + INTERFACE IAxoAnalogueInspector + + METHOD Inspect : IInspector + VAR_INPUT + _parent: IAxoObject; + Status : LREAL; + END_VAR + END_METHOD + + END_INTERFACE +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoComprehensiveResult.st b/src/inspectors/ctrl/src/AxoComprehensiveResult.st new file mode 100644 index 000000000..b6621d562 --- /dev/null +++ b/src/inspectors/ctrl/src/AxoComprehensiveResult.st @@ -0,0 +1,49 @@ +NAMESPACE AXOpen.Inspectors + + CLASS AxoComprehensiveResult IMPLEMENTS IAxoComprehensiveResult + VAR PUBLIC + + Result : eOverallResult; + Failures : STRING; + ErrorCodes : STRING; + + END_VAR + + + METHOD PUBLIC GetResult : eOverallResult + GetResult := Result; + END_METHOD + + METHOD PUBLIC GetFailures : STRING + GetFailures := Failures; + END_METHOD + + METHOD PUBLIC GetErrorCodes : STRING + GetErrorCodes := ErrorCodes; + END_METHOD + + METHOD PUBLIC SetResult + VAR_INPUT + inResult : eOverallResult; + END_VAR + Result := inResult; + END_METHOD + + METHOD PUBLIC SetFailures + VAR_INPUT + inFailures : STRING; + END_VAR + Failures := inFailures; + END_METHOD + + METHOD PUBLIC SetErrorCodes + VAR_INPUT + inErrorCodes : STRING; + END_VAR + + ErrorCodes := inErrorCodes; + END_METHOD + END_CLASS + + +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoDataInspector/AxoDataInspector.st b/src/inspectors/ctrl/src/AxoDataInspector/AxoDataInspector.st new file mode 100644 index 000000000..3da60c5fd --- /dev/null +++ b/src/inspectors/ctrl/src/AxoDataInspector/AxoDataInspector.st @@ -0,0 +1,180 @@ +USING System.Strings; + +NAMESPACE AXOpen.Inspectors + + /// + /// Class representing inspection of string value with support of star notation. + /// + CLASS AxoDataInspector EXTENDS AxoInspector IMPLEMENTS IAxoDataInspector + + VAR PUBLIC + {#ix-set:AttributeName = "<#Inspector data#>"} + _data : AxoDataInspectorData; + // result data of inspection + {#ix-attr:[RenderIgnore()]} + _lastOutValue : STRING; + END_VAR + + + /// + /// Inspection method, which contains main logic of inspection. + /// + METHOD PUBLIC Inspect : IInspector + VAR_INPUT + _parent : AXOpen.Core.IAxoObject; + Status : STRING; + + END_VAR + + VAR + tmpResult : BOOL; + charIndex: DINT; + charRequired : CHAR; + charAcquired : CHAR; + END_VAR + + VAR CONSTANT + epsilon : REAL := 1; + END_VAR + + THIS.Initialize(_parent); + _inspectorTask.Initialize(_parent); + + //return this instance + Inspect := THIS; + + // pass address of data to set an inspection data + _inspectorTask.SetInspectionData(REF(_data)); + + //check for overinspection + IF(THIS.IsOverInspected())THEN + RETURN; + END_IF; + + //initialize and invoke inspector task + _inspectorTask.Invoke(); + + + //do inspection + IF (_inspectorTask.Execute()) THEN + IF (_data.IsByPassed) THEN + _data.Result := eInspectorResult#Bypassed; + _data.TimeStamp := THIS.GetContext().GetRtc().NowUTC(); + _inspectorTask.DoneWhen(TRUE); + RETURN; + END_IF; + + _data.Result := eInspectorResult#Running; + + _data.DetectedStatus := Status; + + // if star notation is enabled, comparison by chars is needed + IF(_data.StarNotationEnabled) THEN + tmpResult := TRUE; + // iterate throug the string + FOR charIndex := DINT#1 TO LengthOf(_data.RequiredStatus) DO + + //get char from required string + charRequired := _data.RequiredStatus[charIndex]; + + + //get char from detected string, only if is within a range + IF(LengthOf(_data.DetectedStatus) >= charIndex) THEN + charAcquired := _data.DetectedStatus[charIndex]; + END_IF; + + //if it's not wild card, compare chars + IF(charRequired <> '*' AND charRequired <> '#') THEN + tmpResult := charRequired = charAcquired; + ELSIF(charRequired = '#') THEN + // if is # wildcard, check for number + tmpResult := THIS.IsCharNumber(charAcquired); + END_IF; + + // if tmpResult is false, we know that string are not the same, therefore exit + IF(NOT tmpResult) THEN + EXIT; + END_IF; + END_FOR; + ELSE + //TODO what about spaces at the beginning and the end? + tmpResult := _data.DetectedStatus = _data.RequiredStatus; + END_IF; + + IF(NOT tmpResult) THEN + _lastOutValue := Status; + END_IF; + + _inspectorTask._failTimer(TRUE, _data.FailTime); + _inspectorTask._passTimer(tmpResult, _data.PassTime); + + IF(_inspectorTask._passTimer.output OR _inspectorTask._failTimer.output) THEN + _inspectorTask.DoneWhen(TRUE); + THIS.OnDone(); + END_IF; + END_IF; + END_METHOD + + /// + /// Set coordinator to this instance + /// + METHOD PUBLIC WithCoordinator : IAxoDataInspector + VAR_INPUT + inCoordinator : AXOpen.Core.IAxoCoordinator; + END_VAR + + _coordinator := inCoordinator; + THIS._WithCoordinator(inCoordinator); + + WithCoordinator := THIS; + END_METHOD + + /// + /// If inspection fails, set result to data + /// + METHOD OnDone + IF (_data.Result = eInspectorResult#Failed) THEN + _data.DetectedStatus := _lastOutValue; + END_IF; + END_METHOD + + + /// + /// Check, if character is a number + /// + METHOD IsCharNumber : BOOL + + VAR_INPUT + inCharacter: CHAR; + END_VAR + IF (inCharacter = '0' + OR inCharacter = '1' + OR inCharacter = '2' + OR inCharacter = '3' + OR inCharacter = '4' + OR inCharacter = '5' + OR inCharacter = '6' + OR inCharacter = '7' + OR inCharacter = '8' + OR inCharacter = '9') + THEN + IsCharNumber := TRUE; + RETURN; + END_IF; + + IsCharNumber := FALSE; + END_METHOD + + /// + /// Set coordinator to this instance + /// + METHOD PUBLIC Data : REF_TO AxoDataInspectorData + + Data := REF(_data); + END_METHOD + + + +END_CLASS + + END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoDataInspector/AxoDataInspectorData.st b/src/inspectors/ctrl/src/AxoDataInspector/AxoDataInspectorData.st new file mode 100644 index 000000000..973a0802f --- /dev/null +++ b/src/inspectors/ctrl/src/AxoDataInspector/AxoDataInspectorData.st @@ -0,0 +1,24 @@ +NAMESPACE AXOpen.Inspectors + + /// + /// Data subjected to each data inspector instance. + /// + CLASS AxoDataInspectorData EXTENDS AxoInspectorData + + VAR PUBLIC + + {#ix-set:AttributeName = "<#Required#>"} + RequiredStatus: STRING; + + {#ix-set:AttributeName = "<#Detected#>"} + DetectedStatus : STRING; + + {#ix-set:AttributeName = "<#Star notation#>"} + StarNotationEnabled: BOOL; + + END_VAR + + END_CLASS + + +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoDataInspector/IAxoDataInspector.st b/src/inspectors/ctrl/src/AxoDataInspector/IAxoDataInspector.st new file mode 100644 index 000000000..fdce0b871 --- /dev/null +++ b/src/inspectors/ctrl/src/AxoDataInspector/IAxoDataInspector.st @@ -0,0 +1,13 @@ +USING AXOpen.Core; +NAMESPACE AXOpen.Inspectors + INTERFACE IAxoDataInspector + + METHOD Inspect : IInspector + VAR_INPUT + _parent: IAxoObject; + Status : STRING; + END_VAR + END_METHOD + + END_INTERFACE +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoDigitalInspector/AxoDigitalInspector.st b/src/inspectors/ctrl/src/AxoDigitalInspector/AxoDigitalInspector.st new file mode 100644 index 000000000..d6c6d72c1 --- /dev/null +++ b/src/inspectors/ctrl/src/AxoDigitalInspector/AxoDigitalInspector.st @@ -0,0 +1,110 @@ +NAMESPACE AXOpen.Inspectors + +/// +/// Class representing inspection of bool value. +/// +CLASS AxoDigitalInspector EXTENDS AxoInspector IMPLEMENTS IAxoDigitalInspector + + VAR PUBLIC + {#ix-set:AttributeName = "<#Inspector data#>"} + _data : AxoDigitalInspectorData; + END_VAR + + /// + /// Inspection method, which contains main logic of inspection. + /// + METHOD PUBLIC Inspect : IInspector + VAR_INPUT + _parent: AXOpen.Core.IAxoObject; + Status : BOOL; + END_VAR + + THIS.Initialize(_parent); + _inspectorTask.Initialize(_parent); + + //return this instance + Inspect := THIS; + + + // set task inspection data, pass a reference (an address) + // REF(_data) will get a reference of _data variable (like & in C) + _inspectorTask.SetInspectionData(REF(_data)); + + + //here i should check, if data are overinspected + IF(THIS.IsOverInspected()) THEN + RETURN; + END_IF; + + //invoke inspection task + _inspectorTask.Invoke(); + + //execute inspection task + IF (_inspectorTask.Execute()) THEN + + // if data are bypassed, skip inspection + IF (_data.IsByPassed) THEN + + _data.Result := eInspectorResult#Bypassed; + + _data.TimeStamp := THIS.GetContext().GetRtc().NowUTC(); + + _inspectorTask.DoneWhen(TRUE); + RETURN; + END_IF; + + + //set timers + _data.Result := eInspectorResult#Running; + _inspectorTask._failTimer(TRUE, _data.FailTime); + _inspectorTask._passTimer(Status = _data.RequiredStatus, _data.PassTime); + + _data.DetectedStatus := Status; + + // if any timer is satisfied, end inspection + IF(_inspectorTask._failTimer.output OR _inspectorTask._passTimer.output) THEN + _inspectorTask.DoneWhen(TRUE); + THIS.OnDone(); + + END_IF; + END_IF; + + + END_METHOD + + /// + /// If inspection fails, set result to data + /// + METHOD OnDone + IF (_data.Result = eInspectorResult#Failed) THEN + _data.DetectedStatus := NOT _data.RequiredStatus; + END_IF; + END_METHOD + + /// + /// Set coordinator to this instance + /// + METHOD PUBLIC WithCoordinator : IAxoDigitalInspector + VAR_INPUT + inCoordinator : AXOpen.Core.IAxoCoordinator; + END_VAR + + _coordinator := inCoordinator; + THIS._WithCoordinator(inCoordinator); + + WithCoordinator := THIS; + END_METHOD + + + /// + /// Set coordinator to this instance + /// + METHOD PUBLIC Data : REF_TO AxoDigitalInspectorData + + Data := REF(_data); + END_METHOD + + +END_CLASS + +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoDigitalInspector/AxoDigitalInspectorData.st b/src/inspectors/ctrl/src/AxoDigitalInspector/AxoDigitalInspectorData.st new file mode 100644 index 000000000..032dc0a9b --- /dev/null +++ b/src/inspectors/ctrl/src/AxoDigitalInspector/AxoDigitalInspectorData.st @@ -0,0 +1,22 @@ +NAMESPACE AXOpen.Inspectors + + /// + /// Data subjected to each digital inspector instance. + /// + CLASS AxoDigitalInspectorData EXTENDS AxoInspectorData + + VAR PUBLIC + + {#ix-set:AttributeName = "<#Required#>"} + RequiredStatus : BOOL; + + {#ix-set:AttributeName = "<#Detected#>"} + DetectedStatus : BOOL; + + + END_VAR + + END_CLASS + + +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoDigitalInspector/IAxoDigitalInspector.st b/src/inspectors/ctrl/src/AxoDigitalInspector/IAxoDigitalInspector.st new file mode 100644 index 000000000..314480f13 --- /dev/null +++ b/src/inspectors/ctrl/src/AxoDigitalInspector/IAxoDigitalInspector.st @@ -0,0 +1,13 @@ +USING AXOpen.Core; +NAMESPACE AXOpen.Inspectors + INTERFACE IAxoDigitalInspector + + METHOD Inspect : IInspector + VAR_INPUT + _parent: IAxoObject; + Status : BOOL; + END_VAR + END_METHOD + + END_INTERFACE +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoInspector.st b/src/inspectors/ctrl/src/AxoInspector.st new file mode 100644 index 000000000..d666303df --- /dev/null +++ b/src/inspectors/ctrl/src/AxoInspector.st @@ -0,0 +1,240 @@ +USING AXOpen.Core; + +NAMESPACE AXOpen.Inspectors + + /// + /// AxoInspector base class with implemented evaluation methods + /// Evaluation methods need IAxoCoordinator instance + /// + CLASS AxoInspector EXTENDS AXOpen.Core.AxoObject IMPLEMENTS IInspector, IOnFail + + + VAR PUBLIC + _axoInspectorDialog : AxoInspectorDialog; + END_VAR + VAR + _inspectorTask: AxoInspectorTask; + _coordinator: IAxoCoordinator; + _isOverInspected: BOOL; + _busy : BOOL; + _commonData: REF_TO AxoInspectorData; + _originalOverallResult : IAxoComprehensiveResult; + + END_VAR + + + /// + /// Check, if data are overinspected (attempts of inspections is larger than maximum number of allowed retries) + /// + METHOD PUBLIC CheckOverInspection : BOOL + //check if reference is valid + IF _inspectorTask.InspectionData() <> NULL THEN + CheckOverInspection := (_inspectorTask.InspectionData()^.RetryAttemptsCount >= _inspectorTask.InspectionData()^.NumberOfAllowedRetries) + AND (_inspectorTask.InspectionData()^.NumberOfAllowedRetries <> UINT#0); + END_IF; + END_METHOD + + + /// + /// Gets `true` when this inspection overruns max number of inspections. + /// + METHOD PROTECTED IsOverInspected : BOOL + + _isOverInspected := THIS.CheckOverInspection(); + IF(THIS.CheckOverInspection()) THEN + _inspectorTask.Invoke(); + IF(_inspectorTask.Execute()) THEN + _inspectorTask.InspectionData()^.Result := eInspectorResult#Failed; + _inspectorTask.DoneWhen(TRUE); + END_IF; + END_IF; + + IsOverinspected := THIS.CheckOverInspection(); + END_METHOD + + + /// + /// Set passed instance of iAxoCoordinator to this inspector. + /// This method can be called only in derived classes. + /// + METHOD PROTECTED _WithCoordinator : IInspector + VAR_INPUT + inCoordinator : IAxoCoordinator; + END_VAR + + _coordinator := inCoordinator; + _WithCoordinator := THIS; + + END_METHOD + + METHOD PUBLIC OnFail : IOnFail + + // here if is coordinator missing, it should provide message to call it with WithCoordinator method + OnFail:= THIS; + + END_METHOD + + METHOD PUBLIC Dialog : BOOL + VAR_INPUT + inRetryStep: IAxoStep; + inTerminateStep: IAxoStep; + END_VAR + // here if is coordinator missing, it should provide message to call it with WithCoordinator method + _axoInspectorDialog.Show(REF(THIS), inRetryStep, inTerminateStep); + + END_METHOD + + + /// + /// When inspection is done, retry provided step + /// + METHOD PUBLIC RetryWithStep : BOOL + + VAR_INPUT + /// State from which the inspection will restart. + inRetryStep : IAxoStep; + END_VAR + + IF(_coordinator = NULL) THEN + RETURN; + END_IF; + + IF(THIS.Done()) THEN + IF(THIS.Result() = eInspectorResult#Failed) THEN + + IF(inRetryStep <> NULL) THEN + + _coordinator.RequestStep(inRetryStep); + END_IF; + ELSE + _coordinator.MoveNext(); + END_IF; + END_IF; + + + RetryWithStep:= THIS.Done(); + + END_METHOD + + + + /// + /// When inspection is done, continue to next step. + /// + METHOD PUBLIC CarryOn : BOOL + + IF(_coordinator = NULL) THEN + RETURN; + END_IF; + + IF(THIS.Done()) THEN + _coordinator.MoveNext(); + END_IF; + + CarryOn := THIS.Done(); + END_METHOD + + /// + /// When inspection is done, terminate provided step + /// + METHOD PUBLIC TerminateWithStep : BOOL + VAR_INPUT + inTerminateStep : AXOpen.Core.IAxoStep; + END_VAR + IF(_coordinator = NULL) THEN + RETURN; + END_IF; + + + IF(THIS.Done()) THEN + IF(THIS.Result() = eInspectorResult#Failed) THEN + + IF(inTerminateStep <> NULL) THEN + + _coordinator.RequestStep(inTerminateStep); + + END_IF; + ELSE + _coordinator.MoveNext(); + END_IF; + END_IF; + + TerminateWithStep := THIS.Done(); + END_METHOD + + + + + /// + /// Update commmon comprehensive result, which can be used across multiple inspectors + /// Updates comprehensive result. The comprehensive result is set to `Failed` when any inspection fails or is inconclusive. + /// Any bypassed or excluded inspections are not taken into account. + /// + + METHOD PUBLIC UpdateComprehensiveResult : IInspector + VAR_IN_OUT + inoResult : AxoComprehensiveResult; + END_VAR + + + UpdateComprehensiveResult := THIS; + + // if inspection data are not provided, set default result + IF(_inspectorTask.InspectionData() = NULL ) THEN + inoResult.SetResult(eOveralLResult#NoAction); + RETURN; + END_IF; + + // set result to comprehensive data only when inspection fails + CASE _inspectorTask.InspectionData()^.Result OF + + eInspectorResult#Failed: + inoResult.SetResult(eOverallResult#Failed); + //TODO here I should update descriptions + //UpdateDescriptions(inoResult); + eInspectorResult#Inconclusive: + inoResult.SetResult(eOverallResult#Failed); + //TODO here I should update descriptions + //UpdateDescriptions(inoResult); + ELSE + ; + END_CASE; + + + END_METHOD + + + METHOD PUBLIC RestoreInspectorTask : BOOL + _inspectorTask.Restore(); + END_METHOD + + METHOD PUBLIC Busy : BOOL + Busy := _inspectorTask.IsBusy(); + END_METHOD + + METHOD PUBLIC CommonData : REF_TO AXOpen.Inspectors.AxoInspectorData + ; + END_METHOD + + METHOD PUBLIC Coordinator : IAxoCoordinator + Coordinator := _coordinator; + END_METHOD + + METHOD PUBLIC Done : BOOL + Done := _inspectorTask.IsDone(); + END_METHOD + + METHOD PUBLIC Result : eInspectorResult + Result := _inspectorTask.InspectionData()^.Result; + END_METHOD + + + + +END_CLASS + + + + + +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoInspectorData.st b/src/inspectors/ctrl/src/AxoInspectorData.st new file mode 100644 index 000000000..6a48b6571 --- /dev/null +++ b/src/inspectors/ctrl/src/AxoInspectorData.st @@ -0,0 +1,46 @@ +NAMESPACE AXOpen.Inspectors + + /// + /// Data subjected to each inspector instance. + /// + CLASS AxoInspectorData + + VAR PUBLIC + + + {#ix-set:AttributeName = "<#TimeStamp#>"} + Timestamp: LDATE_AND_TIME; + + {#ix-set:AttributeName = "<#Stab.Time#>"} + PassTime : TIME; + + {#ix-set:AttributeName = "<#Timeout#>"} + FailTime : TIME; + + {#ix-set:AttributeName = "<#Result#>"} + Result : eInspectorResult; + + {#ix-set:AttributeName = "<#Excluded#>"} + IsExcluded: BOOL; + + {#ix-set:AttributeName = "<#Bypass#>"} + IsByPassed : BOOL; + + {#ix-set:AttributeName = "<#Re-tries#>"} + NumberOfAllowedRetries : UINT; + + {#ix-set:AttributeName = "<#Attempts#>"} + RetryAttemptsCount : UINT; + + // {#ix-set:AttributeName = "<#Failure description#>"} + // FailureDescription : STRING; + + // {#ix-set:AttributeName = "<#Code#>"} + // ErrorCode : STRING; + + END_VAR + + END_CLASS + + +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoInspectorDialog.st b/src/inspectors/ctrl/src/AxoInspectorDialog.st new file mode 100644 index 000000000..d349a92a4 --- /dev/null +++ b/src/inspectors/ctrl/src/AxoInspectorDialog.st @@ -0,0 +1,124 @@ +USING AXOpen.Core; + +NAMESPACE AXOpen.Inspectors + + /// + /// AxoInspector base class with implemented evaluation methods + /// Evaluation methods need IAxoCoordinator instance + /// + CLASS AxoInspectorDialog EXTENDS AXOpen.Core.AxoDialogBase + + VAR PUBLIC + _isOverInspected : BOOL; + _dialogueRetry : BOOL; + _dialogueTerminate : BOOL; + _dialogueOverride : BOOL; + END_VAR + + VAR PRIVATE + _lastCall : ULINT; + END_VAR + + VAR + + _isActive : BOOL; + _dialogIsClosed : BOOL; + _isAnswerProvided : BOOL; + + END_VAR + + + + METHOD PUBLIC Show + VAR_INPUT + _parentInspectorRef : REF_TO AxoInspector; + inRetryStep : IAxoStep; + inTerminateStep : IAxoStep; + END_VAR + VAR + callCounter : ULINT; + END_VAR + + + //Restores when not called for 2+ consecutive cycles of the context. + callCounter := THIS.GetParent().GetContext().OpenCycleCount(); + IF(callCounter > _lastCall + ULINT#1) THEN + THIS.Restore(); + END_IF; + _lastCall := callCounter; + + + IF(_parentInspectorRef = NULL) THEN + RETURN; + END_IF; + + + _isOverInspected := _parentInspectorRef^.CheckOverInspection(); + + + IF(_parentInspectorRef^.Done()) THEN + + IF(_parentInspectorRef^.Result() = eInspectorResult#Failed) THEN + THIS.Initialize(_parentInspectorRef^); + THIS.Invoke(); + SUPER.Execute(); + + + IF(_dialogueRetry) THEN + _parentInspectorRef^.RetryWithStep(inRetryStep); + _isAnswerProvided := TRUE; + + END_IF; + + IF(_dialogueTerminate) THEN + _parentInspectorRef^.TerminateWithStep(inTerminateStep); + _isAnswerProvided := TRUE; + + END_IF; + + IF(_dialogueOverride) THEN + _parentInspectorRef^.CarryOn(); + _isAnswerProvided := TRUE; + + END_IF; + + + ELSE + + IF(_parentInspectorRef^.Coordinator() <> NULL) THEN + _parentInspectorRef^.Coordinator().MoveNext(); + END_IF; + + END_IF; + + // restore this task, when answer is provided and task is done + IF _isAnswerProvided THEN + THIS.Restore(); + _parentInspectorRef^.RestoreInspectorTask(); + _isAnswerProvided := FALSE; + END_IF; + + + END_IF; + END_METHOD + + + METHOD PUBLIC Restore + + SUPER.Restore(); + _dialogueRetry := FALSE; + _dialogueTerminate := FALSE; + _dialogueOverride := FALSE; + _dialogIsClosed := FALSE; + + END_METHOD + + + +END_CLASS + + + + + +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/AxoInspectorTask.st b/src/inspectors/ctrl/src/AxoInspectorTask.st new file mode 100644 index 000000000..1e7ab6b5d --- /dev/null +++ b/src/inspectors/ctrl/src/AxoInspectorTask.st @@ -0,0 +1,119 @@ +USING AXOpen.Core; +USING AXOpen.Inspectors; +USING AXOpen.Core; +USING System.Timer; + + + +NAMESPACE AXOpen.Inspectors + + CLASS AxoInspectorTask EXTENDS AxoTask + VAR + _onDoneFlag: BOOL; + _inspectionData: REF_TO AxoInspectorData; + + END_VAR + + VAR INTERNAL + // _passTimer : AXOpen.Timers.OnDelayContext; + // _failTimer : AXOpen.Timers.OnDelayContext; + _passTimer : OnDelay; + _failTimer : OnDelay; + END_VAR + + + //getter + METHOD PUBLIC InspectionData : REF_TO AxoInspectorData + InspectionData := _inspectionData; + END_METHOD + + //setter + METHOD INTERNAL SetInspectionData : REF_TO AxoInspectorData + VAR_INPUT + inInspectionData: REF_TO AxoInspectorData; + END_VAR + _inspectionData := inInspectionData; + END_METHOD + + + METHOD PUBLIC OnDoneFlag : BOOL + OnDoneFlag := _onDoneFlag; + END_METHOD + + + /// + /// Execute inspection task. + /// + METHOD PUBLIC OVERRIDE Execute : BOOL + + _onDoneFlag := FALSE; + Execute := SUPER.Execute(); + END_METHOD + + //// + /// Executes once when inspection starts. + /// + METHOD PROTECTED OVERRIDE OnStart + SUPER.OnStart(); + + // set default values for passtime and failtime if no values were provided + IF (_inspectionData^.PassTime = T#0S) THEN + _inspectionData^.PassTime := T#50MS; + END_IF; + + IF (_inspectionData^.FailTime = T#0S) THEN + _inspectionData^.FailTime := T#100MS; + END_IF; + + _inspectionData^.Result := eInspectorResult#NoAction; + + _passTimer(FALSE, LT#0MS); + _failTimer(FALSE, LT#0MS); + END_METHOD + + + METHOD PUBLIC Restore + SUPER.Restore(); + _onDoneFlag := FALSE; + END_METHOD + + //// + /// When inspection Task is done, evaluate inspection result and write to inspection data. + /// + METHOD PROTECTED OVERRIDE OnDone + SUPER.OnDone(); + + // iterate number of retries + _inspectionData^.RetryAttemptsCount := _inspectionData^.RetryAttemptsCount + UINT#1; + + // if inspection is set to be bypassed, skip evalution of result + IF (_inspectionData^.Result = eInspectorResult#Bypassed) THEN + RETURN; + END_IF; + + _inspectionData^.TimeStamp := THIS.GetContext().GetRtc().NowUTC(); + _inspectionData^.Result := eInspectorResult#Failed; + + // if fail timer was not satisfied and pass timer passed, set inspector result to passed + IF (NOT _failTimer.output AND _passTimer.output) THEN + _inspectionData^.Result := eInspectorResult#Passed; + END_IF; + + // if inspector was excluded, set result to excluded + IF (_inspectionData^.IsExcluded) THEN + _inspectionData^.Result := eInspectorResult#Excluded; + END_IF; + + _onDoneFlag := TRUE; + END_METHOD + + END_CLASS + + + + + + + + +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/enums/eInspectorResult.st b/src/inspectors/ctrl/src/enums/eInspectorResult.st new file mode 100644 index 000000000..90bdc49fa --- /dev/null +++ b/src/inspectors/ctrl/src/enums/eInspectorResult.st @@ -0,0 +1,13 @@ +NAMESPACE AXOpen.Inspectors + TYPE + eInspectorResult : INT ( + NoAction := 0, + Running := 10, + Passed := 20, + Failed := 30, + Inconclusive := 35, + Excluded := 40, + Bypassed := 50 + ); + END_TYPE +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/enums/eOverallResult.st b/src/inspectors/ctrl/src/enums/eOverallResult.st new file mode 100644 index 000000000..f0d825cc6 --- /dev/null +++ b/src/inspectors/ctrl/src/enums/eOverallResult.st @@ -0,0 +1,10 @@ +NAMESPACE AXOpen.Inspectors + TYPE + eOverallResult : INT ( + NoAction := 0, + InProgress := 10, + Passed := 20, + Failed := 30 + ); + END_TYPE +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/interfaces/IAxoComprehensiveResult.st b/src/inspectors/ctrl/src/interfaces/IAxoComprehensiveResult.st new file mode 100644 index 000000000..f5094b7a7 --- /dev/null +++ b/src/inspectors/ctrl/src/interfaces/IAxoComprehensiveResult.st @@ -0,0 +1,33 @@ +USING AXOpen.Core; +NAMESPACE AXOpen.Inspectors + INTERFACE IAxoComprehensiveResult + + METHOD GetResult : eOverallResult + END_METHOD + + METHOD GetFailures : STRING + END_METHOD + + METHOD GetErrorCodes : STRING + END_METHOD + + METHOD SetResult + VAR_INPUT + inResult: eOverallResult; + END_VAR + END_METHOD + + METHOD SetFailures + VAR_INPUT + inFailures: STRING; + END_VAR + END_METHOD + + METHOD SetErrorCodes + VAR_INPUT + inErrorCodes: STRING; + END_VAR + END_METHOD + + END_INTERFACE +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/interfaces/IInspector.st b/src/inspectors/ctrl/src/interfaces/IInspector.st new file mode 100644 index 000000000..70bdfb580 --- /dev/null +++ b/src/inspectors/ctrl/src/interfaces/IInspector.st @@ -0,0 +1,48 @@ +USING AXOpen.Core; +NAMESPACE AXOpen.Inspectors + INTERFACE IInspector + + METHOD Busy : BOOL + END_METHOD + + METHOD CommonData : REF_TO AxoInspectorData + END_METHOD + + METHOD Coordinator : IAxoCoordinator + END_METHOD + + METHOD Done : BOOL + END_METHOD + + + METHOD CheckOverInspection : BOOL + END_METHOD + + METHOD Result : eInspectorResult + END_METHOD + + METHOD Dialog : BOOL + VAR_INPUT + inRetryStep: IAxoStep; + inTerminateStep: IAxoStep; + END_VAR + + + END_METHOD + + METHOD RestoreInspectorTask : BOOL + END_METHOD + + METHOD OnFail : IOnFail + END_METHOD + + METHOD UpdateComprehensiveResult : IInspector + + VAR_IN_OUT + inoResult : AxoComprehensiveResult; + END_VAR + + END_METHOD + + END_INTERFACE +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/src/interfaces/IOnFail.st b/src/inspectors/ctrl/src/interfaces/IOnFail.st new file mode 100644 index 000000000..b6d085612 --- /dev/null +++ b/src/inspectors/ctrl/src/interfaces/IOnFail.st @@ -0,0 +1,34 @@ + +NAMESPACE AXOpen.Inspectors + INTERFACE IOnFail + + METHOD CarryOn : BOOL + END_METHOD + + METHOD RetryWithStep : BOOL + VAR_INPUT + /// State from which the inspection will restart. + inRetryStep : AXOpen.Core.IAxoStep; + END_VAR + END_METHOD + + + METHOD Dialog : BOOL + VAR_INPUT + inRetryStep: AXOpen.Core.IAxoStep; + inTerminateStep: AXOpen.Core.IAxoStep; + END_VAR + END_METHOD + + + METHOD TerminateWithStep : BOOL + VAR_INPUT + /// State from which the inspection will restart. + inTerminateStep : AXOpen.Core.IAxoStep; + END_VAR + END_METHOD + + + + END_INTERFACE +END_NAMESPACE \ No newline at end of file diff --git a/src/inspectors/ctrl/test/AxoDigitalInspectorTests.st b/src/inspectors/ctrl/test/AxoDigitalInspectorTests.st new file mode 100644 index 000000000..18bf39bbb --- /dev/null +++ b/src/inspectors/ctrl/test/AxoDigitalInspectorTests.st @@ -0,0 +1,129 @@ +USING AXOpen.Rtc; +USING AXOpen.Logging; +USING AXOpen.Core; +USING AXOpen.Rtc; +USING AxUnit; + +NAMESPACE AXOpen.Inspectors.AxoDigitalInspector_Tests + + CLASS AxoRtcMock IMPLEMENTS IAxoRtc + VAR PRIVATE + _NowUTC : LDATE_AND_TIME; + END_VAR + + METHOD INTERNAL SetNowUTC : LDATE_AND_TIME + VAR_INPUT + Set : LDATE_AND_TIME; + END_VAR; + _NowUTC := Set; + END_METHOD + + METHOD PUBLIC NowUTC : LDATE_AND_TIME + NowUTC := _NowUTC; + END_METHOD + END_CLASS + + CLASS TestContext IMPLEMENTS IAxoContext + VAR PROTECTED + _openCounter : ULINT; + _closeCounter : ULINT; + _identityCounter : ULINT; + _rtc : IAxoRtc; + END_VAR + METHOD PUBLIC Open : ULINT + _openCounter := _openCounter + ULINT#1; + END_METHOD + + METHOD PUBLIC Close : ULINT + _closeCounter := _closeCounter + ULINT#1; + END_METHOD + + METHOD PUBLIC OpenCycleCount : ULINT + OpenCycleCount := _openCounter; + END_METHOD + + METHOD PUBLIC ClosedCycleCount : ULINT + ClosedCycleCount := _closeCounter; + END_METHOD + + METHOD PUBLIC CreateIdentity : ULINT + _identityCounter := _identityCounter + ULINT#1; + CreateIdentity := _identityCounter; + END_METHOD + + METHOD PUBLIC GetRtc : IAxoRtc ; + GetRtc := _rtc; + END_METHOD + + METHOD PUBLIC InjectRtc + VAR_INPUT Rtc : IAxoRtc; + END_VAR ; + + _rtc := Rtc; + END_METHOD + + VAR PRIVATE + NULL_LOGGER : _NULL_LOGGER; + END_VAR + METHOD PUBLIC GetLogger : AXOpen.Logging.IAxoLogger GetLogger := NULL_LOGGER; END_METHOD + METHOD PUBLIC InjectLogger VAR_INPUT _logger : AXOpen.Logging.IAxoLogger; END_VAR ; END_METHOD + + END_CLASS + + {TestFixture} + CLASS AxoDigitalInspectorTests + // VAR PROTECTED + // _context : TestContext; + // _digitalInspector : AxoDigitalInspector; + // _inspectedBool : BOOL; + // _sequencer : AxoSequencer; + // _rtcMock : AxoRtcMock; + + // _testBool : BOOL; + + // _testTimer: AXOpen.Timers.OnDelayContext; + // _testTimeDelay: LTIME; + // END_VAR + + // METHOD PRIVATE Initialize + // _context.InjectRtc(_rtcMock); + // _sequencer.Initialize(_context); + // END_METHOD + + + // {Test} + // METHOD PUBLIC Timer_test_pass + // THIS.Initialize(); + + // _context.Open(); + + + // _rtcMock.SetNowUTC(LDT#1980-01-23-13:14:33.123456); + // _testBool := TRUE; + // _testTimeDelay := LTIME#13:14:3.45; + + // _testTimer.Delay(_context,_testBool,_testTimeDelay); + // _inspectedBool := TRUE; + // _digitalInspector.Data()^.RequiredStatus := TRUE; + + // _testBool := _digitalInspector.Inspect(_sequencer,_inspectedBool).Done(); + + // _rtcMock.SetNowUTC(LDT#1980-01-23-13:14:38.123456); + + // _testBool := _digitalInspector.Inspect(_sequencer,_inspectedBool).Done(); + // //_digitalInspector.WithCoordinator(_sequencer).Inspect(_sequencer,_inspectedBool).OnFail().CarryOn(); + + // // WHILE NOT _digitalInspector.Inspect(_sequencer,_inspectedBool).Done() DO + // // ; + // // END_WHILE; + + + // Assert.Equal(eInspectorResult#Passed, _digitalInspector.Data()^.Result); + + + // _context.Close(); + // END_METHOD + + + END_CLASS +END_NAMESPACE diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxOpen.Inspectors.Blazor.csproj b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxOpen.Inspectors.Blazor.csproj new file mode 100644 index 000000000..acf1d78e7 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxOpen.Inspectors.Blazor.csproj @@ -0,0 +1,25 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + + + + + + + diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Online/AxoAnalogueInspectorCommandView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Online/AxoAnalogueInspectorCommandView.razor new file mode 100644 index 000000000..7ef5f84ba --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Online/AxoAnalogueInspectorCommandView.razor @@ -0,0 +1,25 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + +@code{ + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Online/AxoAnalogueInspectorStatusView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Online/AxoAnalogueInspectorStatusView.razor new file mode 100644 index 000000000..0a9889ac7 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Online/AxoAnalogueInspectorStatusView.razor @@ -0,0 +1,27 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + + +@code { + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Shadow/AxoAnalogueInspectorShadowControlView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Shadow/AxoAnalogueInspectorShadowControlView.razor new file mode 100644 index 000000000..fe5d7e524 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Shadow/AxoAnalogueInspectorShadowControlView.razor @@ -0,0 +1,25 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + +@code { + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Shadow/AxoAnalogueInspectorShadowDisplayView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Shadow/AxoAnalogueInspectorShadowDisplayView.razor new file mode 100644 index 000000000..2bf45dcae --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoAnalogueInspector/Shadow/AxoAnalogueInspectorShadowDisplayView.razor @@ -0,0 +1,25 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + +@code { + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Online/AxoDataInspectorCommandView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Online/AxoDataInspectorCommandView.razor new file mode 100644 index 000000000..374d5e301 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Online/AxoDataInspectorCommandView.razor @@ -0,0 +1,27 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + + +@code { + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Online/AxoDataInspectorStatusView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Online/AxoDataInspectorStatusView.razor new file mode 100644 index 000000000..267cb5c22 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Online/AxoDataInspectorStatusView.razor @@ -0,0 +1,27 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + + +@code { + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Shadow/AxoDataInspectorShadowControlView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Shadow/AxoDataInspectorShadowControlView.razor new file mode 100644 index 000000000..3f9cec2f0 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Shadow/AxoDataInspectorShadowControlView.razor @@ -0,0 +1,25 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + +@code { + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Shadow/AxoDataInspectorShadowDisplayView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Shadow/AxoDataInspectorShadowDisplayView.razor new file mode 100644 index 000000000..79890123f --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDataInspector/Shadow/AxoDataInspectorShadowDisplayView.razor @@ -0,0 +1,25 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + +@code { + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Online/AxoDigitalInspectorCommandView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Online/AxoDigitalInspectorCommandView.razor new file mode 100644 index 000000000..308c34501 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Online/AxoDigitalInspectorCommandView.razor @@ -0,0 +1,27 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + + +@code{ + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} + diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Online/AxoDigitalInspectorStatusView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Online/AxoDigitalInspectorStatusView.razor new file mode 100644 index 000000000..14f5b3a10 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Online/AxoDigitalInspectorStatusView.razor @@ -0,0 +1,58 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + +
          +
          +
          + +
          +
          +
          + +
          +
          + +
          +
          + +
          +
          + +
          +
          + +
          + +
          + + @if (Component._axoInspectorDialog._isOverInspected.Cyclic) + { +

          Overinspection detected

          + } +
          +
          +
          +
          + +
          +
          +
          +
          + +@code{ + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} + diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Shadow/AxoDigitalInspectorShadowControlView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Shadow/AxoDigitalInspectorShadowControlView.razor new file mode 100644 index 000000000..f3f211dd1 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Shadow/AxoDigitalInspectorShadowControlView.razor @@ -0,0 +1,25 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + +@code { + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Shadow/AxoDigitalInspectorShadowDisplayView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Shadow/AxoDigitalInspectorShadowDisplayView.razor new file mode 100644 index 000000000..994f810d3 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoDigitalInspector/Shadow/AxoDigitalInspectorShadowDisplayView.razor @@ -0,0 +1,25 @@ +@namespace AXOpen.Inspectors +@inherits RenderableComplexComponentBase + + + + + + + +@code { + private string ID = "M" + Guid.NewGuid().ToString(); + + public string getNameOrSymbol() + { + return string.IsNullOrEmpty(Component.AttributeName) ? Component.GetSymbolTail() : Component.AttributeName; + } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Component._data.Result); + } +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoInspectorDialog/AxoInspectorDialogDialogView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoInspectorDialog/AxoInspectorDialogDialogView.razor new file mode 100644 index 000000000..a65edef11 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoInspectorDialog/AxoInspectorDialogDialogView.razor @@ -0,0 +1,39 @@ +@namespace AXOpen.Inspectors +@using AXOpen.Core.Blazor.AxoDialogs +@using Microsoft.AspNetCore.Components.Authorization; +@inherits AxoDialogBaseView +@inject AuthenticationStateProvider _asp + +

          AxoInspectorDialogDialogView

          + + + +

          Inspection failed, you will need to decide what's next...

          +
          + +
          + +
          @Description
          + @if (Inspector != null) + { + + } + else + { +

          Loading inspector... if it's taking long, something is wrong

          + } + +
          +
          + + + + + +
          +
          +
          + + + + diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoInspectorDialog/AxoInspectorDialogDialogView.razor.cs b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoInspectorDialog/AxoInspectorDialogDialogView.razor.cs new file mode 100644 index 000000000..383eaa5ff --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/AxoInspectorDialog/AxoInspectorDialogDialogView.razor.cs @@ -0,0 +1,100 @@ +using AXOpen.Core; +using AXOpen.Core.Blazor.AxoDialogs; +using AXOpen.Logging; +using AXSharp.Connector; +using Pocos.AXOpen.Inspectors; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AXOpen.Inspectors +{ + public partial class AxoInspectorDialogDialogView : AxoDialogBaseView, IDisposable + { + + public bool RetryDisabled { get; set; } = false; + + protected override void OnAfterRender(bool firstRender) + { + _inspector = null; + try + { + var parent = Component.GetParent(); + + if (parent is AxoInspector i) + { + _inspector = i; + } + } + catch (Exception) + { + } + + if(base.Component._isOverInspected.Cyclic) + RetryDisabled = true; + } + + public override void AddToPolling(ITwinElement element, int pollingInterval = 250) + { + base.AddToPolling(element, pollingInterval); + } + + public async Task Retry() + { + if (base.Component != null && !base.Component._isOverInspected.Cyclic) + { + RetryDisabled = false; + base.Component._dialogueRetry.Edit = true; + await base.CloseDialogsWithSignalR(); + var identity = (await _asp.GetAuthenticationStateAsync()).User.Identity; + AxoApplication.Current.Logger.Information($"{nameof(Retry)} of {Component.HumanReadable} was executed.", identity); + } + else + { + RetryDisabled = true; + } + + } + public async Task Terminate() + { + base.Component._dialogueTerminate.Edit = true; + await base.CloseDialogsWithSignalR(); + var identity = (await _asp.GetAuthenticationStateAsync()).User.Identity; + AxoApplication.Current.Logger.Information($"{nameof(Terminate)} of {Component.HumanReadable} was executed.", identity); + } + public async Task Override() + { + base.Component._dialogueOverride.Edit = true; + await base.CloseDialogsWithSignalR(); + var identity = (await _asp.GetAuthenticationStateAsync()).User.Identity; + AxoApplication.Current.Logger.Information($"{nameof(Override)} of {Component.HumanReadable} was executed.", identity); + } + + + public string Description + { + get => string.IsNullOrEmpty(base.Component.AttributeName) ? base.Component.GetSymbolTail() : base.Component.AttributeName; + + } + + private ITwinObject _inspector; + public ITwinObject Inspector + { + get + { + + return _inspector; + } + + } + + public override void Dispose() + { + base.Dispose(); + } + + } + + } diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/GenericIconView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/GenericIconView.razor new file mode 100644 index 000000000..ed7cbfc13 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/GenericIconView.razor @@ -0,0 +1,76 @@ +@namespace AXOpen.Inspectors + +
          + @switch (@Result) + { + case 0: + + + + break; + case 10: + + + + break; + case 20: + + + + break; + case 30: + + + + break; + case 35: + + + + break; + case 40: + + + + break; + case 50: + + + + break; + } +
          +
          + @switch (@Result) + { + case 0: +

          No Action

          + break; + case 10: +

          Running

          + break; + case 20: +

          Passed

          + break; + case 30: +

          Failed

          + break; + case 35: +

          Inconclusive

          + break; + case 40: +

          Excluded

          + break; + case 50: +

          Bypassed

          + break; + } +
          + + +@code { + [Parameter] + public short Result { get; set; } + + +} \ No newline at end of file diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/GenericInspectorDataView.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/GenericInspectorDataView.razor new file mode 100644 index 000000000..824a3452d --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/GenericInspectorDataView.razor @@ -0,0 +1,28 @@ +@namespace AXOpen.Inspectors + + + +
          +
          + + +@* + *@ +
          +
          + + + +
          +
          + + +
          +
          + +@code { + [Parameter] + public AxoInspectorData Data { get; set; } + [Parameter] + public string Presentation { get; set; } +} \ No newline at end of file diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/GenericInspectorDataView.razor.css b/src/inspectors/src/AxOpen.Inspectors.Blazor/GenericInspectorDataView.razor.css new file mode 100644 index 000000000..c6afca404 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/GenericInspectorDataView.razor.css @@ -0,0 +1,6 @@ +.my-component { + border: 2px dashed red; + padding: 1em; + margin: 1em 0; + background-image: url('background.png'); +} diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/InspectorViewTemplate.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/InspectorViewTemplate.razor new file mode 100644 index 000000000..3f79365c1 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/InspectorViewTemplate.razor @@ -0,0 +1,108 @@ +@namespace AXOpen.Inspectors + +
          +
          +
          + +
          +
          + +
          + @if (IsAnalogInspectorData()) + { +
          + +
          +
          + +
          +
          + +
          + } + else if(IsDigitalInspectorData()) + { +
          + +
          +
          + +
          + } + else if (IsDataInspectorData()) + { +
          + +
          +
          + +
          +
          + +
          + } + else + { +

          Cannot render, unspecified inspector type

          + } +
          + +
          +
          + +
          +
          + +
          + +
          + +
          + + @if (IsOverInspected) + { +

          Over-inspection detected

          + } +
          +
          + +
          +
          + +
          +
          +
          +
          + + + + +@code { + + + [Parameter] + public AxoInspectorData Data { get; set; } + + [Parameter] + public string Presentation { get; set; } + + [Parameter] + public bool IsOverInspected { get; set; } + + [Parameter] + public string Name { get; set; } + + + private string ID = "M" + Guid.NewGuid().ToString(); + + private bool IsAnalogInspectorData() => Data is AxoAnalogueInspectorData ? true : false; + private bool IsDigitalInspectorData() => Data is AxoDigitalInspectorData ? true : false; + private bool IsDataInspectorData() => Data is AxoDataInspectorData ? true : false; + + + +} + + diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/Properties/AssemblyInfo.cs b/src/inspectors/src/AxOpen.Inspectors.Blazor/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..7fc953296 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using AXSharp.Presentation.Blazor.Attributes; + +[assembly: RenderableBlazorAssembly()] \ No newline at end of file diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/_Imports.razor b/src/inspectors/src/AxOpen.Inspectors.Blazor/_Imports.razor new file mode 100644 index 000000000..9ec08f956 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/_Imports.razor @@ -0,0 +1,2 @@ +@using Microsoft.AspNetCore.Components.Web +@using AXSharp.Presentation.Blazor.Controls.RenderableContent diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/wwwroot/background.png b/src/inspectors/src/AxOpen.Inspectors.Blazor/wwwroot/background.png new file mode 100644 index 000000000..e15a3bde6 Binary files /dev/null and b/src/inspectors/src/AxOpen.Inspectors.Blazor/wwwroot/background.png differ diff --git a/src/inspectors/src/AxOpen.Inspectors.Blazor/wwwroot/exampleJsInterop.js b/src/inspectors/src/AxOpen.Inspectors.Blazor/wwwroot/exampleJsInterop.js new file mode 100644 index 000000000..ea8d76ad2 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors.Blazor/wwwroot/exampleJsInterop.js @@ -0,0 +1,6 @@ +// This is a JavaScript module that is loaded on demand. It can export any number of +// functions, and may import other JavaScript modules if required. + +export function showPrompt(message) { + return prompt(message, 'Type anything here'); +} diff --git a/src/inspectors/src/AxOpen.Inspectors/ix_ax_axopen_inspectors.csproj b/src/inspectors/src/AxOpen.Inspectors/ix_ax_axopen_inspectors.csproj new file mode 100644 index 000000000..a5e68bbd2 --- /dev/null +++ b/src/inspectors/src/AxOpen.Inspectors/ix_ax_axopen_inspectors.csproj @@ -0,0 +1,20 @@ + + + net7.0 + enable + enable + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/templates.simple/axosimple.app/Components/UnitsData.razor b/src/templates.simple/axosimple.app/Components/UnitsData.razor index 1e7c2b460..ff504062b 100644 --- a/src/templates.simple/axosimple.app/Components/UnitsData.razor +++ b/src/templates.simple/axosimple.app/Components/UnitsData.razor @@ -9,8 +9,8 @@ Process Data
          - - + + @**@
          diff --git a/src/templates.simple/axosimple.app/Pages/UI/ManipulatorExample.razor b/src/templates.simple/axosimple.app/Pages/UI/ManipulatorExample.razor index 5c0e0d730..99576fc08 100644 --- a/src/templates.simple/axosimple.app/Pages/UI/ManipulatorExample.razor +++ b/src/templates.simple/axosimple.app/Pages/UI/ManipulatorExample.razor @@ -7,9 +7,15 @@ @using AXOpen.Messaging.Static @using AXSharp.Connector; - @inject IAlertDialogService _alerts + + + + + + + @@ -23,28 +29,37 @@ } + + + + + +

          Comprehensive result

          + - + @code { - private ElementReference keyDownDiv; - private ModalDialog ModalDialog { get; set; } + private IEnumerable Messengers => Entry.Plc.Context.PneumaticManipulator.GetChildren().Flatten(p => p.GetChildren()).OfType(); - private void showAlert() + private void Reset() { - _alerts.AddAlertDialog(eAlertDialogType.Info, "Ahoj", "som dialog", 60); + Entry.Plc.Context.PneumaticManipulator.AutomatSequence._comprehensiveResult.Result.Cyclic = 0; + _alerts.AddAlertDialog(eAlertDialogType.Info, "Comprehenesive result", "Reseted", 3); StateHasChanged(); } + + } diff --git a/src/templates.simple/axosimple.app/Pages/UI/ProcessData.razor b/src/templates.simple/axosimple.app/Pages/UI/ProcessData.razor index 8f2a34d26..b48a6361e 100644 --- a/src/templates.simple/axosimple.app/Pages/UI/ProcessData.razor +++ b/src/templates.simple/axosimple.app/Pages/UI/ProcessData.razor @@ -23,7 +23,7 @@ } - + @**@ diff --git a/src/templates.simple/axosimple.app/Program.cs b/src/templates.simple/axosimple.app/Program.cs index 969face9d..cd91a857e 100644 --- a/src/templates.simple/axosimple.app/Program.cs +++ b/src/templates.simple/axosimple.app/Program.cs @@ -56,8 +56,7 @@ //Entry.Plc.ContextLogger.StartDequeuing(AxoApplication.Current.Logger, 250); -var a = Entry.Plc.Context.PneumaticManipulator - .ProcessData +var a = Entry.Plc.Context.ProcessDataPneumaticManipulator .CreateBuilder(); a.DataManger.SetRepository(productionDataRepository); diff --git a/src/templates.simple/axosimple.app/axosimple.hmi.csproj b/src/templates.simple/axosimple.app/axosimple.hmi.csproj index 6e18ab526..24eab0fbe 100644 --- a/src/templates.simple/axosimple.app/axosimple.hmi.csproj +++ b/src/templates.simple/axosimple.app/axosimple.hmi.csproj @@ -33,6 +33,7 @@ + diff --git a/src/templates.simple/axosimple.twin/Entry.cs b/src/templates.simple/axosimple.twin/Entry.cs index 8ce14c7b2..f7e878a77 100644 --- a/src/templates.simple/axosimple.twin/Entry.cs +++ b/src/templates.simple/axosimple.twin/Entry.cs @@ -17,7 +17,7 @@ namespace axosimple { public static class Entry { - private const string TargetIp = "10.10.10.1"; // <- replace by your IP + private static string TargetIp = Environment.GetEnvironmentVariable("AXTARGET"); // <- replace by your IP private const string UserName = "Everybody"; //<- replace by user name you have set up in your WebAPI settings private const string Pass = ""; // <- Pass in the password that you have set up for the user. NOT AS PLAIN TEXT! Use user secrets instead. private const bool IgnoreSslErrors = true; // <- When you have your certificates in order set this to false. diff --git a/src/templates.simple/axosimple.twin/Resources/PlcStringResources.resx b/src/templates.simple/axosimple.twin/Resources/PlcStringResources.resx index b8b155214..a557e9af4 100644 --- a/src/templates.simple/axosimple.twin/Resources/PlcStringResources.resx +++ b/src/templates.simple/axosimple.twin/Resources/PlcStringResources.resx @@ -76,14 +76,14 @@ AUTOMAT - src\Examples\PneumaticManipulator.st,142 + src\Examples\PneumaticManipulator.st,147 GROUND - src\Examples\PneumaticManipulator.st,315 + src\Examples\PneumaticManipulator.st,339 SERVICE - src\Examples\PneumaticManipulator.st,369 + src\Examples\PneumaticManipulator.st,393 \ No newline at end of file diff --git a/src/templates.simple/axosimple.twin/axosimple.csproj b/src/templates.simple/axosimple.twin/axosimple.csproj index 2ac803782..e6439a67f 100644 --- a/src/templates.simple/axosimple.twin/axosimple.csproj +++ b/src/templates.simple/axosimple.twin/axosimple.csproj @@ -15,6 +15,7 @@ + @@ -29,4 +30,7 @@ PlcStringResources.Designer.cs + + + \ No newline at end of file diff --git a/src/templates.simple/ctrl/apax.yml b/src/templates.simple/ctrl/apax.yml index d9787c339..d8b6bdb39 100644 --- a/src/templates.simple/ctrl/apax.yml +++ b/src/templates.simple/ctrl/apax.yml @@ -8,6 +8,7 @@ devDependencies: "@ax/sld": ^0.15.9 dependencies: "@ix-ax/axopen.data": '0.1.4-alpha.79' + "@ix-ax/axopen.inspectors": '0.1.4-alpha.79' "@ix-ax/axopen.simatic1500": '0.1.4-alpha.79' "@ax/system-serde": ^2.0.2 variables: diff --git a/src/templates.simple/ctrl/monitor.mon b/src/templates.simple/ctrl/monitor.mon index f74cb314d..32bf13da6 100644 --- a/src/templates.simple/ctrl/monitor.mon +++ b/src/templates.simple/ctrl/monitor.mon @@ -10,11 +10,14 @@ #Context.PneumaticManipulator.AutomatSequence._dialog -Context.PneumaticManipulator.AutomatSequence._dialog3._closeSignal -Context.PneumaticManipulator.AutomatSequence._dialog3._answer -Context.PneumaticManipulator.AutomatSequence._externalClose -Context.PneumaticManipulator.AutomatSequence._dialog3._edgeDetected -Context.PneumaticManipulator.AutomatSequence._dialog3._testClose +#Context.PneumaticManipulator.AutomatSequence._dialog3._closeSignal +#Context.PneumaticManipulator.AutomatSequence._dialog3._answer +#Context.PneumaticManipulator.AutomatSequence._externalClose +#Context.PneumaticManipulator.AutomatSequence._dialog3._edgeDetected +#Context.PneumaticManipulator.AutomatSequence._dialog3._testClose +Context.PneumaticManipulator.AutomatSequence.Steps[13] +Context.PneumaticManipulator.AutomatSequence._presenceInspector._data + #Context.PneumaticManipulator.AutomatSequence._dialog1 #Context.PneumaticManipulator.AutomatSequence._dialog2 diff --git a/src/templates.simple/ctrl/src/Context.st b/src/templates.simple/ctrl/src/Context.st index 3680e5518..4e8752f84 100644 --- a/src/templates.simple/ctrl/src/Context.st +++ b/src/templates.simple/ctrl/src/Context.st @@ -10,11 +10,15 @@ NAMESPACE axosimple PneumaticManipulator2 : examples.PneumaticManipulator.CU; Inputs : REF_TO axosimple.Inputs; Outputs : REF_TO axosimple.Outputs; + + ProcessDataPneumaticManipulator : examples.PneumaticManipulator.ProcessDataManger; END_VAR METHOD PROTECTED OVERRIDE Main IF(Inputs <> NULL AND Outputs <> NULL) THEN + PneumaticManipulator.ProcessData := REF(ProcessDataPneumaticManipulator); PneumaticManipulator.Run(THIS, Inputs^, Outputs^); + PneumaticManipulator2.ProcessData := REF(ProcessDataPneumaticManipulator); PneumaticManipulator2.Run(THIS, Inputs^, Outputs^); END_IF; END_METHOD diff --git a/src/templates.simple/ctrl/src/Examples/PneumaticManipulator.st b/src/templates.simple/ctrl/src/Examples/PneumaticManipulator.st index 8cf50104e..421d83729 100644 --- a/src/templates.simple/ctrl/src/Examples/PneumaticManipulator.st +++ b/src/templates.simple/ctrl/src/Examples/PneumaticManipulator.st @@ -39,6 +39,9 @@ NAMESPACE examples.PneumaticManipulator EXTENDS AXOpen.Data.AxoDataEntity VAR PUBLIC CounterDelay : ULINT; + _presenceInspector: AXOpen.Inspectors.AxoDigitalInspector; + _valueInspector: AXOpen.Inspectors.AxoAnalogueInspector; + _dataInspector: AXOpen.Inspectors.AxoDataInspector; END_VAR END_CLASS @@ -73,7 +76,9 @@ NAMESPACE examples.PneumaticManipulator /// Handles and intializes components used by this unit. /// Components : Components; - ProcessData : ProcessDataManger; + + ProcessData : REF_TO ProcessDataManger; + /// /// Ground sequence. Contains logic that brings the unit into initial state. /// @@ -117,9 +122,9 @@ NAMESPACE examples.PneumaticManipulator // Component I/O immange and management handling. Components.Update(THIS, Inputs, Outputs); // Process data manager - ProcessData.Run(THIS); + ProcessData^.Run(THIS); // Handles ground sequence - GroundSequence.Run(REF(Components), REF(ProcessData), THIS); + GroundSequence.Run(REF(Components), ProcessData, THIS); // Restores other states when Ground executes IF (GroundSequence.IsBusy()) THEN AutomatSequence.Restore(); @@ -127,7 +132,7 @@ NAMESPACE examples.PneumaticManipulator END_IF; // Handles automatic sequence (ground must be previously done) AutomatSequence.IsDisabled := GroundSequence.Status <> eAxoTaskState#Done; - AutomatSequence.Run(REF(Components), REF(ProcessData), THIS); + AutomatSequence.Run(REF(Components), ProcessData, THIS); // Handles service/manual mode ServiceMode.Run(THIS, Components); IF ServiceMode.IsBusy() THEN @@ -150,6 +155,14 @@ NAMESPACE examples.PneumaticManipulator _dialog2 : AXOpen.Core.AxoDialog; _dialog3 : AXOpen.Core.AxoDialog; _alertDialog : AXOpen.Core.AxoAlertDialog; + _presenceInspector: AXOpen.Inspectors.AxoDigitalInspector; + _valueInspector: AXOpen.Inspectors.AxoAnalogueInspector; + _dataInspector: AXOpen.Inspectors.AxoDataInspector; + _data: AXOpen.Inspectors.AxoDigitalInspectorData; + _comprehensiveResult: AXOpen.Inspectors.AxoComprehensiveResult; + _inspectionResult:BOOL; + _inspectionValue:LREAL; + _inspectionData: STRING; _externalClose : BOOL; END_VAR VAR PRIVATE @@ -230,81 +243,92 @@ NAMESPACE examples.PneumaticManipulator //------------------------------------------------------- END_IF; + IF (Steps[16].Execute(THIS, TRUE, 'Set inpsection times')) THEN + //-------------------------------------------- - IF (Steps[20].Execute(THIS, TRUE, 'Dummy')) THEN - //------------------------------------------------------- - IF(Steps[20].Duration > T#100ms) THEN - - THIS.MoveNext(); - END_IF; - END_IF; + _valueInspector.Data()^.FailTime := TIME#3s; + _presenceInspector.Data()^.FailTime := TIME#3s; + _dataInspector.Data()^.FailTime := TIME#3s; - IF (Steps[30].Execute(THIS, TRUE, 'Show dialog 0')) THEN - //------------------------------------------------------- + _valueInspector.Data()^.PassTime := TIME#2s; + _presenceInspector.Data()^.PassTime := TIME#2s; + _dataInspector.Data()^.PassTime := TIME#2s; - IF(_dialog.Show(THIS) - .WithOk() - .WithType(eDialogType#Success) - .WithCaption('What`s next?') - .WithText('To continue click OK?').Answer() = eDialogAnswer#OK) THEN + _valueInspector.Data()^.NumberOfAllowedRetries := UINT#3; - - THIS.MoveNext(); + THIS.MoveNext(); + //-------------------------------------------- + END_IF; + + IF (Steps[20].Execute(THIS, TRUE, 'RETRY STEP 90')) THEN + + IF(Steps[20].Duration > T#2000ms) THEN + THIS.MoveNext(); END_IF; + + END_IF; - IF (Steps[40].Execute(THIS, TRUE, 'Dummy')) THEN - //------------------------------------------------------- - IF(Steps[40].Duration > T#100ms) THEN - - THIS.MoveNext(); - END_IF; - END_IF; + IF (Steps[30].Execute(THIS, TRUE, 'Example Digital inspection')) THEN + //------------------------------------------------------- + _presenceInspector.WithCoordinator(THIS).Inspect(THIS,_inspectionResult).UpdateComprehensiveResult(_comprehensiveResult).OnFail().Dialog(Steps[20], Steps[145]); + //------------------------------------------------------- + END_IF; - IF (Steps[50].Execute(THIS, TRUE, 'Show dialog 1')) THEN - //------------------------------------------------------- - IF(_dialog1.Show(THIS) - .WithYesNoCancel() - .WithType(eDialogType#Warning) - .WithCaption('YesNoCancel dialog') - .WithText('Click yes to continue?').Answer() = eDialogAnswer#Yes) THEN - - - THIS.MoveNext(); + IF (Steps[40].Execute(THIS, TRUE, 'Example Analog inspection')) THEN + //------------------------------------------------------- + - END_IF; - - END_IF; + _valueInspector.WithCoordinator(THIS).Inspect(THIS,_inspectionValue).UpdateComprehensiveResult(_comprehensiveResult).OnFail().Dialog(Steps[20], Steps[145]); - IF (Steps[60].Execute(THIS, TRUE, 'Dummy')) THEN - //------------------------------------------------------- - IF(Steps[60].Duration > T#100ms) THEN - - THIS.MoveNext(); - END_IF; + //------------------------------------------------------- + END_IF; + + + IF (Steps[50].Execute(THIS, TRUE, 'Example Data inspection')) THEN + //------------------------------------------------------- + + _dataInspector.WithCoordinator(THIS).Inspect(THIS,_inspectionData).UpdateComprehensiveResult(_comprehensiveResult).OnFail().Dialog(Steps[20], Steps[145]); + + //------------------------------------------------------- END_IF; - IF (Steps[70].Execute(THIS, TRUE, 'Show dialog 2')) THEN + + + IF (Steps[60].Execute(THIS, TRUE, 'Show dialog 0')) THEN //------------------------------------------------------- + + IF(_dialog.Show(THIS) + .WithOk() + .WithType(eDialogType#Success) + .WithCaption('What`s next?') + .WithText('To continue click OK?').Answer() = eDialogAnswer#OK) THEN - IF(_dialog2.Show(THIS) - .WithYesNo() - .WithType(eDialogType#Danger) - .WithCaption('YesNo dialog') - .WithText('Click yes to continue?').Answer() = eDialogAnswer#Yes) THEN - - THIS.MoveNext(); - END_IF; + THIS.RequestStep(Steps[149]); + //------------------------------------------------------- + END_IF; + END_IF; + + IF (Steps[145].Execute(THIS, TRUE, 'Restore origin step')) THEN + //------------------------------------------------------- + + ; + // //------------------------------------------------------- END_IF; -//------------------------------------------------------- - + + IF (Steps[149].Execute(THIS, TRUE, 'Dummy end')) THEN + //------------------------------------------------------- + THIS.MoveNext(); + + //------------------------------------------------------- + END_IF; // This will close the sequence and will return to the first step. THIS.Close(Steps[150]); END_METHOD diff --git a/src/ws.code-workspace b/src/ws.code-workspace new file mode 100644 index 000000000..2703b23dd --- /dev/null +++ b/src/ws.code-workspace @@ -0,0 +1,41 @@ +{ + "folders": [ + { + "name": "templates.simple", + "path": "templates.simple/ctrl" + }, + { + "name": "core", + "path": "core/ctrl" + }, + { + "name": "integrations", + "path": "integrations/ctrl" + }, + { + "name": "simatic1500", + "path": "simatic1500/ctrl" + }, + { + "name": "utils", + "path": "utils/ctrl" + }, + { + "name": "data", + "path": "data/ctrl" + }, + { + "name": "probers", + "path": "probers/ctrl" + }, + { + "name": "abstractions", + "path": "abstractions/ctrl" + }, + { + "name": "inspectors", + "path": "inspectors/ctrl" + } + ], + "settings": {} +} \ No newline at end of file