In this tutorial we will add logging of data.
The below illustration shows what you will build in this tutorial. The red dots indicate tutorial steps.
Now - lets get started.
Logging is performed when "Log" is called in the Register Set-method. Log commands that are entered other places than in the register set-method are ignored. The value held in the register at the time of the call of the log-command is stored as a separate log-entry.
Log entries are stored in flash memory locally in a device, in a "ring buffer". Hence the local lifetime of logs depends on the size of the ring buffer (device dependent) and on the number, frequency and size of logs.
Normally, local logs are transferred to a remote database. The register variable "Log_Lifetime" is used to indicate how long logged data is intended to be preserved in the remote database.
For example "One month" means, the log is intended to stay in the remote database for 1 month.
"None" means, the log is never transferred to remote database. Data is still logged locally.
"Permanent" means the log is intended never to be deleted from the remote database.
"No_logging" means the data is not logged locally, and thus not transferred to the remote database either.
Step 1: Enabling logging
This is what your code should look like:
Perform the same operation for register "Actual_temperature"
Step 2: Writing log data.
The set point is updated through the visualisation which activates the get/set-handler.
Hence we do not need to add any additional code.
Step 4: Adjusting your test bed.
Replace the input (a 4-20mA slider) with a temperature regulator simulator. Orange wire to terminal 01, red wire to terminal 10 and black wire to terminal 30(GND).
The temperature regulator simulator adjusts itself to the set point.
Step 5: Downloading your code and testing your regulator.
Save, build project and download it to the test bed.
Now your display PC will show you the visualisation and you can change the set point and see how the temperature adjusts. Try to open the temperature logging by holding down the mouse button over the temperature field.