Events and the "Events" tab
In this chapter you will work on changing the boiler temperature. Obviously in a real application the boiler temperature is detected by some sensor. In our simple example we will use script value emulation of the temperature instead.
The emulation will be performed so that the temperature will be increased by a constant value every second. The simplest way to achieve that some script is executed repeatedly every second is to to use the
PmaTimer object (Timer):
In the editor of Pma objects, in the "Boiler1" object create a new basic object of the
PmaTimer type. Name it
"Emul". On the "
Timer" tab of this object do the following setup:
By this configuration you have achieved that the object will tick every second after starting the application, i.e. the
onTick event is triggered every second.
The "
Events" tab is divided into 3 parts:
- In the
upper left part of the tab you can see a list of all (three) events of the
PmaTimer object:
-
onStart .. the event says that the object has been created. Every
Pma object holds this event and for each object it is triggered only once
after starting the application.
-
onStop .. the event says that the object has been removed. Every
Pma object holds this event and for each object it is triggered only once
during stopping the application.
-
onTick .. the event says that
the object has "ticked". Only the
PmaTimer object holds this event and in our configuration this event is triggered every second.
- In the
lower left part of the tab there is a list of parameters of the selected event. Every event of the
Pma object holds two parameters
pMe and
pEvent. Their meanings will be explained later on.
- In the right part of the tab there is an area where you can write script that refers to the selected event.