In the previous chapters you have created three variables in the "BoilerPlant/Boiler1/Data
" object, namely "Temperature"
. You write a number generated in the script of the timer "Emul"
every second into the "Temperature"
object. You change and influence the value of the power by moving the slider of the PmgSliderBox
object that you've placed in the window named "Panel"
In some cases it is necessary to log events (e.g. switching buttons - value changes). These requirements are addressed in the PROMOTIC system by the event
system. The PROMOTIC system can log these events and then allow to view the logged history.
In the following chapter you will learn:
- how to add and configure the PmaEventGroup
object that is responsible for event evaluation
- how to define which variables and how are to be evented
Adding the PmaEventGroup object
First in the editor of Pma objects
create in object "Boiler1" a new object of the PmaEventGroup - event group
Fill in the following entries in the configuration window:
: enter "Boiler1ev"
Displayed group name
: enter "Boiler no.1 events
There can be multiple PmaEventGroup objects present in the application and the group identifier is used in order to tell them apart. That is why each PmaEventGroup
object must have a unique group identifier in the framework of the application. Leave the other configurators unaltered.
Once the new PmaEventGroup
object is created a new dynamic event template also appears. The setup of the event template can be verified and modified on the "Items
" tab of the newly created object.
Logging events of variables
The basic event logging is done by data extension ExtEvent
- An extension for generating events
It is possible to log the change of the whole value or just an individual bit. In our case:
- Select variable Status
. Open the configuration window of this variable (the "
" button or mouse doubleclick).
- Create new data extension (by the "Add
" button) and select data extension ExtEvent
Target object (PmaEventGroup)
: Select the PmaEventGroup
object (use the button with three dots, select "Relative path to:")
Event template: Select (use the button with three dots) the automatically created alarm template event0.
Event description defined here (otherwise from template)
: Check and in the "Event description (desc)
" configurator enter the event text, for example "Switching boiler 1 on"
Activate the event if: select "On each change to true"
Leave the other items in this window unchanged.
You have just set the application to detect the changes of the first bit (zero-based index) of the Status variable and if the value of this bit switches to 1 (true) then the event is triggered.
Advanced event logging
The above described procedures allow you to quickly and easily define the eventing of variables in the application. If these options are insufficient for any reason, then it is also possible to work with events in scripts. In this way, other features of the event system that are not available by means of data extensions can be used.
Detailed information regarding this operation of events can be found in chapter Alarm and Event system
and in the description of the PmaEventGroup
Record of user login:
var oEv = pMe.Pm("/BoilerPlant/Boiler1/Events");
oEv.ActivateNew("logon", "event0", "logon", pEvent.Name);