Showing results 1 to 7 of 7

Thread: Function parameters - dynamic change

  1. #1
    Join Date
    06.04.2015
    Posts
    4

    Default Function parameters - dynamic change

    Hello,

    I am working with Zenon 7.20 and am trying to create a faceplate for some elements (e.g. valve, pumps etc).

    I have created a Valve data type:
    - Status: open/close (values 1/0)
    - CMD: auto-on / auto-off / manual-on / manual-off (values 1/2/3/4)

    I have also created a screen which i am opening multiple times with data from different valves, by clicking the valve (using the linking rule on an invisible button on top of the valve). By changing the value for status, the text open/close changes for the corresponding valve in the opened screens.

    The screen also has some buttons that have a function to "Write set value" to a tag. I need to be able to set 1, 2, 3 or 4 to CMD by pressing a button.

    My question is: can i somehow change the parameter of the function dynamically so that every time i click on a valve and open a window, the function will set the value to the tag corresponding to that valve.

    Example: If the faceplate for Valve_1 is opened, by clicking the button i should set Valve_1.CMD, and if the faceplate for Valve_2 is opened, by clicking the button i should set Valve_2.CMD.

    Regards,
    Vlad

  2. #2
    louis.paglaiccetti Gast

    Default Re: Function parameters - dynamic change

    Hi Vlad,

    As far as I am aware, there is not a standard way to change parameter (variable) of the write set value function via standard functionality. Maybe possible via zenon API, but I am not totally sure.

    As you probably know, the screen switch substitution/indexing can replace both variables and functions on a given screen, but I assume your purpose is to avoid creating the write set value function for each instance, right?

    Instead of using the write set value function, have you considered using just a screen element on your faceplate which performs the write action? For example, a button element, numerical value element, switch element, etc. all have the capability to write values to variables linked to those elements, and the variable assignment is replaced in the screen switch with substitution.

    Or another idea, maybe something else you may be able to tailor into a solution is by using the keyboard screen types. As this is an automatic way to launch a context sensitive popup allowing the user to set values via button clicks, for a variable linked to an element.

  3. #3
    Join Date
    06.04.2015
    Posts
    4

    Default Re: Function parameters - dynamic change

    Thanks for the answer.

    As you guessed, I am trying to limit the number of functions as I have a lot of elements to work with.

    In the end I think I'm going to go with buttons and numerical elements. Do you know of a way (without functions) to set a value (3, 4 etc) to a byte using the button?

    Also, do you know what the field "Parameter for substitution:" from Variable/Function in Button - Properties does?

  4. #4
    louis.paglaiccetti Gast

    Default Re: Function parameters - dynamic change

    Hi Vlad,

    Yes, you can create a combined element and link it with your variable.
    Then, under the combined element properties -> write set value -> set it like the attached screenshot"combi_set_value.png":

    Then upon clicking it, zenon will write that specified value, without the need for a function.

    I also attached a 7.20 project backup demonstrating both that, as well as the new {PARAM} index substitution you were asking about. Just restore the project, and you will see how it works.It is also explained well in the zenon 7.20 help:

    Manual -> Screens -> Edit screen elements -> Replacing linking of variables and functions -> Replace indices -> replace multiples with indexing variables and function parameters



    Thanks,
    Lou
    Attached Thumbnails Attached Thumbnails combi_set_value.png   {PARAM}.png  
    Attached Files Attached Files

  5. #5
    Join Date
    06.04.2015
    Posts
    4

    Default Re: Function parameters - dynamic change

    Thank you!

  6. #6
    Join Date
    02.04.2015
    Posts
    18

    Default Re: Function parameters - dynamic change

    I have question related to dynamic parameter change during opening faceplate.

    I'm using element "Screen container" which has parameter Representation/Screen where choose which screen will be shown in container.

    I need to change this parametr during opening faceplaete. It is needed becouse I want to use one faceplate for the same type of equipment but with different set of signals.

    How it possible?

  7. #7
    Join Date
    08.08.2013
    Posts
    44

    Default Re: Function parameters - dynamic change

    Hi dcs.engineer,

    this functionality is possible with the help of VBA/VSTA.
    During the runtime, it's possible to change the (dyn)properties of a Screen Switch function temporarily and execute it afterwards.

    In the following chapters of the zenon Manual you Can see, how (dyn) properties Can be changed and how a zenon function Can be executed with the help of a VBA/VSTA macro

    Handbuch -> Programmierschnittstellen -> Objectmodel -> RtFunction
    Handbuch -> Programmierschnittstellen -> Objectmodel -> RtFunctions
    Handbuch -> Programmierschnittstellen -> Objectmodel -> RtFunction -> RtFunction-Methods -> Start


    BR
    Christian

Similar Threads

  1. How to Change color of dynamic text element
    By fred.tunell@dateli.se in forum VBA
    Replies: 1
    Last Post: 19th June 2014, 08:28
  2. Replies: 3
    Last Post: 23rd October 2013, 22:21
  3. Replies: 1
    Last Post: 24th April 2013, 04:50
  4. Replies: 3
    Last Post: 27th March 2013, 22:45
  5. Change RtFunctions parameters in VBA
    By kicker in forum VBA
    Replies: 1
    Last Post: 17th February 2010, 11:05

Posting Rules

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