Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Andrew S on August 03, 2019, 03:37:34 PM
-
I'm loving the new simulator functionality that allows me to use programs for a 'real world' PLC model on the sim.
One thing I'm curious though, is how my programs can tell whether I'm actually running on a sim or a physical PLC. Since $PLCType and $PLCSubType now show the value of the physical PLC I wrote the program for, I've no longer got that visibility (or do I?). I know I can start the sim manually and connect, which would adjust those variables appropriately, but I'd really like to avoid that if possible.
It would be nice to have a $SimActive (or something) bit flag that I can query at runtime.
Andrew.
-
I'm loving the new simulator functionality that allows me to use programs for a 'real world' PLC model on the sim.
One thing I'm curious though, is how my programs can tell whether I'm actually running on a sim or a physical PLC. Since $PLCType and $PLCSubType now show the value of the physical PLC I wrote the program for, I've no longer got that visibility (or do I?). I know I can start the sim manually and connect, which would adjust those variables appropriately, but I'd really like to avoid that if possible.
It would be nice to have a $SimActive (or something) bit flag that I can query at runtime.
Andrew.
That would be easy. In the meantime, check the serial number (SerialNum). Serial number of real hardware will always be 00:E0:62:XX:XX:XX
-
That'll work for now. Thanks Bob.
-
Added. Will be in 2.7.