DeltaV Live - Can you toggle a button momentarily?D

Hello DeltaV Community,

     Is there a possibility to add a button action in DeltaV Live to only temporarily write True to a Module Parameter, then revert it to False after a few seconds? I recall that DeltaV Operate required scripting in order to accomplish this. I was wondering whether DeltaV Live is a bit frendlier in this regard. Your help is much appreciated.

Thanks in advance,

Valentin

  • I would reset the parameter to false in the module rather than in the HMI.
  • In reply to Douglas Crowder:

    That is our current solution, but was wondering if Deltav is capable of temporary triggers.

  • In reply to Valentin Borsu:

    Yes this is possible to have an object where it is a 1 for example while mouse down/touched and then return to 0.....but it isn't real intuitive to get done and requires custom scripting using EventListeners to do.

    You also have to have logic for the mouse up/touchend/mouse leave as well as touchmove (check to see if moved off the object) to return to 0 because of how the events are handled which is where the not intuitive (and I'm not even talking about the Typescript that may or may not be intuitive as well).
  • In reply to Matt Stoner:

    Matt, and the fact that these features are not documented in DeltaV BOL...

    I think the issue of where and how to do this depends on what this "momentary" trigger is intended to accomplish. We don't know what this momentary value is doing. Aside from the straight up main function, what are all the abnormal use cases that need "error handling"?

    Doug Crowder's statement is valid as you have one place to manage the behavior of this parameter. Once set, it resets itself, regardless of whether the console is still active (imagine bit is set and immediately after, software crashes or there is a power loss at the console. What resets the bit? How long does it stay true. What is the consequence of an error that prevents the clearing action? If two operators hit this bit at the same time from two consoles, will the result be OK? And if you manage this in the display, do you have to manage the time duration in the HMI or set this as a parameter for all consoles to use? HMM.

    Assuming resetting the bit in the HMI is the desired functionality, do you need it to be a timed reset or as Matt describes, where the user holds the mouse button down or loses focus? For a timed function there are likely several ways to accomplish this:
    - OnWrite variable: Write a 1 to the variable which triggers a script. The script executes periodically until the variable matches the value. After a give time, you can set the value to 0, and return 0 to stop the script. Basically the script runs until you return a value to the variable that matches the parameter. Typically used for a oneshot script that is activated with a parameter write. How you handle the returned value to the variable determines how many times the script will run. You could ramp the variable until it is equal to the parameter.

    - A timer function is created and enabled when the parameter is set to TRUE, and the associated script runs until it "times out" and clears the parameter when the elapsed time reaches a target. The function need not run if the parameter is false so it is tied to the parameter. Or, you run the script to read the parameter and reset it after a time. But then you end up with scripts that run just to check if they should run.

    - Interactions based on Down button/Up button in focus as Matt explained has to handle what to do if the mouse moves off the item before the up action. and could potentially leave the parameter on and never reset it.

    Then assuming you get your scripted HMI solution working, you have to consider interaction between two HMI's and two people attempting the same action that overlaps. More error handling.

    If the requirement is to handle variables strictly within the HMI, like set a Layout Variable based on some HMI button and there is no module involved, you don't have to worry about multiple HMI's as each is a different sandbox. But if this is for a module level parameter, I prefer to have the timed release handled in the module. You can use a timer to trigger an ACT block that resets the parameter and generates a LogEvent that records the module clearing the value. If you set it and clear it from the HMI, you would have the Set and Clear CHANGE events. With the Module clearing the event you can choose to record the clearing action or not.

    What ever solution you go with, make sure you consider the abnormal conditions and have error handling in your scripting.

    Andre Dicaire

  • In reply to Andre Dicaire:

    Hi Andre - thank you so much. Is there some documentation available to get started with scripting? I am new to DeltaV Live ...
  • In reply to Valentin Borsu:

    Valentin, There is BOL in Live that provides HMI specific help (much of this is not in DeltaV BOL). My journey to Live and Typescript involved Google. There are many helpful sites that discuss and explain Typescript syntax. DeltaV Live provides some product specific functions that are explained in product BOL literature. But my Typescript programming skills are not as deep as others. I tend to keep things simple and use the Live features whenever possible.

    One of the things I like in Live is the way items are structured with Interactions that provide a focused context for most of the scripting we need to do, such as adding a Timer and a script window for that specific function. It is a different way of working versus VBA in Operate.

    The Library Functions provide a mechanism for creating reusable code with either Rules based, Value based or scripted logic, and return a data type. You can use these functions to define a parameter or in a script, allowing for the logic of the function to be updated for consistent results through the system.

    All in all, Live reduces the need for custom scripting in comparison to Operate, and provides Typescript as the scripting language and a more structured way to implement needed scripts.

    In addition to BOL and Internet tutorials, I reviewed existing functions to learn about how Live uses Typescript. If you are responsible for developing or maintaining the DeltaV Live HMI environment, you should consider registering for a course with Emerson to get you started on the right path and avoid the school of hard knocks.

    Andre Dicaire

  • In reply to Valentin Borsu:

    You can check in Graphic Studio Help also for some information on scripting and probably a good place to start first maybe. I use the following sites to help but I had some programming background in other languages and didn't need (still the case) any formal training.

    www.typescriptlang.org/
    www.w3schools.com/.../index.php

    This site allows you to do some code and see results for easy troubleshooting
    https://jsfiddle.net/

    Typescript is a superset of Java so you can google and get a lot of information, sample code, etc.