Showing results 1 to 6 of 6

Thread: Simple VB in Zenon

  1. #1
    Join Date
    26.02.2014
    Posts
    36

    Default Simple VB in Zenon

    Hello,
    I have used Zenon for projects, but never Visual Basic. All I need to do is write simple VB scripts which will assign a value to a variable, or a variable value to another variable, for example to set VariableA = 1, or VariableA = VariableB. I have tried some tests, but they do not work.
    I know very little of VB, is there a manual or instructions for beginners (specifically relating to VB in Zenon) that I can find online, or maybe someone can post a guide on how to make this simple script.

  2. #2
    martins Gast

    Default Re: Simple VB in Zenon

    hey,

    usually, allocations would be sufficient to what you need - assigning a value from one variable to another one.

    If you need something more complex and you are familiar with PLC programming, it sounds like zenon Logic would be the perfect tool for you

    In the help under Manual - zenon Logic, you can find some information how to start with zenon Logic. By writing your own IEC61131-3 compatible programs, similar to how you are used to it in a PLC

    best regards,
    Martin

  3. #3
    Join Date
    26.02.2014
    Posts
    36

    Default Re: Simple VB in Zenon

    I considered allocations, but I need over 200 of them. I am hoping that using VB would be easier than creating so many allocations.

  4. #4
    Join Date
    20.08.2009
    Posts
    293

    Default AW: Simple VB in Zenon

    Hi,

    first you have to ensure that the variables you want to read are advised. Therefore you can create an OnlineContainer, see here (first post) or search the forum for OnlineVariables.

    Then you can write code like this:

    ...
    thisProject.Variables.Item("VariableTarget").Value = thisProject.Variables.Item("VariableSource").Value
    ...


    Again please search the forum for additional info on reading/writing variables.

    Regards,
    Bernhard

    Edit:
    zenon Logic as Martin suggested would be also my favourite option (then you don't need to take care of the advising and it's way more error prone.
    Last edited by bernhardf : 1st December 2014 at 07:48

  5. #5
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: Simple VB in Zenon

    I considered allocations, but I need over 200 of them. I am hoping that using VB would be easier than creating so many allocations.
    -> you can create those variable allocations programmatically
    -> see help documentation at Manual -> Programming interfaces -> Objectmodel -> VarAssignments

    Using variable assignments you also dont have to care about if a variable is advised or not. Also if you rename your variable - zenon do this internally for you (which is not the case if you do this programmatically).... aso...

    To give you an advise about programming in zenon:
    - for engineering within the zenon editor you can save many working hours
    - within the zenon runtime you have to take care because if there is error within that code (or other certain situations) it will directly influence the behaviour of the zenon runtime - which will probably lead to extra working hours.

    regards,
    herbert


  6. #6
    Join Date
    26.02.2014
    Posts
    36

    Default Re: Simple VB in Zenon

    I am not sure what you mean by advised. Is this something that you need to do to a variable?

Similar Threads

  1. Simple Project, no idea
    By matholton in forum zenon Supervisor
    Replies: 1
    Last Post: 24th September 2008, 12:01

Posting Rules

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