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:
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
SCADA Component object Slave
-
- Valued Contributor
- Posts: 1628
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 142 times
- Been thanked: 761 times
-
- Valued Contributor
- Posts: 1628
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 142 times
- Been thanked: 761 times
Re: SCADA Component object Slave
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
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
-
- Valued Contributor
- Posts: 1628
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 142 times
- Been thanked: 761 times
Re: SCADA Component object Slave
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
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
- p.erasmus
- Posts: 434
- Joined: Thu Dec 03, 2020 12:01 pm
- Location: Russia / Россия
- Has thanked: 104 times
- Been thanked: 88 times
Re: SCADA Component object Slave
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
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
Regards Peter - QME Electronics