Hello I'm new with ZenOn.
I have analog input directly connected to text value block.
I want multiply it with another value when the switch button is enabled
and back to direct view if disabled.
please give me a guide on this.
Hello I'm new with ZenOn.
I have analog input directly connected to text value block.
I want multiply it with another value when the switch button is enabled
and back to direct view if disabled.
please give me a guide on this.
Hello klasik,
Welcome to the COPA-DATA Forum.
Please consider the following alternatives to perform calculations in zenon (I hope I am not forgetting any!):
- Mathematical driver;
- zenon Logic;
- Non-linear and linear value adjustment;
- Programming interface;
In this specific case, it might be interesting to use zenon Logic running in the background a simple calculation program. I attached a sample code (see it as a guidance only!).
The trigger variable can be controlled via a button (e.g. switch). The var1 and var2 are inputs of the multiplication operation (logic_result).
Please also consider the zenon online documentation to know more about the topics listed above.
I wish you good luck,
David Cerdeira
PS. I'm using old zenon version. there is no visa. any tip with vba?
ok I found solution. I used switch with simulation plc bool.. and created vba events on click up. I get that I can.t run infinity loop in thus scripts.. runtime hangs.
it is any way to get result?
as I said I have switch connected to simulation bit. analog variable and calculated variable.
I want something like that:
do if witch is on then calculated variable = analog variable * constanta else calculated variable = analog variable end if loop while true
Dear klasik,
With the information given it is hard to help you further. Which zenon version are you using?
Please consider the zenon product life cycle so that you can contact your local representative to get further support.
You can find more information here: zenon life cycle
In general, the API shares the same main thread as the runtime so that when calling the API, the runtime is held. In this case, running loops (infinite or not) in the API is not a good solution as the runtime is blocked during this time (note: in VSTA it is possible to use multi-threading but this solution should be only developed by experts).
Did you consider using a formula variable (available at the MATHDR32 driver) so that the calculation is only executed if the calculation is active (controlled by a Boolean variable)?
You can find more information in the zenon documentation topic Drivers > MATHDR32.
I wish you good luck.
David Cerdeira