I would like to have pushbutton actions logged in a database.
I created a button which changes state of analog point.
I know I can log change of state for the analog point, but I would like to have something like "Button 1 pressed" in Event log.
Any suggestion is appreciated.
See help guide reference to "Insert a Comment for an Event"
use the script interface to insert a comment in the events journal using the AddComments method on the EventJournal aggregate of the root group object.
What does the Button actually do when it's pressed that you would want to log?
Button action has to be logged since it writes value to INT point within OPC Server. This action triggers action such as starting a pump or a fan, for example.
What I try to achieve is to have operator's action clearly stated in the event list.
Meanwhile, I found a workaround playing with FBD...
But, if there is simpler solution...
Your button action will need to call a script function to both cause the action and then raise an additional event log message.
The following function will log a message:
'Helper function to write a log message Public Sub LogInterfaceEvent(DBObject, Time, Severity, EventText) If Not DBObject Is Nothing Then DBObject.Interface.LogInterfaceEvent LocalTimeToUTC( Time),Severity, EventText End If End Sub
You could add this to a script library.
Your code which executes the control/override/setpoint will use something like:
Set controlObj = Server.FindObject( Server.GetOPCValue( "..relative path to point.FullName" ) )
This will be the first argument to the function above, and also a means to execute the action, using controlObj.Interface. etc
Ohh... so you're ok with it not being logged if I just navigate through the Database Browser, right click on the OPC point and select "Control..."?
I think what you don't want is to log the button action.
What you DO want is to log the control action that the button causes. And this is normally the default action (here's the default configuration for an OPC Advanced Analog.. after I tick the 'Control Enabled' tickbox).
As long as there is a Severity configured here (i.e. it's not set to None), then it will put an Event into the Event Journal which will tell you who issued the control action, and what they issued it to.
This is normally sufficient for most purposes.
If you want to start applying a little more 'robustness' to the value changes themselves, then you should be looking at either the Security permissions (i.e. so that only certain users can change the value) and possibly the Confirm options here, so that a user has to re-enter their password when changing it, or entering a note or such..
An 'example' of how it kind of looks in the Event Journal is:
This is for an internal Analog, so it says 'Hand controlled', but a non Internal will just say 'Controlled to'.
The Category that you will want for any filter is 'Action'.
Discuss challenges in energy and automation with 30,000+ experts and peers.
Find answers in 10,000+ support articles to help solve your product and business challenges.
Find peer based solutions to your questions. Provide answers for fellow community members!