PLUS+1 Software > Code sharing

Gerenal clarification question

(1/1)

Rafal_Typiak:
Hello,
I'm using guide for some time now and there has always been a question that's been bugging me but I always felt too stupid to ask it. Finally, I've mustered the courage to do so, so ......
My question is this:
In a normal circumstances - when you simply put blocks onto a page - is every block being executed?
Say you have an example from the attachment. You have two pages which output to a switch block. If you 'switch' inputs, does this act as an 'if' statement in C/C++, meaning that stuff that's not being passed through is not being executed? Or does the code in both pages executes, but only one is being passed through? And if so, does that mean that the only way to have code NOT executed, is to put it into a module?

Thanks for any help clarifying this for me,
Cheers,
Rafal Typiak

FluidPowerTom:
Rafal, both blocks will be executed, so it's not like an 'IF' statement in that sense.  Well, maybe it is like an 'IF' statement but one where both/all conditions are calculated outside of it, and the 'IF' statement itself is simply deciding which calculation to map to your output variable.

Modules, I believe, are the only way to have code not be executed if you're using the graphical GUIDE components.  You can also use a Structured Text POU in GUIDE within which you can have actual 'IF' statements, and additionally you can have a boolean deciding when to execute that POU.

Rafal_Typiak:
Thanks,
that's what I was assuming. Now I know and can sleep well again  :P

Cheers,
Rafal

oiltronic:
I can imagine code generator, compiler, and optimizer scenarios that would only execute the code in the selected branch, so I wouldn't be too certain.  Can someone from Danfoss enlighten us?

jlindholm:
Hello oiltronic.
I think FluidPowerTom did a good explanation of how the code is interpreted in PLUS+1 GUIDE.
What's written their is correct to my understanding.

BR
Jonas

Navigation

[0] Message Index

Go to full version