Showing results 1 to 5 of 5

Thread: How multiply value

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    28.09.2015
    Posts
    16

    Frage How multiply value

    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.

  2. #2
    Join Date
    25.06.2012
    Posts
    156

    Default Re: How multiply value

    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
    Attached Thumbnails Attached Thumbnails screenshot_07.png  

  3. #3
    Join Date
    28.09.2015
    Posts
    16

    Default Re: How multiply value

    PS. I'm using old zenon version. there is no visa. any tip with vba?

  4. #4
    Join Date
    28.09.2015
    Posts
    16

    Default Re: How multiply value

    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

  5. #5
    Join Date
    25.06.2012
    Posts
    156

    Default Re: How multiply value

    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

Similar Threads

  1. changing object colour from multiply variables
    By mattsd in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 4
    Last Post: 12th November 2007, 02:09

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •