INF
Product: | Elvis |
Version: | 2.5 |
Stand: | 2006-08-30 |
This article demonstrates how a presence simulation can be implemented in Elvis.
The simulation is based on recording the sequence of specific events (e.g. light on/off) in normal operation as a schedule. In simulation mode this schedule is activated so that the same events are executed automatically.
The schedule is created as week schedule, i.e. for each of the seven week days separate times can be recorded.
The simulation is at each point in time in one of three modi:
This datapoint (in the example it has the name “PresSimCtrl”) determines the operation mode.
It can be switched e.g. from the visualization interface or an EIB telegram.
In the example it is declared as follows:
Datapoint type: | Counter |
Interpretation of values | 0 = Inactive 1 = Recording 2 = Simulation |
ActualValue: | persistent, default value 0 |
A schedule (in the example it has the name “PresSim”) is created. The datapoints to be included in the simulation are assigned to the schedule.
For each week day one instance of this schedule is defined. All instances are disabled. For easy indentification of the schedule instance for a specific week day in the global script, the instances are labelled with a unique text (“Mo”, “Di”, …, “So”).
The enabling/disabling of the schedule instances is done in the global script, if the value of the PresSimCtrl datapoint changes.
The recording is done in the global script. In OnDatapointChanged it is checked whether all of the following conditions apply:
If all conditions are true the event is added to the schedule. If this is the first event recorded for today, all existing events for this day are deleted first(these are from the previous week).
For the third condition it would be best to check in the global script ifthe datapoint is in the list of datapoints assigned to the schedule “PresSim”.Unfortunately, this is not possible in the current Elvis version.So the check has to be based on another datapoint property. Candidates are:
When developing the project be sure that the check filters exaclty the same datapoints that are assigned to the schedule. In practice this will not be a big problem since the numberof datapoints to be simulated will not be too large.
To recognize that the event is the first today, the globa script remembersdate and time of the previously recorded event in a datapoint “PresSimPrevEvent”.
Download of the example project kb050131.zip