You are not logged in.
Pages: 1
Topic closed
Hi Tomas and Jaroslav!
I'm currently using the SILO block to read the output of a Python script - which is reading environmental monitoring sensors on the I2C bus. The readings are then archived and sent to a SQL database.
The issue I'm having is when the SILO block throws an error, which defaults to 0, it's mucking up my sensor values. For example, when I want to monitor temperature over time, the odd 0 degree value really mucks up the data I'm trying to collect.
I'm seeing this happen fairly often, I'm assuming it's probably when the script is writing to the text file, at the same time the SILO block is trying to read the same file, so it errors out.
Would you be able to confirm if this is true, or offer an alternative theory?
AND hopefully a solution ?
Many thanks
Michael
Offline
Dear Michael,
the most probable reason is the conflict between read/write operations on a single file from multiple programs as you wrote.
I can imagine 2 solutions:
1) Ignore invalid data as shown in this SILO block snippet (save file as e.g. filename.mdl). The SHLD function block must be set to "Hold last value" mode.
2) Use the REST API of REX and instead of loading the value from a file using the SILO block, push the value directly from Python script to e.g. the CNR function block.
Hope this helps, let me know.
Kind regards,
Jaroslav
Monarco HAT for Raspberry Pi - Lightweight I/O for monitoring, archiving and control.
Raspberry Pi in industrial automation!
Offline
Awesome, thanks Jaroslav, I'll give it a whirl tomorrow, when I'm back at keyboard and let you know how it went.
Kind regards
Offline
Dear Michael,
here is an example on using REST API as mentioned earlier: 0302-03_REST_API_Python_Bash_etc.zip
A readme file with additional details is attached.
Let me know if this works for you.
Kind regards,
Jaroslav
Monarco HAT for Raspberry Pi - Lightweight I/O for monitoring, archiving and control.
Raspberry Pi in industrial automation!
Offline
Pages: 1
Topic closed