YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Overide Multistate by clicking on text Options · View
eszy23
#1 Posted : Thursday, August 05, 2010 12:09:41 PM
Rank: Newbie
Groups: Member

Joined: 8/5/2010
Posts: 6
Hi,

I already set the Multistate for a symbol as following:
State 1: Normal = 0
State 2: Alarm = 1

When the symbol is already in State 2, is it possible to force/overide the Multistate from State 2 to State 1 by clicking on a text?

Thank you. Appreciate it..
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
RJK Solutions
#2 Posted : Thursday, August 05, 2010 10:16:58 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi eszy23,

Welcome to the forum.

The multi-state will only change states if the source of the multi-state changes. If you want to move the symbol from Alarm to Normal then you would need to update the PI tag with "Normal".

You could use blinking of State 2 and toggle that on/off like in this post: http://www.rjksolutionsltd.co.uk/forum/yaf_postst306_Control-Symbol-Blinking.aspx

Do you mean you want to change the state or have a method for acknowledging an alarm?
Principal Consultant
Real-Time Data Management @ Wipro Technologies
eszy23
#3 Posted : Friday, August 06, 2010 12:03:23 AM
Rank: Newbie
Groups: Member

Joined: 8/5/2010
Posts: 6
Thanks for the reply.

Yes, i want to acknowledge the alarm by changing its state. I have a rectangle which will turn to red color if any of the values are having 'State = 1'. Unfortunately sometimes the faulty sensor's PI value will give a false alarm and I simply want to ignore it so that the rectangle color will remain in green. Here's what I'm trying to do:

If ((Value37.GetMultiState.CurrentState = 1) Or (Value38.GetMultiState.CurrentState = 1) Or (Value39.GetMultiState.CurrentState = 1) Or (Value63.GetMultiState.CurrentState = 1)) Then
Rectangle55.FillColor = RGB(255, 0, 0)
Else
Rectangle55.FillColor = RGB(0, 255, 0)
End If

Say Value37 = 1 whereas in actual fact, the value should be 0 (due to faulty sensor or I simply just want to ignore it). I want to have a way to acknowledge the alarm and force the Multistate back to 0.
Tommy
#4 Posted : Friday, August 06, 2010 2:05:38 AM
Rank: Member
Groups: Member

Joined: 7/19/2010
Posts: 20
You could have another rectangle (and put text in it saying "ignore" or "override") and click that. If override is active, change that button to a different color, e.g. darker gray. Then in your long if statement you can add a few more logical statements:
Code:
If ((Value37.GetMultiState.CurrentState = 1) Or (Value38.GetMultiState.CurrentState = 1) Or (Value39.GetMultiState.CurrentState = 1) Or (Value63.GetMultiState.CurrentState = 1) Or (Rectangle37.FillColor = RGB(150,150,150)) Or (Rectangle38.FillColor = RGB(150,150,150)) Or (Rectangle39.FillColor = RGB(150,150,150)) or (Rectangle63.FillColor = RGB(150,150,150)) ) Then

So then if any of those 4 are color RGB(150,150,150) (that is, unclicked), then your Rectangle55 will be Red, according to your code.
Then, add codes to change the rectangle color if it is clicked:
Code:
Rectangle37_clicked()
If Rectangle37.FillColor = RGB(150,150,150) Then
Rectangle37.FillColor = RGB(50,50,50)
Else
Rectanlge37.FillColor = RGB(150,150,150)
End If

Essentially you would create 4 global variables linked to the rectangle color.

But, if you want to force the PI value to something else, you'd need to do what RJK said about updating the PI tag to "Normal."
Disclaimer: Any code presented by myself might be unconventional because of the lack of formal training. Any corrections are welcome. =)
eszy23
#5 Posted : Friday, August 06, 2010 6:47:53 AM
Rank: Newbie
Groups: Member

Joined: 8/5/2010
Posts: 6
Thank you for your suggestion, Tommy. This is a straightforward, easy-to-understand solution for newbies like me.

Another question apart from the Multistate question: I have a few displays (.pdi) in ProcessBook. Let say I have Symbol_1 in Display A and Symbol_2 in Display B. I want to link Symbol_2's value to Symbol_1, which resides in a different display. I don't know what's the code I should use to link different symbols from different displays.

Thank you very much!
Tommy
#6 Posted : Friday, August 06, 2010 8:57:43 PM
Rank: Member
Groups: Member

Joined: 7/19/2010
Posts: 20
I haven't tried this, but you might be looking for a this command (no promises):
Code:
Application.Display("myDisplay.pdi").Value1

You'd need to specify the file name and then you might be able to treat it as if you were accessing the display through
Code:
ThisDisplay.Value1

Of course you should have code to check if that display is open before you call a value in it.
Disclaimer: Any code presented by myself might be unconventional because of the lack of formal training. Any corrections are welcome. =)
RJK Solutions
#7 Posted : Monday, August 09, 2010 1:41:26 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
I would suggest that you look to adding an additional state to your digital tags for alarming so you can track alarms better, after all they are an alarm for a reason so if you are providing some form of a notification (via ProcessBook) you need to track when it was "ignored" due to false alarm. That way you can track rates of false alarms etc.

Add an additional state to your Digital StateSet:

State 1: Normal = 0
State 2: Alarm = 1
State 3: False Alarm = 2

Then if your multi-state symbol is in alarm but you want to flag it as a false alarm then you would update the value of the PI tag to "False Alarm". Then change your multistates to have 3 states instead of 2. To me this would be a much better approach.



For accessing values from other displays you have to open the other display and retrieve the value. As Tommy has pointed out, you have to:

- Access the list of displays belonging to the instance of ProcessBook you are running your code from.
- If your display is not open, then open it. You can just open the display via automation because if it is already open then it is just activated.
- Retrieve symbols from the display object as you would if you were dealing with the "ThisDisplay" display object.

Code:

Dim OtherDisplay As Display
Set OtherDisplay = Application.Displays.Open("C:\MyOtherDisplay.pdi",True)

Dim OtherSymbol As Symbol
Set OtherSymbol = OtherDisplay.Symbols("MyOtherSymbol")
' Parse the symbol as required...
Set OtherSymbol = Nothing

' Close the display?
OtherDisplay.Close False 'Don't save changes.

Set OtherDisplay = Nothing



Principal Consultant
Real-Time Data Management @ Wipro Technologies
eszy23
#8 Posted : Thursday, August 19, 2010 7:30:08 AM
Rank: Newbie
Groups: Member

Joined: 8/5/2010
Posts: 6
Thank you for the codes on accessing values from other display. I tried and it works well, just what I intended to. Thank you!

RJK Solutions
#9 Posted : Thursday, August 19, 2010 10:00:24 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Glad it is working as you expected. Smile
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.