NameSet string name inaccessible unless "User Selectable" set to yes

I have a need to generate an event entry, LOGEVENT(), in certain situations with discrete control devices (EDCs).  In the event string I'm trying to include the PV_D string value at the time the event is logged.  What I'm finding is the string name cannot be logged unless the "User Selectable" option is set to yes.  With the "User Selectable" option set to no, the LOGEVENT('^/EDC1/PV_D.CVS') generates the event Desc2 message of "_EDC_VLV_PV:1", basically the nameset string name with the integer value of the selected state.  The same behavior occurs if I write the value to a string parameter within the control module.  When I change the specific NameSet state name to User Selectable = yes, then both the event Desc2 and string parameter show the name, in this case OPEN.  I'm working in DV 14.LTS with the latest workstation hotfix applied.  Is this expected behavior?  Is there any reasonable work around for this?

  • What you describe is certainly the case in 13.3.1 as I came across the same problem. See this question

    In fact BOL specifically states

    "The named set does not have to be visible to or selectable by the user. However, if you want the set to be selectable by the user, it must also be visible to the user. In addition, named set states have to be configured as user selectable for the state names to be available for use within the controller."

    If you can change the relevant named set states to User Selectable = Yes then that would seem to be the solution. I ended up testing the value of the parameter and then logging a message based on the value of the parameter eg

            if (PV_NOW = 'mtr2-pv:RUNNING') then
                A := LOGEVENT("State changed to running")
            endif;

  • In reply to Cedric Dawnhawk:

    Thanks Cedric. I'm not sure how I missed your previous post. Thanks for providing the link.

    I was hoping to avoid the evaluation of each state, with a custom message for each. This gets interesting when working with class based modules.

    I tested out modifying the PV_D name set to allow all states to be user selectable, however I don't think this is a great option. If someone gets into Control Studio they can change the PV_D state inadvertently. Based on what I could test in simulation this didn't appear to actually drive an output change of the EDC, however it did change the PV_D string displayed graphically. In fact it was interesting to see the behavior as WatchIT and the Live faceplate displayed the newly selected PV_D string, in this case OPEN, however when I opened the PV_D popup in Control Studio online to change it back it was already set to CLOSED. I actually had to change the setpoint to OPEN to get the SP_D and PV_D back in sync. I wasn't able to directly change PV_D back to CLOSED.

    Has the approach you have taken to work around this system limitation worked well? Any feedback or improvements you might recommend before I proceed down a similar path?
  • In reply to Jesse Delanoy:

    Yes the method I used works and I did use it in some in class modules. I appreciate that using fixed strings in class modules rather defeats the object, but in my case the state names of the two DC states were going to be the same in all instances.

    If you want to change the message in the instances then crudely you can just make the whole expression configurable in the instance. More elegant would be to include configurable string parameters in the class module PASSIVE_NAME, ACTIVE1_NAME, ACTIVE2_NAME (or similar) and use these parametes in the LOGEVENT function instead of fixed strings.

    In another class module with a DC using three states I used SELSTR as shown below. Again I used fixed strings for the state names but they could be configurable string parameters in the class module.

    if '^/LOG_ENABLE.CV' = True then
    PV_NOW := '^/DC1/PV_D.CV';
    if (PV_NOW != PV_OLD) then
    if (PV_NOW != 255) then
    A := LOGEVENT("Valve position changed to " + SELSTR(PV_NOW + 1,"closed", "open", "venting", "", ""));
    end_if;
    endif;
    endif;
    PV_OLD := '^/DC1/PV_D.CV';

    Hope this helps