Page 2 of 2
Re: SCADA Component object Slave
Posted: Wed Apr 07, 2021 4:39 pm
by mnfisher
I think I see...
I was hoping that I didn't need to use a flag and if statement.
Just tried in v8 and using a [SIM] block just compiles as a call to a macro as in normal code - I was fooled by the name..
However:

- FC__00048.jpg (9.42 KiB) Viewed 3529 times
The setter and getter functions for these don't produce any code - but I don't see a way to replicate this without using a flag (is there a 'global flag 'SIMULATION' or 'SCADA' which is set defined if the program is running is that mode?)
Martin
Re: SCADA Component object Slave
Posted: Wed Apr 07, 2021 5:07 pm
by mnfisher
Another idea.
In the component export properties can set a macro as downloadable and also set a simulation macro for this..
I see this is done with the glcd component - so for example BPlot has BPlotSim as it's simulation macro.
However - I created a macro Test (original) - and a macro TestSim. Setting Test as a downloadable macro - I only get 'Test' as an option in 'simulation macro' (or create new macro) - and can't select TestSim as my choice. How do I need to setup Test and TestSim to allow this?
Martin
Re: SCADA Component object Slave
Posted: Wed Apr 07, 2021 5:30 pm
by mnfisher
That definitely works - although I could only select macros created in the 'export configuration' using the add macro as the simulation macro.
I created a simple Test and a TestSim - both of which returned an int (but a different one!)
Test also output 1 to d13 (turn on LED)
Output as a component and imported in a new project.
x = Test();
print(x);
Gave the expected result - different value for simulation and hardware..
Magic. That's one of the good things about FC - the more you dig the more features you find....
Martin
Re: SCADA Component object Slave
Posted: Wed Apr 07, 2021 5:47 pm
by p.erasmus
Martin
If you select the HW macro below it write the Sim macro in by hand ,if FC does not want to take it there is a difference in Parameters between them, I have noticed ,then select the sim macro and set it to Hidden The SampleChannelRaw is the HW (embedded ) macro and the SampleChannelRawSim() is its Simulation macro
Hope this also helps a bit

- P1.jpg (39.7 KiB) Viewed 3527 times

- P2.jpg (36.88 KiB) Viewed 3527 times