diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 05b02a435..1ac533205 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "AXSharp.ixc": { - "version": "0.14.0-alpha.106", + "version": "0.14.0-alpha.108", "commands": [ "ixc" ] @@ -15,13 +15,13 @@ ] }, "AXSharp.ixd": { - "version": "0.14.0-alpha.107", + "version": "0.14.0-alpha.108", "commands": [ "ixd" ] }, "AXSharp.ixr": { - "version": "0.14.0-alpha.106", + "version": "0.14.0-alpha.108", "commands": [ "ixr" ] diff --git a/docfx/articles/logging/AXOLOGGER.md b/docfx/articles/logging/AXOLOGGER.md index fb1ef8444..564c07ef2 100644 --- a/docfx/articles/logging/AXOLOGGER.md +++ b/docfx/articles/logging/AXOLOGGER.md @@ -39,10 +39,41 @@ The `Foo` method retrieves the context's logger using `THIS.GetContext().GetLogg ## Summary Through this example, we've shown how to declare and utilize the `AxoLogger` for logging messages with different levels of severity. We've also illustrated how nested objects can retrieve and use the logger of their parent context to log messages, showcasing a flexible and potent approach to handle logging in applications with complex, nested structures. + + # Initialization of Logger in .NET In this section, we'll be discussing how to initialize the logger in a .NET application, specifically using the Serilog library for logging. We'll also demonstrate how to link the logger to our `AxoLogger` instances from our previous examples: `LoggerOne` and `LoggerTwo`. +## Initializing Object Identities + +Before you start logging with `AxoLogger`, you need to ensure the object identities are initialized. This is important because it allows the `AxoLogger` to correctly identify the source of log messages, which aids in debugging and log analysis. + +To initialize the object identities in a .NET part of your application, use the following method: + +```csharp +await Entry.Plc.Connector.IdentityProvider.ConstructIdentitiesAsync(); +``` + +This method call is usually performed during the application initialization process, right after the `AxoApplication` and loggers are configured. It constructs all the identities required by the application, preparing the `AxoLogger` for logging. + +Here's how it could fit into the .NET application initialization process: + +```csharp + +// Initialize the object identities. +Entry.Plc.Connector.SubscriptionMode = ReadSubscriptionMode.Polling; +Entry.Plc.Connector.BuildAndStart().ReadWriteCycleDelay = 250; +await Entry.Plc.Connector.IdentityProvider.ConstructIdentitiesAsync(); +``` + +This sets up the `AxoApplication`, configures a logger with Serilog, initializes the object identities, and then connects `AxoLogger` instances to the application. + +Remember to always await the `ConstructIdentitiesAsync` method, as it is an asynchronous operation and your application should not proceed until it has been completed. This ensures all object identities are fully initialized before your `AxoLogger` instances start logging. + +> [!IMPORTANT] +> Failure to initialize object identities before starting the logging process can result in incorrect or incomplete log entries, which can hinder the debugging and analysis of your application. Always ensure that object identities are correctly initialized before you start logging. + ## Creating the AxoApplication Before initializing the logger, we first create an instance of `AxoApplication` using the `CreateBuilder` method. This sets up the application builder required for the logger configuration. @@ -105,6 +136,23 @@ This example showcases how to initialize a logger in a .NET application using th > In the context of logging level configuration, it's important to note that the minimum logging level of the .NET logger (set up in C#) and the `AxoLogger` (set up in the controller's software) are independent settings. You can configure them individually to fine-tune the verbosity of your logs both at the controller level and in your .NET application. +## AxoLogger and AxoMessenger + +AxoMessenger uses Context AxoLogger to log the rising and falling of an alarm. There is no particular need for the configuration fo this behaviour. + +Here are the mappings between eAxoMessageCategory and eLogLevel as per the code: + +- Trace messages are logged as Verbose. +- Debug messages are logged as Debug. +- Info, TimedOut, and Notification messages are logged as - Information. +- Warning messages are logged as Warning. +- Error and ProgrammingError messages are logged as Error. +- Critical, Fatal, and Catastrophic messages are logged as Fatal. + + + + + # Limitations ## Log Entry Limit diff --git a/docfx/articles/messaging/AXOMESSENGER.md b/docfx/articles/messaging/AXOMESSENGER.md index 86bc8c818..f2a354353 100644 --- a/docfx/articles/messaging/AXOMESSENGER.md +++ b/docfx/articles/messaging/AXOMESSENGER.md @@ -53,3 +53,5 @@ Contrariwise, the default behaviour of the unacknowledgeable messenger should be On the UI side use the `RenderableContentControl` and set its Context according the placement of the instance of the `AxoMessenger`. [!code-csharp[](../../../src/integrations/src/AXOpen.Integrations.Blazor/Pages/DocuExamples/AxoMessagingStaticDocu.razor?name=RenderedView)] + +See also [AxoLogger](../logging/AXOLOGGER.md#axologger-and-axomessenger) \ No newline at end of file diff --git a/src/AXOpen.sln b/src/AXOpen.sln index 1666060cf..c7121bc4f 100644 --- a/src/AXOpen.sln +++ b/src/AXOpen.sln @@ -126,7 +126,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "axopen_integrations_blazor" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security.Blazor", "security\src\AXOpen.Security.Blazor\AXOpen.Security.Blazor.csproj", "{7DEF0B7B-0F6C-4829-A1A9-2C0C2720BF3C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AXOpen.Security", "security\src\AXOpen.Security\AXOpen.Security.csproj", "{52B6EFDD-8FF9-4FA7-9624-2E7D8EEDD5C1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security", "security\src\AXOpen.Security\AXOpen.Security.csproj", "{52B6EFDD-8FF9-4FA7-9624-2E7D8EEDD5C1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/abstractions/src/AXOpen.Abstractions/ix_ax_axopen_abstractions.csproj b/src/abstractions/src/AXOpen.Abstractions/ix_ax_axopen_abstractions.csproj index a2c6b19f4..4775c903e 100644 --- a/src/abstractions/src/AXOpen.Abstractions/ix_ax_axopen_abstractions.csproj +++ b/src/abstractions/src/AXOpen.Abstractions/ix_ax_axopen_abstractions.csproj @@ -12,8 +12,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/base/src/AXOpen.Base.Abstractions/AXOpen.Base.Abstractions.csproj b/src/base/src/AXOpen.Base.Abstractions/AXOpen.Base.Abstractions.csproj index 73716d5fa..8c500b2a9 100644 --- a/src/base/src/AXOpen.Base.Abstractions/AXOpen.Base.Abstractions.csproj +++ b/src/base/src/AXOpen.Base.Abstractions/AXOpen.Base.Abstractions.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/base/src/AXOpen.Logging/SerilogLogger.cs b/src/base/src/AXOpen.Logging/SerilogLogger.cs index 29d822f09..b8021e7d7 100644 --- a/src/base/src/AXOpen.Logging/SerilogLogger.cs +++ b/src/base/src/AXOpen.Logging/SerilogLogger.cs @@ -36,7 +36,7 @@ public void Debug(string message, IIdentity identity) public void Debug(string message, ITwinElement sender, IIdentity identity, object details) { Log.Debug($"{message} {{sender}} {{identity}} {{details}}", - new { Symbol = sender.Symbol, Label = sender.HumanReadable }, + new { Symbol = sender?.Symbol, Label = sender?.HumanReadable }, new { UserName = identity.Name, Type = identity.AuthenticationType }, details ); @@ -50,7 +50,7 @@ public void Verbose(string message, IIdentity identity) public void Verbose(string message, ITwinElement sender, IIdentity identity, object details) { Log.Verbose($"{message} {{sender}} {{identity}} {{details}}", - new { Symbol = sender.Symbol, Label = sender.HumanReadable }, + new { Symbol = sender?.Symbol, Label = sender?.HumanReadable }, new { UserName = identity.Name, Type = identity.AuthenticationType }, details ); @@ -64,10 +64,9 @@ public void Information(string message, IIdentity identity) public void Information(string message, ITwinElement sender, IIdentity identity, object details) { Log.Information($"{message} {{sender}} {{identity}} {{details}}", - new { Symbol = sender.Symbol, Label = sender.HumanReadable}, - new { UserName = identity.Name, Type = identity.AuthenticationType }, - details - ); + new { Symbol = sender?.Symbol, Label = sender?.HumanReadable }, + new { UserName = identity.Name, Type = identity.AuthenticationType }, + details); } public void Warning(string message, IIdentity identity) @@ -78,7 +77,7 @@ public void Warning(string message, IIdentity identity) public void Warning(string message, ITwinElement sender, IIdentity identity, object details) { Log.Warning($"{message} {{sender}} {{identity}} {{details}}", - new { Symbol = sender.Symbol, Label = sender.HumanReadable }, + new { Symbol = sender?.Symbol, Label = sender?.HumanReadable }, new { UserName = identity.Name, Type = identity.AuthenticationType }, details ); @@ -92,7 +91,7 @@ public void Error(string message, IIdentity identity) public void Error(string message, ITwinElement sender, IIdentity identity, object details) { Log.Error($"{message} {{sender}} {{identity}} {{details}}", - new { Symbol = sender.Symbol, Label = sender.HumanReadable }, + new { Symbol = sender?.Symbol, Label = sender?.HumanReadable }, new { UserName = identity.Name, Type = identity.AuthenticationType }, details ); @@ -106,7 +105,7 @@ public void Fatal(string message, IIdentity identity) public void Fatal(string message, ITwinElement sender, IIdentity identity, object details) { Log.Fatal($"{message} {{sender}} {{identity}} {{details}}", - new { Symbol = sender.Symbol, Label = sender.HumanReadable }, + new { Symbol = sender?.Symbol, Label = sender?.HumanReadable }, new { UserName = identity.Name, Type = identity.AuthenticationType }, details ); diff --git a/src/core/ctrl/.vscode/launch.json b/src/core/ctrl/.vscode/launch.json deleted file mode 100644 index 62ccba5d4..000000000 --- a/src/core/ctrl/.vscode/launch.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Debug live on PLC", - "type": "plc-debug", - "request": "launch", - "program": "${workspaceFolder}", - "ip": "192.168.0.4" - } - ] -} \ No newline at end of file diff --git a/src/core/ctrl/apax.yml b/src/core/ctrl/apax.yml index 76cee60f6..e395d9de9 100644 --- a/src/core/ctrl/apax.yml +++ b/src/core/ctrl/apax.yml @@ -3,6 +3,7 @@ version: '0.1.4-alpha.79' type: lib targets: - axunit-llvm + - llvm files: - src devDependencies: diff --git a/src/core/ctrl/src/AxoCoordination/AxoSequencer/AxoSequencer.st b/src/core/ctrl/src/AxoCoordination/AxoSequencer/AxoSequencer.st index ee6989877..03e9466f8 100644 --- a/src/core/ctrl/src/AxoCoordination/AxoSequencer/AxoSequencer.st +++ b/src/core/ctrl/src/AxoCoordination/AxoSequencer/AxoSequencer.st @@ -44,6 +44,7 @@ NAMESPACE AXOpen.Core THIS.OnBeforeSequenceStart(); CurrentOrder := ULINT#1; _coordinatorState := AxoCoordinatorStates#Running; + THIS.GetContext().GetLogger().Log('Sequence in config state :', AXOpen.Logging.eLogLevel#Verbose, THIS); END_CASE; Open := TRUE; END_IF; @@ -61,7 +62,7 @@ NAMESPACE AXOpen.Core _step := step; THIS.DetermineOrder(step); - + // Stepping inside the sequence IF _coordinatorState = AxoCoordinatorStates#Running THEN // Stepping is possible only in StepByStepMode @@ -118,6 +119,7 @@ NAMESPACE AXOpen.Core IF step.GetIsActive() AND (step.IsReady() OR step.IsDone() OR SteppingMode = eAxoSteppingMode#StepByStep) THEN IF (SteppingMode = eAxoSteppingMode#Continous) THEN step.Invoke(); + THIS.GetContext().GetLogger().Log('Starts step :', AXOpen.Logging.eLogLevel#Verbose, step); // Invoke the step in a case of step mode when StepIn Command is invoked ELSIF (SteppingMode = eAxoSteppingMode#StepByStep) THEN IF StepIn.Execute() THEN @@ -140,6 +142,7 @@ NAMESPACE AXOpen.Core IF SUPER.Execute() THEN IF THIS.InvalidContext(_step) THEN RETURN; END_IF; IF _coordinatorState = AxoCoordinatorStates#Running THEN + THIS.GetContext().GetLogger().Log('Step done :', AXOpen.Logging.eLogLevel#Verbose, _step); _step.DoneWhen(_step.IsBusy()); _step.SetIsActive(FALSE); CurrentOrder := CurrentOrder + ULINT#1; @@ -158,8 +161,9 @@ NAMESPACE AXOpen.Core END_VAR IF SUPER.Execute() THEN IF THIS.InvalidContext(RequestedStep) THEN RETURN; END_IF; - IF RequestedStep.GetStepOrder() <> ULINT#0 AND + IF RequestedStep.GetStepOrder() <> ULINT#0 AND _coordinatorState = AxoCoordinatorStates#Running THEN + THIS.GetContext().GetLogger().Log('Step request to step :', AXOpen.Logging.eLogLevel#Verbose, RequestedStep); _step.DoneWhen(_step.IsBusy()); _step.SetIsActive(FALSE); CurrentOrder := RequestedStep.GetStepOrder(); @@ -185,6 +189,7 @@ NAMESPACE AXOpen.Core // Finalize the StepIn Command in a case of step mode StepIn.DoneWhen(SteppingMode = eAxoSteppingMode#StepByStep); THIS.OnCompleteSequence(); + THIS.GetContext().GetLogger().Log('Sequence completed :', AXOpen.Logging.eLogLevel#Verbose, THIS); END_IF; END_IF; END_METHOD diff --git a/src/core/ctrl/src/AxoCoordination/AxoStep/AxoStep.st b/src/core/ctrl/src/AxoCoordination/AxoStep/AxoStep.st index 0598b290a..3f0ff63ac 100644 --- a/src/core/ctrl/src/AxoCoordination/AxoStep/AxoStep.st +++ b/src/core/ctrl/src/AxoCoordination/AxoStep/AxoStep.st @@ -138,6 +138,7 @@ NAMESPACE AXOpen.Core VAR_INPUT Active : BOOL; END_VAR + IF(NOT THIS.IsActive AND Active) THEN THIS.GetContext().GetLogger().Log('At step:', AXOpen.Logging.eLogLevel#Verbose, THIS); END_IF; IsActive := Active; END_METHOD diff --git a/src/core/ctrl/src/AxoLogger/AxoLogger.st b/src/core/ctrl/src/AxoLogger/AxoLogger.st index 6fef62c98..f0a4416bf 100644 --- a/src/core/ctrl/src/AxoLogger/AxoLogger.st +++ b/src/core/ctrl/src/AxoLogger/AxoLogger.st @@ -1,4 +1,5 @@ USING AXOpen.Core; +USING AXOpen.Core; NAMESPACE AXOpen.Logging /// @@ -32,10 +33,10 @@ NAMESPACE AXOpen.Logging METHOD PUBLIC Log VAR_INPUT _message : STRING[80]; - _level : eLogLevel; - _sender : IAxoObject; + _level : eLogLevel; + _sender : IAxoObject; END_VAR - + IF(_level >= THIS.MinimumLevel) THEN IF(Carret > 100) THEN Carret := 0; @@ -43,7 +44,7 @@ NAMESPACE AXOpen.Logging LogEntries[Carret].Message := _message; LogEntries[Carret].Level := _level; - + IF(_sender <> NULL) THEN LogEntries[Carret].Sender := _sender.GetIdentity(); END_IF; @@ -52,7 +53,7 @@ NAMESPACE AXOpen.Logging Carret := Carret + 1; END_IF; END_METHOD - + /// /// Log method that captures a message and logging level. /// diff --git a/src/core/ctrl/src/AxoMessaging/Static/AxoMessenger.st b/src/core/ctrl/src/AxoMessaging/Static/AxoMessenger.st index 13a461a09..3368f52cb 100644 --- a/src/core/ctrl/src/AxoMessaging/Static/AxoMessenger.st +++ b/src/core/ctrl/src/AxoMessaging/Static/AxoMessenger.st @@ -4,7 +4,7 @@ USING AXOpen.Core; NAMESPACE AXOpen.Messaging.Static {#ix-prop: public string MessageText } {#ix-prop: public string Help } - CLASS AxoMessenger IMPLEMENTS AXOpen.Messaging.Static.IAxoMessageProperties + CLASS AxoMessenger EXTENDS AxoObject IMPLEMENTS AXOpen.Messaging.Static.IAxoMessageProperties VAR PUBLIC {#ix-attr:[ReadOnly()]} IsActive : BOOL; @@ -24,12 +24,12 @@ NAMESPACE AXOpen.Messaging.Static {#ix-attr:[ReadOnly()]} AcknowledgedBeforeFallen : BOOL; {#ix-attr:[ReadOnly()]} - Acknowledged : LDATE_AND_TIME; + Acknowledged : LDATE_AND_TIME; END_VAR VAR PRIVATE ActiveContextCount : ULINT; - Context : IAxoContext; + Context : IAxoContext; END_VAR METHOD PUBLIC Serve @@ -63,7 +63,9 @@ NAMESPACE AXOpen.Messaging.Static IF AXOpen.Core.IsNullContext(_object.GetContext()) THEN RETURN; END_IF; - THIS.Serve(_object.GetContext()); + THIS.Initialize(_object); + + THIS.Serve(_object.GetContext()); END_METHOD METHOD PUBLIC Activate : AXOpen.Messaging.Static.IAxoMessageProperties @@ -83,7 +85,7 @@ NAMESPACE AXOpen.Messaging.Static Fallen := LDATE_AND_TIME#1970-01-01-00:00:00.000; Acknowledged := LDATE_AND_TIME#1970-01-01-00:00:00.000; WaitingForAcknowledge := FALSE; - Context.GetLogger().Log('Risen', THIS.ToLogLevel(_category)); + Context.GetLogger().Log('Risen', THIS.ToLogLevel(_category), THIS); END_IF; ActiveContextCount := Context.OpenCycleCount(); @@ -101,10 +103,7 @@ NAMESPACE AXOpen.Messaging.Static VAR_INPUT _messageCategory : eAxoMessageCategory; END_VAR - VAR - - END_VAR - + CASE _messageCategory OF eAxoMessageCategory#Trace : ToLogLevel := eLogLevel#Verbose; @@ -132,7 +131,6 @@ NAMESPACE AXOpen.Messaging.Static END_METHOD - METHOD PUBLIC ActivateOnCondition : AXOpen.Messaging.Static.IAxoMessageProperties VAR_INPUT _condition : BOOL; @@ -176,7 +174,8 @@ NAMESPACE AXOpen.Messaging.Static IF IsActive THEN IsActive := FALSE; ActiveContextCount := ULINT#0; - Fallen := Context.GetRtc().NowUTC(); + Fallen := Context.GetRtc().NowUTC(); + Context.GetLogger().Log('Fallen', eLogLevel#Information, THIS); IF AcknowledgementRequired AND NOT AcknowledgedBeforeFallen THEN WaitingForAcknowledge := TRUE; END_IF; diff --git a/src/core/ctrl/src/AxoObject/AxoObject.st b/src/core/ctrl/src/AxoObject/AxoObject.st index a45ae52c5..215023147 100644 --- a/src/core/ctrl/src/AxoObject/AxoObject.st +++ b/src/core/ctrl/src/AxoObject/AxoObject.st @@ -6,10 +6,9 @@ NAMESPACE AXOpen.Core /// CLASS PUBLIC AxoObject IMPLEMENTS IAxoObject VAR PUBLIC - {#ix-attr:[CompilerOmits("POCO")]} - {#ix-attr:[ReadOnly()]} + {#ix-attr:[CompilerOmits("POCO")]} {#ix-attr:[RenderIgnore()]} - Identity : ULINT := ULINT#0; + Identity : ULINT := ULINT#0; END_VAR VAR PRIVATE @@ -25,7 +24,7 @@ NAMESPACE AXOpen.Core /// /// Gets unique identity of this object in given context. /// - METHOD PUBLIC GetIdentity : ULINT + METHOD PUBLIC GetIdentity : ULINT GetIdentity := Identity; END_METHOD @@ -59,15 +58,13 @@ NAMESPACE AXOpen.Core METHOD PUBLIC Initialize VAR_INPUT parent : IAxoObject; - END_VAR - - IF(Identity = ULINT#0 AND parent <> NULL) THEN - _context := parent.GetContext(); - Identity := _context.CreateIdentity(); + END_VAR + // CHANGE: Identity is now provided by the higher level application. + IF(parent <> NULL) THEN + _context := parent.GetContext(); _parent := parent; RETURN; - END_IF; - + END_IF; END_METHOD /// @@ -79,12 +76,10 @@ NAMESPACE AXOpen.Core VAR_INPUT context : IAxoContext; END_VAR - - IF(Identity = ULINT#0 AND context <> NULL) THEN - _context := context; - Identity := _context.CreateIdentity(); + // CHANGE: Identity is now provided by the higher level application. + IF(context <> NULL) THEN + _context := context; END_IF; - END_METHOD END_CLASS END_NAMESPACE \ No newline at end of file diff --git a/src/core/ctrl/src/AxoTask/AxoTask.st b/src/core/ctrl/src/AxoTask/AxoTask.st index ca2df2d16..62dd729e5 100644 --- a/src/core/ctrl/src/AxoTask/AxoTask.st +++ b/src/core/ctrl/src/AxoTask/AxoTask.st @@ -66,7 +66,7 @@ NAMESPACE AXOpen.Core VAR PRIVATE _openCycleCountInvoke : ULINT; _openCycleCountExecute : ULINT; - _taskTimer : System.Timer.OnDelay; + _taskTimer : System.Timer.OnDelay; END_VAR /// @@ -203,10 +203,10 @@ NAMESPACE AXOpen.Core // task should not be Invoked, if the execute method was not called in this or previous PLC cycle IF Status = eAxoTaskState#Ready THEN IF (THIS.IsExecuteCalledInThisPlcCycle() OR THIS.WasExecuteCalledInPreviousPlcCycle()) THEN - Status := eAxoTaskState#Kicking; - THIS.GetContext().GetLogger().Log('Task invoked', eLogLevel#Verbose, THIS); + Status := eAxoTaskState#Kicking; + THIS.LogTask('Task invoked', eLogLevel#Verbose, THIS); ELSE - ; //TODO - raise a message that the Execute() method is not called + THIS.LogTask('Cyclic execute is not called', eLogLevel#Debug, THIS); END_IF; END_IF; @@ -218,7 +218,7 @@ NAMESPACE AXOpen.Core /// METHOD PUBLIC Restore : IAxoTaskState IF(Status <> eAxoTaskState#Ready AND Status <> eAxoTaskState#Disabled) THEN - THIS.GetContext().GetLogger().Log('Task restored', eLogLevel#Verbose, THIS); + THIS.LogTask('Task restored', eLogLevel#Verbose, THIS); END_IF; Status := eAxoTaskState#Ready; ErrorDetails := ''; @@ -237,7 +237,7 @@ NAMESPACE AXOpen.Core END_VAR IF Condition AND Status = eAxoTaskState#Busy THEN - THIS.GetContext().GetLogger().Log('Task done.', eLogLevel#Verbose, THIS); + THIS.LogTask('Task done.', eLogLevel#Verbose, THIS); Status := eAxoTaskState#Done; THIS.OnDone(); END_IF; @@ -272,7 +272,7 @@ NAMESPACE AXOpen.Core // Don't touch this, it is used for remote execs. StartSignature := THIS.GetContext().OpenCycleCount(); - THIS.GetContext().GetLogger().Log('Task started.', eLogLevel#Verbose, THIS); + THIS.LogTask('Task started.', eLogLevel#Verbose, THIS); THIS.OnStart(); END_IF; @@ -286,6 +286,20 @@ NAMESPACE AXOpen.Core IF(Execute) THEN Duration := _taskTimer.ElapsedTime; END_IF; END_METHOD + METHOD PRIVATE LogTask + VAR_INPUT + _message : STRING[80]; + _level : eLogLevel; + _sender : IAxoObject; + END_VAR + VAR + _castIIAxoStep : IAxoStep; + END_VAR + _castIIAxoStep ?= _sender; + IF(_castIIAxoStep <> NULL) THEN RETURN; END_IF; + THIS.GetContext().GetLogger().Log(_message, _level, THIS); + END_METHOD + /// /// Makes this task enter into `Error` state, when `HasErrorState` argument is `TRUE` /// task in error state stops its execution. @@ -297,13 +311,13 @@ NAMESPACE AXOpen.Core IF(HasErrorState) THEN Status := eAxoTaskState#Error; - THIS.GetContext().GetLogger().Log('Task failed', eLogLevel#Verbose, THIS); + THIS.LogTask('Task failed', eLogLevel#Error, THIS); THIS.OnError(); THIS.WhileError(); END_IF; END_METHOD - /// + /// /// Makes this task enter into `Error` state, when `HasErrorState` argument is `TRUE` /// task in error state stops its execution. /// @@ -314,7 +328,7 @@ NAMESPACE AXOpen.Core END_VAR IF(HasErrorState) THEN ErrorDetails := ErrorDescription; - THIS.GetContext().GetLogger().Log(ErrorDetails, eLogLevel#Verbose, THIS); + THIS.LogTask(ErrorDetails, eLogLevel#Verbose, THIS); END_IF; THIS.ThrowWhen(HasErrorState); END_METHOD diff --git a/src/core/ctrl/src/abstractions/AxoLogger/IAxoLogger.st b/src/core/ctrl/src/abstractions/AxoLogger/IAxoLogger.st index 7e80d4acb..17a5aa0ef 100644 --- a/src/core/ctrl/src/abstractions/AxoLogger/IAxoLogger.st +++ b/src/core/ctrl/src/abstractions/AxoLogger/IAxoLogger.st @@ -1,26 +1,76 @@ +/// +/// Import the core functionality of AXOpen +/// USING AXOpen.Core; USING AXOpen.Core; + +/// +/// Defines the AXOpen.Logging namespace +/// NAMESPACE AXOpen.Logging + + /// + /// Defines the IAxoLogger interface + /// This interface extends IAxoLoggerConfig + /// INTERFACE PUBLIC IAxoLogger EXTENDS IAxoLoggerConfig + + /// + /// Defines the Log method + /// This method takes a message, a log level, and a sender as input + /// METHOD Log VAR_INPUT + /// + /// _message is a string of maximum 80 characters that represents the log message + /// _message : STRING[80]; + + /// + /// _level is an instance of eLogLevel that represents the level of the log + /// _level : eLogLevel; + + /// + /// _sender is an instance of IAxoObject that represents the sender of the log + /// _sender : IAxoObject; END_VAR END_METHOD - + + /// + /// Defines another Log method + /// This method takes a message and a log level as input + /// METHOD Log VAR_INPUT + /// + /// _message is a string of maximum 80 characters that represents the log message + /// _message : STRING[80]; + + /// + /// _level is an instance of eLogLevel that represents the level of the log + /// _level : eLogLevel; END_VAR END_METHOD END_INTERFACE + /// + /// Defines the IAxoLoggerConfig interface + /// INTERFACE IAxoLoggerConfig + + /// + /// Defines the SetMinimumLevel method + /// This method takes a log level as input and returns an instance of IAxoLoggerConfig + /// METHOD SetMinimumLevel : IAxoLoggerConfig VAR_INPUT + /// + /// _level is an instance of eLogLevel that represents the minimum level of the log + /// _level : eLogLevel; END_VAR END_METHOD diff --git a/src/core/ctrl/src/abstractions/NULLs.st b/src/core/ctrl/src/abstractions/NULLs.st index 9620dae7b..41c1ff2dd 100644 --- a/src/core/ctrl/src/abstractions/NULLs.st +++ b/src/core/ctrl/src/abstractions/NULLs.st @@ -55,10 +55,10 @@ NAMESPACE AXOpen.Core _message : STRING[80]; _level : eLogLevel; _sender : IAxoObject; - END_VAR - ; + END_VAR + ; END_METHOD - + METHOD PUBLIC Log VAR_INPUT _message : STRING[80]; diff --git a/src/core/ctrl/test/AxoCoordination/AxoStepTests.st b/src/core/ctrl/test/AxoCoordination/AxoStepTests.st index d36b970e2..8742f44eb 100644 --- a/src/core/ctrl/test/AxoCoordination/AxoStepTests.st +++ b/src/core/ctrl/test/AxoCoordination/AxoStepTests.st @@ -1,3 +1,4 @@ +USING AXOpen.Logging; USING AXOpen.Core; USING AXOpen.Rtc; USING AxUnit; @@ -136,6 +137,6 @@ NAMESPACE AXOpen.Core.AxoStep_Tests Assert.Equal('StepOne-new description', _stepOne.StepDescription); Assert.Equal('StepTwo', _stepTwo.StepDescription); Assert.Equal('StepThree', _stepThree.StepDescription); - END_METHOD - END_CLASS + END_METHOD + END_CLASS END_NAMESPACE diff --git a/src/core/ctrl/test/AxoObject/AxoObjectTests.st b/src/core/ctrl/test/AxoObject/AxoObjectTests.st index f8bb380bb..9ec05eb89 100644 --- a/src/core/ctrl/test/AxoObject/AxoObjectTests.st +++ b/src/core/ctrl/test/AxoObject/AxoObjectTests.st @@ -14,7 +14,7 @@ NAMESPACE AXOpen.Core.AxoObject_Tests END_CLASS {TestFixture} - CLASS IxObjectUnitTests EXTENDS AxoObject + CLASS AxoObjectUnitTests EXTENDS AxoObject VAR PRIVATE _context : TestObjContext; END_VAR @@ -30,7 +30,7 @@ NAMESPACE AXOpen.Core.AxoObject_Tests END_VAR {Test} - METHOD PUBLIC should_assign_identity_upon_initialization_call + METHOD PUBLIC should_assign_context_upon_initialization_call VAR sut : REF_TO TestObject; expectedIdentity : ULINT; @@ -42,27 +42,10 @@ NAMESPACE AXOpen.Core.AxoObject_Tests // Act/Assert sut^.Initialize(THIS); - Assert.Equal(expectedIdentity, sut^.GetIdentity()); - END_METHOD - - {Test} - METHOD PUBLIC should_not_change_identity_on_repeated_call_of_initialization - VAR - sut : REF_TO TestObject; - expectedIdentity : ULINT; - END_VAR - - // Arrange - sut := REF(_not_assign_identity_repeated_init); - expectedIdentity := THIS.GetContext().CreateIdentity() + ULINT#1; - - // Act/Assert - sut^.Initialize(THIS); - Assert.Equal(sut^.GetIdentity(), expectedIdentity); - sut^.Initialize(THIS); - Assert.Equal(sut^.GetIdentity(), expectedIdentity); + Assert.Equal(true, sut^.GetContext() = THIS.GetContext()); END_METHOD + {Test} METHOD PUBLIC should_not_crush_uninitialized_object VAR @@ -81,26 +64,7 @@ NAMESPACE AXOpen.Core.AxoObject_Tests Assert.Equal(sut^.GetContext().CreateIdentity(), expectedIdentity); Assert.Equal(sut^.GetIdentity(), expectedIdentity); - END_METHOD - - {Test} - METHOD PUBLIC should_initialize_object_with_context_as_parent - VAR - sut : REF_TO TestObject; - expectedIdentity : ULINT; - END_VAR - ; - // Arrange - sut := REF(_initialize_object_with_context); - expectedIdentity := _context.PeekIdentity() + ULINT#1; - - // Act/Assert - sut^.Initialize(_context); - sut^.GetContext(); - - Assert.Equal(sut^.GetIdentity(), expectedIdentity); - - END_METHOD + END_METHOD END_CLASS END_NAMESPACE diff --git a/src/core/src/AXOpen.Core.Blazor/AxoCoordination/AxoSequencer/AxoSequencerView.razor b/src/core/src/AXOpen.Core.Blazor/AxoCoordination/AxoSequencer/AxoSequencerView.razor index 4a9d97ff7..35bebc8c8 100644 --- a/src/core/src/AXOpen.Core.Blazor/AxoCoordination/AxoSequencer/AxoSequencerView.razor +++ b/src/core/src/AXOpen.Core.Blazor/AxoCoordination/AxoSequencer/AxoSequencerView.razor @@ -77,6 +77,8 @@ } } + + 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 cc77a7dad..557b083bc 100644 --- a/src/core/src/AXOpen.Core.Blazor/axopen_core_blazor.csproj +++ b/src/core/src/AXOpen.Core.Blazor/axopen_core_blazor.csproj @@ -23,8 +23,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/core/src/AXOpen.Core/AxoLogger/AxoLogger.cs b/src/core/src/AXOpen.Core/AxoLogger/AxoLogger.cs index b7c341ace..ec9a33327 100644 --- a/src/core/src/AXOpen.Core/AxoLogger/AxoLogger.cs +++ b/src/core/src/AXOpen.Core/AxoLogger/AxoLogger.cs @@ -4,6 +4,8 @@ using System.Security.Principal; using System.Text; using System.Threading.Tasks; +using AXOpen.Core; +using AXOpen.Messaging.Static; using AXSharp.Connector; namespace AXOpen.Logging @@ -34,35 +36,59 @@ await Task.Run(async () => { await this.ReadAsync(); + var index = 0; foreach (var entry in this.LogEntries.Where(p => p.ToDequeue.LastValue)) { - var sender = entry.GetConnector().IdentityProvider.GetTwinByIdentity(entry.Sender); - var senderSymbol = string.Empty; //sender?.Symbol; //TODO: Implement when ready with Identities. - switch ((eLogLevel)entry.Level.LastValue) + var sender = entry.GetConnector().IdentityProvider.GetTwinByIdentity(entry.Sender.LastValue) as ITwinObject; + var message = string.Empty; + var level = (eLogLevel)entry.Level.LastValue; + + switch (sender) { - case eLogLevel.Verbose: - _logger.Verbose($"{entry.Message.LastValue} : {senderSymbol}", sender, new GenericIdentity("Controller")); - break; - case eLogLevel.Debug: - _logger.Debug($"{entry.Message.LastValue} : {senderSymbol}", sender, new GenericIdentity("Controller")); + case AxoMessenger messenger: + message = $"{entry.Message.LastValue} : {messenger.MessageText}"; break; - case eLogLevel.Information: - _logger.Information($"{entry.Message.LastValue} : {senderSymbol}", sender, new GenericIdentity("Controller")); + case AxoStep step: + message = $"{entry.Message.LastValue} : {step.StepDescription.LastValue ?? step.Description}"; break; - case eLogLevel.Warning: - _logger.Warning($"{entry.Message.LastValue} : {senderSymbol}", sender, new GenericIdentity("Controller")); + case null: + message = $"!!!{message} : [no identity provided '{entry.Sender.LastValue}']"; break; - case eLogLevel.Error: - _logger.Error($"{entry.Message.LastValue} : {senderSymbol}", sender, new GenericIdentity("Controller")); - break; - case eLogLevel.Fatal: - _logger.Fatal($"{entry.Message.LastValue} : {senderSymbol}", sender, new GenericIdentity("Controller")); + default: + message = entry.Message.LastValue; break; } + CreateLogEntry(level, $"{message}", sender); + await entry.ToDequeue.SetAsync(false); } }); } + + private void CreateLogEntry(eLogLevel level, string message, ITwinObject? sender) + { + switch (level) + { + case eLogLevel.Verbose: + _logger.Verbose($"{message}", sender, new GenericIdentity("Controller")); + break; + case eLogLevel.Debug: + _logger.Debug($"{message}", sender, new GenericIdentity("Controller")); + break; + case eLogLevel.Information: + _logger.Information($"{message}", sender, new GenericIdentity("Controller")); + break; + case eLogLevel.Warning: + _logger.Warning($"{message}", sender, new GenericIdentity("Controller")); + break; + case eLogLevel.Error: + _logger.Error($"{message}", sender, new GenericIdentity("Controller")); + break; + case eLogLevel.Fatal: + _logger.Fatal($"{message}", sender, new GenericIdentity("Controller")); + break; + } + } } } diff --git a/src/core/src/AXOpen.Core/AxoObject/AxoObject.cs b/src/core/src/AXOpen.Core/AxoObject/AxoObject.cs index 784247924..8537f9035 100644 --- a/src/core/src/AXOpen.Core/AxoObject/AxoObject.cs +++ b/src/core/src/AXOpen.Core/AxoObject/AxoObject.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; using AXSharp.Connector; namespace AXOpen.Core diff --git a/src/core/src/AXOpen.Core/AxoRemoteTask/AxoRemoteTask.cs b/src/core/src/AXOpen.Core/AxoRemoteTask/AxoRemoteTask.cs index 9430ae8d9..d5f15e667 100644 --- a/src/core/src/AXOpen.Core/AxoRemoteTask/AxoRemoteTask.cs +++ b/src/core/src/AXOpen.Core/AxoRemoteTask/AxoRemoteTask.cs @@ -1,6 +1,7 @@ using System; using AXSharp.Connector; using System.ComponentModel; +using System.Security.Principal; using System.Threading.Tasks; namespace AXOpen.Core @@ -107,7 +108,7 @@ private async void ExecuteAsync(AXSharp.Connector.ITwinPrimitive sender, AXSharp await this.ErrorDetails.SetAsync(ex.Message); RemoteExecutionException = ex; RemoteExceptionDetails = ex.ToString(); - // TODO: Add logging + AxoApplication.Current.Logger.Error(ex.ToString(), this, new GenericIdentity("Controller")); return; } finally diff --git a/src/core/src/AXOpen.Core/ix_ax_axopen_core.csproj b/src/core/src/AXOpen.Core/ix_ax_axopen_core.csproj index 195580b28..f7c765233 100644 --- a/src/core/src/AXOpen.Core/ix_ax_axopen_core.csproj +++ b/src/core/src/AXOpen.Core/ix_ax_axopen_core.csproj @@ -8,8 +8,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/core/tests/AXOpen.Core.Tests/AxoLogger/AxoLoggerTests.cs b/src/core/tests/AXOpen.Core.Tests/AxoLogger/AxoLoggerTests.cs index a1527bd21..fcd3e45f4 100644 --- a/src/core/tests/AXOpen.Core.Tests/AxoLogger/AxoLoggerTests.cs +++ b/src/core/tests/AXOpen.Core.Tests/AxoLogger/AxoLoggerTests.cs @@ -49,12 +49,13 @@ public async Task CanCallDequeue() await _testClass.LogEntries[0].Message.SetAsync($"this is {level} message"); await _testClass.LogEntries[0].ToDequeue.SetAsync(true); await _testClass.LogEntries[0].Level.SetAsync((short)level); + await _testClass.LogEntries[0].Sender.SetAsync((ulong)0); // Act await _testClass.Dequeue(); // Assert var logger = AxoApplication.Current.Logger as DummyLogger; - Assert.Equal($"this is {level} message : ", logger.LastMessage); + Assert.Equal($"!!! : [no identity provided '0']", logger.LastMessage); Assert.Equal(level.ToString(), logger.LastCategory); Assert.False(await _testClass.LogEntries[0].ToDequeue.GetAsync()); } diff --git a/src/data/src/AXOpen.Data/ix_ax_axopen_data.csproj b/src/data/src/AXOpen.Data/ix_ax_axopen_data.csproj index a11df6861..104ffce91 100644 --- a/src/data/src/AXOpen.Data/ix_ax_axopen_data.csproj +++ b/src/data/src/AXOpen.Data/ix_ax_axopen_data.csproj @@ -12,8 +12,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/integrations/src/AXOpen.Integrations.Blazor/Program.cs b/src/integrations/src/AXOpen.Integrations.Blazor/Program.cs index 0235aa887..dcf6dcb1f 100644 --- a/src/integrations/src/AXOpen.Integrations.Blazor/Program.cs +++ b/src/integrations/src/AXOpen.Integrations.Blazor/Program.cs @@ -16,7 +16,7 @@ namespace axopen_integrations_blazor { public class Program { - public static void Main(string[] args) + public static async Task Main(string[] args) { var builder = WebApplication.CreateBuilder(args); @@ -39,7 +39,7 @@ public static void Main(string[] args) Entry.Plc.Connector.SubscriptionMode = AXSharp.Connector.ReadSubscriptionMode.Polling; - Entry.Plc.Connector.IdentityProvider.ReadIdentities(); + await Entry.Plc.Connector.IdentityProvider.ConstructIdentitiesAsync(); var repository = Ix.Repository.Json.Repository.Factory(new AXOpen.Data.Json.JsonRepositorySettings(Path.Combine(Environment.CurrentDirectory, "data", "processdata"))); var repository2 = Ix.Repository.Json.Repository.Factory(new AXOpen.Data.Json.JsonRepositorySettings(Path.Combine(Environment.CurrentDirectory, "data", "testdata"))); diff --git a/src/integrations/src/AXOpen.Integrations.Blazor/axopen_integrations_blazor.csproj b/src/integrations/src/AXOpen.Integrations.Blazor/axopen_integrations_blazor.csproj index d7a4e142d..c3d02cadf 100644 --- a/src/integrations/src/AXOpen.Integrations.Blazor/axopen_integrations_blazor.csproj +++ b/src/integrations/src/AXOpen.Integrations.Blazor/axopen_integrations_blazor.csproj @@ -37,7 +37,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/integrations/src/AXOpen.Integrations/axopen_integrations.csproj b/src/integrations/src/AXOpen.Integrations/axopen_integrations.csproj index 4d10ef393..651dac583 100644 --- a/src/integrations/src/AXOpen.Integrations/axopen_integrations.csproj +++ b/src/integrations/src/AXOpen.Integrations/axopen_integrations.csproj @@ -10,9 +10,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/src/probers/src/AXOpen.Probers/ix_ax_axopen_probers.csproj b/src/probers/src/AXOpen.Probers/ix_ax_axopen_probers.csproj index 5119c0c03..76e24d03a 100644 --- a/src/probers/src/AXOpen.Probers/ix_ax_axopen_probers.csproj +++ b/src/probers/src/AXOpen.Probers/ix_ax_axopen_probers.csproj @@ -12,8 +12,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/probers/tests/AXOpen.Probers.Tests/axopen_probers_tests.csproj b/src/probers/tests/AXOpen.Probers.Tests/axopen_probers_tests.csproj index e0983611f..51e98b5d5 100644 --- a/src/probers/tests/AXOpen.Probers.Tests/axopen_probers_tests.csproj +++ b/src/probers/tests/AXOpen.Probers.Tests/axopen_probers_tests.csproj @@ -27,7 +27,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/templates.simple/.config/dotnet-tools.json b/src/templates.simple/.config/dotnet-tools.json index 2471dccb7..5d8547c6c 100644 --- a/src/templates.simple/.config/dotnet-tools.json +++ b/src/templates.simple/.config/dotnet-tools.json @@ -3,13 +3,13 @@ "isRoot": true, "tools": { "AXSharp.ixc": { - "version": "0.14.0-alpha.103", + "version": "0.14.0-alpha.108", "commands": [ "ixc" ] }, "AXSharp.ixr": { - "version": "0.14.0-alpha.103", + "version": "0.14.0-alpha.108", "commands": [ "ixr" ] diff --git a/src/templates.simple/axosimple.app/Pages/UI/ManipulatorExample.razor b/src/templates.simple/axosimple.app/Pages/UI/ManipulatorExample.razor index 712184e5d..fc0bbad70 100644 --- a/src/templates.simple/axosimple.app/Pages/UI/ManipulatorExample.razor +++ b/src/templates.simple/axosimple.app/Pages/UI/ManipulatorExample.razor @@ -3,10 +3,10 @@ @using AXOpen.Data; @using AXOpen.Messaging.Static @using AXSharp.Connector; -@inherits RenderableComponentBase; +@*@inherits RenderableComponentBase;*@ - - + + @**@ @foreach (var message in Messengers) @@ -23,7 +23,7 @@ protected override Task OnInitializedAsync() { - this.UpdateValuesOnChange(@Entry.Plc.Context.PneumaticManipulator); + //this.UpdateValuesOnChange(@Entry.Plc.Context.PneumaticManipulator); return base.OnInitializedAsync(); } } diff --git a/src/templates.simple/axosimple.app/Program.cs b/src/templates.simple/axosimple.app/Program.cs index 01c071109..c5a1d3166 100644 --- a/src/templates.simple/axosimple.app/Program.cs +++ b/src/templates.simple/axosimple.app/Program.cs @@ -1,4 +1,4 @@ -using System.Reflection; + using System.Reflection; using AXOpen; using AXOpen.Base.Data; using AXOpen.Data.InMemory; @@ -10,11 +10,15 @@ using AXSharp.Connector; using AXSharp.Presentation.Blazor.Services; using axosimple; +using axosimple.hmi; +using AXSharp.Connector.Identity; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Identity; using Serilog; +using System.Security.Principal; +using AXOpen.Core; var builder = WebApplication.CreateBuilder(args); @@ -27,7 +31,7 @@ Entry.Plc.Connector.SubscriptionMode = ReadSubscriptionMode.Polling; Entry.Plc.Connector.BuildAndStart().ReadWriteCycleDelay = 250; -Entry.Plc.Connector.IdentityProvider.ReadIdentities(); +await Entry.Plc.Connector.IdentityProvider.ConstructIdentitiesAsync(); AxoApplication.CreateBuilder().ConfigureLogger(new SerilogLogger(new LoggerConfiguration() .WriteTo.Console().MinimumLevel.Verbose() @@ -36,7 +40,7 @@ var productionDataRepository = new InMemoryRepositorySettings ().Factory(); var headerDataRepository = new InMemoryRepositorySettings().Factory(); -Entry.Plc.ContextLogger.StartDequeuing(AxoApplication.Current.Logger, 10); +Entry.Plc.ContextLogger.StartDequeuing(AxoApplication.Current.Logger, 250); var a = Entry.Plc.Context.PneumaticManipulator .ProcessData diff --git a/src/templates.simple/axosimple.twin/axosimple.csproj b/src/templates.simple/axosimple.twin/axosimple.csproj index 49bdfb31c..e00f0d730 100644 --- a/src/templates.simple/axosimple.twin/axosimple.csproj +++ b/src/templates.simple/axosimple.twin/axosimple.csproj @@ -5,9 +5,9 @@ enable - - - + + + diff --git a/src/templates.simple/ctrl/monitor.mon b/src/templates.simple/ctrl/monitor.mon index a374dc09a..fcc8c22d2 100644 --- a/src/templates.simple/ctrl/monitor.mon +++ b/src/templates.simple/ctrl/monitor.mon @@ -1,4 +1,4 @@ -Context.PneumaticManipulator.AutomatSequence +ContextLogger.LogEntries # Context.PneumaticManipulator.ProcessData.Operation #Context.PneumaticManipulator.ProcessData.Data.CreateTask.ErrorDetails #Context.PneumaticManipulator.ProcessData.Shared.CreateTask.ErrorDetails diff --git a/src/templates.simple/ctrl/src/Context.st b/src/templates.simple/ctrl/src/Context.st index af6fc615a..8023a834e 100644 --- a/src/templates.simple/ctrl/src/Context.st +++ b/src/templates.simple/ctrl/src/Context.st @@ -17,10 +17,10 @@ NAMESPACE axosimple END_IF; END_METHOD END_CLASS - - + CLASS SharedProductionData EXTENDS AXOpen.Data.AxoDataEntity VAR PUBLIC + ComesFrom : INT; GoesTo : INT; END_VAR diff --git a/src/templates.simple/ctrl/src/Examples/PneumaticManipulator.st b/src/templates.simple/ctrl/src/Examples/PneumaticManipulator.st index 6c33518e1..c7fc833c6 100644 --- a/src/templates.simple/ctrl/src/Examples/PneumaticManipulator.st +++ b/src/templates.simple/ctrl/src/Examples/PneumaticManipulator.st @@ -226,7 +226,7 @@ NAMESPACE examples.PneumaticManipulator _components : REF_TO Components; _processData : REF_TO ProcessDataManger; _parent : IAxoObject; - END_VAR + END_VAR Components := _components; ProcessData := _processData; SUPER.Run(_parent); @@ -236,10 +236,10 @@ NAMESPACE examples.PneumaticManipulator /// METHOD PROTECTED OVERRIDE Main - IF (Components = NULL OR ProcessData = NULL) THEN - RETURN; - END_IF; - // This sequecner executes the steps in cycles from top to botton + // IF (Components = NULL OR ProcessData = NULL) THEN + // RETURN; + // END_IF; + // This sequecner executes the steps in cycles from top to bottom // in the same order they are written in the program // Each step in the sequence must can be used only once. // This sets the sequence to run once (top-botton) and stops with done after closing. diff --git a/src/templates.simple/ctrl/src/program.st b/src/templates.simple/ctrl/src/program.st index 32fe4df1f..222d89a29 100644 --- a/src/templates.simple/ctrl/src/program.st +++ b/src/templates.simple/ctrl/src/program.st @@ -11,11 +11,11 @@ PROGRAM MyProgram Context.Inputs := REF(Inputs); Context.Outputs := REF(Outputs); - ContextLogger.SetMinimumLevel(AXOpen.Logging.eLogLevel#Warning); + ContextLogger.SetMinimumLevel(AXOpen.Logging.eLogLevel#Verbose); Context.InjectRtc(S71500Rtc); Context.InjectLogger(ContextLogger); // Executes the main context of this application. Context.Run(); - + END_PROGRAM diff --git a/src/utils/src/AXOpen.Utils/ix_ax_axopen_utils.csproj b/src/utils/src/AXOpen.Utils/ix_ax_axopen_utils.csproj index 173443169..27ec5971a 100644 --- a/src/utils/src/AXOpen.Utils/ix_ax_axopen_utils.csproj +++ b/src/utils/src/AXOpen.Utils/ix_ax_axopen_utils.csproj @@ -12,8 +12,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + +