redwiz666
Good morning. I am working on a simple program to get the hang of using OpenPLC. The issue I am having is when running in debug I can watch my values. I have a variable called ContainmentActive and it is TRUE by default. In debug I can see that its true, but when I run it within OpenPLC Runtime it is showing always false. Is this a known issue or am I doing something wrong?
variables.png

And here is the Runtime monitoring.
runtime.png
 
It looks like the Runtime is having issues reading the BOOL values. Is there way I can get it to update properly?

Reply 0 0
thiagoralves
%MX are invalid locations, so the runtime does not know what to do with them. In simulation mode on the editor, all locations are removed, so the code runs fine. If you want to use booleans, you must attach them to %QX locations (or %IX if you want them to be hardware inputs, which I don't think you do).
 
Reply 0 0
fg71
Here is example of your topic.
If the start_conditions is TRUE, and input_1 is TRUE the variable m1 is TRUE, and output_1 is TRUE
If the start_conditions is FALSE it doesn't matter if input_1 is TRUE the output_1 will be FALSE.
 
If you like to change start_conditions you include %IXy.y or %QXy.y, the first is read only or physical input.
 
The approach I use for FB (Functions Block) is to do my logic in blocks and set output to variable. Its would be very easy to set ADD block
to disable a function to debug PLC program.
 
[203128%2F9048486%2Fmceclip0]
Reply 0 0
redwiz666
%MX are invalid locations, so the runtime does not know what to do with them. In simulation mode on the editor, all locations are removed, so the code runs fine. If you want to use booleans, you must attach them to %QX locations (or %IX if you want them to be hardware inputs, which I don't think you do).
 
Thank you that helped. I was trying to wrap my head around the addressing for modbus and just couldn't.

I have a follow up question too. I am also trying to read in a REAL value into RapidSCADA but can't seem to understand it completely. From the links you provided if i have a REAL value assigned to %MD0 this I should be able to read it from location 2048 right? I have OpenSCADA setup to read value 2048 using a FLOAT since REAL is not an option but the value is always 0, even though I can see the true value in OpenPLC runtime. I'm assuming I am not looking at the right memory location or that i am not understanding it correctly. Also what would the Byte order be coming from OpenPLC runtime? I am using OpenPLC on a Linux VM
 
locations.png
Reply 0 0
thiagoralves
Yes, %MD0 is at address 2048. Since it is a 32-bit location it actually occupies 2 Modbus registers at the same time, so you must read 2048 and 2049 and concatenate both of them to form an IEEE 754 32-bit float. I don't know RapidSCADA, but most SCADA software allow you to do that automatically as long as it is configured properly.
Reply 0 0
Reply