Showing results 1 to 6 of 6

Thread: Create commands in a wizard

  1. #1
    Join Date
    07.11.2013
    Posts
    5

    Default Create commands in a wizard

    Hi
    I'm relatively new to Zenon and this is my first wizard.
    I'm working on a project that has 60 units to communicate with using IEC870 driver. To make things simple I created a wizard to generate all variables and screenswitch functions.
    Now I would like to generate action commands as there is 2 commands per unit.
    Is there a way for me to use VSTA c# to generate this?
    Or do I fix a xml generator in VS and then import?
    Would be nice to have it all in one wizard.
    Nice forum by the way, I've found good help here..

    Br Kim

  2. #2
    Join Date
    07.11.2013
    Posts
    5

    Default Re: Create commands in a wizard

    I'll explane what I'm looking for..
    For addressing the Zenon objects this is how I did:
    zenOn.IRtFunctions obFuncs = myProject.RtFunctions();
    zenOn.IVariables obVars = myProject.Variables();
    zenOn.IDrivers obDrivers = myProject.Drivers();
    zenOn.IDriver myDriver = null;
    zenOn.IVarTypes obVarTypes = myProject.VarTypes();
    //search for the IEC870 driver
    for (int nDriverCount = 0; nDriverCount < obDrivers.Count; nDriverCount++)
    {
    if (obDrivers.Item(nDriverCount).Name == "IEC870")
    myDriver = obDrivers.Item(nDriverCount);
    }

    So using this I was expecting something like:
    zenOn.ILockings obLockings = myProject.Lockings();
    and then be able to just add
    zenOn.ILocking myLock = obLockings.CreateLocking(....);
    ...do some work on myLock....

    Doesn't commands follow the same collection structure?
    Br Kim

  3. #3

    Default Re: Create commands in a wizard

    Hi Kim,

    Thanks for your posts and welcome to the forum

    If you look in the online help, in the chapter "programming interfaces", you will find the sub-chapter "object model".

    Here you will find all the objects, properties, dynproperties, methods and events that are supported by the editor and the runtime, as well as simple coding examples. The Section "Interlockings" / "Interlocking" describes the normal interlockings and command interlockings.

    But did you know that normally, if the commands for your 60 units are identical, you would only need to create 1 command interlocking, and use wildcards for the variable names?

    For example when your command variables are named "unit1_CO", "unit2_CO", ..., you would use "*_CO" for the command variable at the interlocking. The same is true for the feedback variable in message direction.



    Best regards,
    Mark

  4. #4
    Join Date
    07.11.2013
    Posts
    5

    Default Re: Create commands in a wizard

    Hi
    Thank you, now I see the connection between commands/interlockings.
    Yes, I've found this section of the documentation very usefull.
    But I must say that this section about interlocking threw me of a bit as it not obvious that it also includes commands. All text seemed to refer to interlockings as named in the editor.
    What I did was export the command to XML and browsed the document and started looking for locking. I now compared it to an export of an interlocking and can se that its similar. I would have thought it more obvious to call the main level Locking and that it includeds sublevels Command / interlocking and that it dependings on type choise.

    I'll have a look at using the wildcard. Think this would be the right way to go.
    Do you know were I can read about wildcard usage in Zenon?

    Did some test and this is working
    zenOn.IInterlockings obInterlockings = myProject.Interlockings();
    zenOn.IInterlocking myLock = obInterlockings.Create("RS01_SW1", true);
    myLock.set_DynProperties("TTA", "RS01_T03_3011");
    myLock.set_DynProperties("Picture", "PopUpCMD");
    myLock.set_DynProperties("RM-Titel", true);
    myLock.CreateDynProperty("Actions");
    myLock.set_DynProperties("Actions[0].TTA", "RS01_T46_52011");
    myLock.set_DynProperties("Actions[0].Type", 1);
    myLock.set_DynProperties("Actions[0].Direction", 0);
    myLock.set_DynProperties("Actions[0].CommandState", 0);
    myLock.set_DynProperties("Actions[0].Timeout", 30);
    myLock.set_DynProperties("Actions[0].Picture", "PopUpCMD");
    myLock.set_DynProperties("Actions[0].CmdBtnExp", 10001);
    myLock.set_DynProperties("Actions[0].Actual",true);
    myLock.set_DynProperties("Actions[0].CloseMDIWnd", true);

    I did notice strange behavior with export/import. If you export a command the Picture tag is left empty and if you then import the command screen selection will be empty and the linked command will not work in runtime. This also is left blank from VSTA.
    Does this have to be linked manualy in the editor?

    Br Kim

  5. #5

    Default Re: Create commands in a wizard

    Quote Originally Posted by ietvkim View Post
    I'll have a look at using the wildcard. Think this would be the right way to go.
    Do you know were I can read about wildcard usage in Zenon?
    In the online help you can find the tutorial "Command input". Also in the online help, in the manual, there is the section "Energy Edition", and the sub chapter "Command input".


    Quote Originally Posted by ietvkim View Post
    I did notice strange behavior with export/import. If you export a command the Picture tag is left empty and if you then import the command screen selection will be empty and the linked command will not work in runtime. This also is left blank from VSTA.
    Does this have to be linked manualy in the editor?
    I just checked and this may actually be a small bug in the editor. I have forwarded this for further analysis.

    Best regards,
    Mark

  6. #6

    Default Re: Create commands in a wizard

    Just a quick note that the issue where the screen for the command group was not set correctly through XML Export / XML import and through the API, has been addressed and will be available in the next version following zenon 7.50

Similar Threads

  1. Sending two commands at once
    By gz0000 in forum zenon Energy Edition
    Replies: 5
    Last Post: 14th February 2017, 13:27
  2. PROFIBUS commands
    By jroht in forum zenon Energy Edition
    Replies: 3
    Last Post: 5th July 2013, 13:48
  3. Standard Edition Commands
    By tihomir in forum zenon Energy Edition
    Replies: 3
    Last Post: 1st May 2013, 00:40
  4. DNP commands
    By ansab.tp in forum zenon Energy Edition
    Replies: 5
    Last Post: 28th September 2012, 11:31
  5. Replies: 0
    Last Post: 20th August 2007, 13:08

Posting Rules

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