Replies: 3 comments 1 reply
-
Hi Peter, not 100% sure about your concrete usecase, but the following will probably not solve it I assume: @theBadT Greetings |
Beta Was this translation helpful? Give feedback.
-
Thanks @BeckerStS The use case is the following. We would like to prevent NULL access in certain cases by returning a dummy object instead of NULL. This approach would prevent the PLC program from going wild when an object is not properly initialized (we would handle the error differently without stopping the PLC). Here we have a definition of a dummy object And this is how an uninitialized object will return it: The problem with this approach is that we are polluting all objects with the dummy instance. This is why we would like to have some fixed reference (a shared dummy object) to return when necessary. CoDeSys has VAR_STAT that behaves like There may be some other way to address this issue, but we would like to avoid adding parameters to initialization, additional method calls, or assignments. |
Beta Was this translation helpful? Give feedback.
-
The IEC61131-3 does not support that feature. But CodeSys states that they have extended the IEC. So the question is: are there some improvements planned for the IEC in a newer version? @theBadT @drsoran Static members/methods, properties, constructors (instead of initializers) and delegates could improve the ST language itself. |
Beta Was this translation helpful? Give feedback.
-
Hi AX team!
Is there a way to declare something known as shared members? There is a
VAR END_VAR
section that can declare variables that in the terminology of AX are variables that are shared among multiple cycles.We would, however, need to have variables that would be shared among the type of the same class. These are known as
static
in C# or shared in VB.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions