SCADA Component object Slave

For general Flowcode discussion that does not belong in the other sections.
mnfisher
Valued Contributor
Posts: 1044
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 107 times
Been thanked: 538 times

SCADA Component object Slave

Post by mnfisher »

I'd like to create a component where if a Scada slave is added by the user it can be used in Scada mode.

I can do this 'as source' where the SCADA slave can be added to the injector component - and this works well in simulation.
FC__00047.jpg
FC__00047.jpg (16.51 KiB) Viewed 4465 times
But I'd like to 'expose' this to the top level, so that I can export as a component and give the user the option to add the SCADA slave of their choice (rather than including the Arduino SCADA or whatever..)

This I (try to) do by clicking 'expose to top level' - however the variable has no options and 'clicking' on it resets the underlying value to null.

I assume I need to populate the list of components offered to the user - but not sure which events are needed to do this?

Any pointers much appreciated.

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 »

Hi Martin.

good question ? I wish I could help you
I have ask similar questions here :D seems the team are very busy at the moment ,
viewtopic.php?f=3&t=284 :D
Regards Peter - QME Electronics

mnfisher
Valued Contributor
Posts: 1044
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 107 times
Been thanked: 538 times

Re: SCADA Component object Slave

Post by mnfisher »

Hmm, it's tricky..

I think I've managed to 'pull' the components using:
Main.JPG
Main.JPG (22.97 KiB) Viewed 4450 times
Which when stepped through sets main.str to each component's name. Next - can I attach this to the drop down menu ???
Software timer is just there as a test component (also had a couple more added to the project...)

Martin

mnfisher
Valued Contributor
Posts: 1044
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 107 times
Been thanked: 538 times

Re: SCADA Component object Slave

Post by mnfisher »

I guess I should probably use a EV_ADDED event handler to add the component name to the list each time one is added.

No joy with this route yet though :-(

Martin

Steve-Matrix
Matrix Staff
Posts: 1310
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 175 times
Been thanked: 299 times

Re: SCADA Component object Slave

Post by Steve-Matrix »

p.erasmus wrote:
Tue Apr 06, 2021 7:08 pm
I have ask similar questions here :D seems the team are very busy at the moment ,
viewtopic.php?f=3&t=284 :D
Sorry, Peter. It looks like this one was forgotten about. And yes - always busy! But also there are a few people off work due to the Easter holidays.

I'll ask around to see if anyone can help with this and Martin's questions.

BenR
Matrix Staff
Posts: 1788
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 455 times
Been thanked: 621 times

Re: SCADA Component object Slave

Post by BenR »

Hello,

I'm not sure if this is currently possible. I tried to do something similar for the network comms component and found the same problems. Which is why we have the visible network comms layer in our programs.

The Injector to SCADA Slave property uses the Panel Object property type and this only seems to go one level up from the component source.


This works

Panel
-Injector
-Scada Slave


This doesn't work

Panel
-Component
--Injector
-Scada Slave

We can maybe look into this or change the way that injectors point to their host component to allow for this mapping. The way the comms components hooks to an injector component is a bit more intelligent and this method might work.

mnfisher
Valued Contributor
Posts: 1044
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 107 times
Been thanked: 538 times

Re: SCADA Component object Slave

Post by mnfisher »

Thanks Ben,

As a supplementary question - how do I add simulation/SCADA only code.

In v8 I'd use the [SIM] block - but this seems to have disappeared in v9. Or maybe I'm just not spotting it?

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 »

Hi Martin
my be I am off the point however
I use one of the provided Comms Templates,which has property for simulation COMMS Yes or NO
in the Yes case we place all the calls to the HW macro's.this then runs on the Scada if NO is selected you down to normal Panel Simulation

so SACADA code and Panal simulation are in the SIM Macro and the Downloadable code in the HW macro example myMacro has all the embedded code and myMacroSim has the switch for SCADA or Panel simulation and the SCADA calls the myMacro which is the HW embedded macro

take a look at the templates


P2.jpg
P2.jpg (33.59 KiB) Viewed 4427 times
P1.jpg
P1.jpg (54.54 KiB) Viewed 4427 times
Regards Peter - QME Electronics

mnfisher
Valued Contributor
Posts: 1044
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 107 times
Been thanked: 538 times

Re: SCADA Component object Slave

Post by mnfisher »

Thanks Peter,

So - I need to create a MacroNameSim for SCADA/Simulation (where MacroName is the MCU version)?
Sounds good :-)

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,

Not necessarily The Switch for COMMS Simulation is part of the panel properties in the template,so when you export the component these panel properties are part of the Component properties and

for each HW embedded macro you have you create a Sim macro with the Swich statement to detect if COMMS Sim is YES OR NO if yes it execute the one part of the if statement which you do a call to the HW macro and the NO side you do a panel simulation if you want.
so if you have a CAL component as part of the Componet then when the component is exported and the user load it for a PIC FC will load the CAL componet for PIC if another user load a STM the Flowcode will load the CAL for STM

So for example you have embedded macro Sendbyte() which send a byte over the SPI CAL then you make a SendByteSim() in the YES part of the Switch or if statement you call the macro Sendbyte so now when you simulate and COMMS is set to yes then the Sendbyte HW macro is called and put threw the injector to SCADA if NO then it will not call it but you can then do some simulation on the panel

in the interface tab of the Export component properties you set Sendbyte as Downloadable and its simulation macro as Hidden macro
so when your user program his chip the Sendbyte () macro is in embedded code if he runs simulation with COMMS set to YES then FC call the SendByteSim macro and execute the HW SendByte macro but threw the SCADA injector , This is all mcu independent . the suer selcet the mcu he uses and FC will call the correct CAL file for the mcu he is using,

Hope I could explain it somehow
Regards Peter - QME Electronics

Post Reply