Storing Events.

1) Introduction

Although there are many events in Elipse E3 that can be automatically stored, it is also possible for the integrator/programmer to generate their own events, which allows the system to be completely traceable. Thus, the goal of this application is to register all types of interventions occurring between the operator/system and the process/system, adding data storage tools to the project.

2) Implementation

By default, E3 allows the register of several events, such as usernames, logouts, server switchovers, etc. These settings are made directly in the Domain, and are accessed via E3 Server at Domain–Options, on Events Recording tab.

If you need to store other types of events, it is possible to use TrackEvent() method (for further information, please refer to the Scripts’ Reference Manual), which stores data in the same table used by Events Recording.

The structure of the method is described below:

TrackEvent(EventMessage, Comment, TimeStamp)

Where EventMessage is the type of event that will be stored, Comment is a general comment on the event, and TimeStamp displays the moment when the event occurred.

A simple example of this method would be:

Application.TrackEvent “Sending command to Engine X”, “Anonymous User”, “4/6/2007 14:00:00”

3) Application

Attached to this article is a sample application that shows you how to use TrackEvent() method to insert the events into the database, and also to show the registers which are already stored.

Basically, this application controls a set of engines. The user is allowed to turn on/off these engines, and also to configure a work rotation for them. The goal is storing in disk any command sent by the operator, in addition to recording when this command was effectively accomplished.

First, you must enable the Events Recording directly in E3Server; then you can choose which pre-defined events will be stored. For this application, the only events selected are the ones regarding users’ login.

Next, TrackEvent() method is added to all commands that the operator can execute, directly into the property undergoing changes. Since the application is based on libraries, all you need is to insert these commands directly in the definition of the objects XControl and XObject.

The XOMotor XObject has several properties, among which are STATUS and SPEED. A script storing value changes was added to each of these properties’ OnPropertyChanged event.

The same thing happens for the XCMotor XControl, where the method was added to every command button available to the user and configured to store the information of value change commands sent buy a logged user.

4) Objects’ interaction

Next, you will see how the application’s objects interact with each other. For example, let’s change the speed of XZ11 Engine:

To set up the new speed value until it is effectively changed by the system, follow these procedures:

1) The operator changes the value set up for speed and clicks Set button.
a. Then, the database’s Application.TrackEvent method is used to inform that the user logged in the system sent a command to change speed.
b. The XOMotor1 object is accessed, and the new speed value is sent to SetSpeed property

2) The XOMotor1 object fires the script for this command via its events and properties.
a. As soon as this command is successfully performed, Motor1’s Speed property receives the field current’s value and is updated.
b. Since this is an example for learning purposes only, the object was programmed to receive the new speed programming, wait for some time, and then pass it.
c. When the object’s value is updated, new data will be sent to the database, informing that the speed of the engine in question has changed.

3) At this moment, the screen object – XCMotor – receives its new speed value, and then updates the screen.

5) Final Remarks

It becomes very easy to create traceability in the system by using TrackEvent() method. This method allows you to define both a message and a comment to be stored in the database with just one command line.

The advantages of this method are even more apparent for library-based applications, where it is possible to use these commands directly for each object’s definitions.

Attachments:

ProjetoE3.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *