Is it possible to show a log of the activity of an variable as a list on the HMI page. Time and status?
Hello, Sorry for the delay. Here is the answer from the developers:
As trending and datalogger are not implemented yet, the datalogging will need to be performed in the PLC Logic. Attached is an example of a function block that logs to an array of structures. In the HMI, the applicaton, we created a local symbol to represent one array element of the structure. We then used the symbol list object to display the values of the array. Sample project written in PLC Next Engineer 2020.3 attached
To retrieve the sample project:
* Download the attachment below.
* Remove.pngfrom the file name.
Hope this helps. ~ Martin.
Hi I’ve tried to understand this code but my skills at st code is not good. I’m always using NOLD code!!! Is it possible that you can explain how you are building the code?
Hello, Sorry for the delay. Here is the answer from the author of that sample: ============================================= The PLCnext Engineer project is a sample and is not attended to be used in production. The parts of the sample are the Data Tpye definition, the control program, and the HMI The Data Type code:
The Type definition is open on line 1 and on line 3 (denoted by first red arrow) a struncture type is created. This structure will contain the Variable name we will keep track of, the value of the variable, and the time the variable changed. For the purpose of the sample, we will keep 256 records, or variable value changes. This will be done by creating an array of the structure defintion on line 9 (denoted by second red arrow). This will create in memory a virtual table of values: Variable Name Value 0 Time Stamp
Variable Name Value 1 Time Stamp
Variable Name Vaule 2 Time Stamp
Variable Name Value 3 Time Stamp
. . . Variable Name Value 255 Time Stamp In the PLC program code is the following:In line 1, a check is made to see if the variable being recorded, in this case VarInt has changed from the previous value. If the value has changed, then the variable name “VarInt” is written to the ArrStruct[0], the variable value, and the timestamp. Line 5 moves the index to the next line to for the next time the variable changes. The ArrStruct of the datatype MyArrayOf Struct is limited to 256 vaules (0 to 255), we must keep the code from accessing a value of 256. Line 8 checks this value and if greater then 255, the value is reset to 0 to start writing over the old data.Line 9 will copy the current value of VarInt to VarIntPrev. VarIntPrev is used in line 1 to test if the current value has changed from the last time the code changed. In the HMI page a symbol list is used to visualize the virtual table in memory that is the array of structure called ArrStruct (note the ArrStruct must be linked to an HMI tag) :
Once the symbol list is drawn onto the page the structure needs to be defined. This is simular to the structure and array defintion on the datatype page. This is done on the parameter’s tab of the symbol list properties:
Here you can see we defined to displayed the VAriable name, value, and the timestamp when the vaule changed.
