SCADA Component object Slave

For general Flowcode discussion that does not belong in the other sections.
mnfisher
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

Re: SCADA Component object Slave

Post 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
FC__00048.jpg (9.42 KiB) Viewed 3523 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

mnfisher
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

Post 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

mnfisher
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

Post 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

User avatar
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

Post 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
P1.jpg (39.7 KiB) Viewed 3521 times


P2.jpg
P2.jpg (36.88 KiB) Viewed 3521 times
Regards Peter - QME Electronics

Post Reply