Observables are data that is constantly monitored. When the data matches a criteria, a list of actions or commands is executed.
For people familiar with the concept, it can be considered a if-this-then-that instruction. For example: If the weather data from the simulator indicates rain is falling on the aircraft, we can set the windshield wipers automatically.
Observables are defined at three levels:
- the cockpit level, available for the entire application
- the simulator level, available to monitor simulator-specific variables
- the aircraft level, available to monitor aircraft-specific variables.
Observables are defined in resources
folder of the entity in a observables.yaml
file. All observables are loaded at once in an Observables entity which contains them all.
Definition
The file observables.yaml
is located in the deckconfig/resources
folder of an aircraft. It is loaded on startup.
observables:
- name: example
trigger: onchange
dataref: some/dataref/to/check
actions:
- command: do/some/action
delay: 5
Attribute
Observables
The observables
attribute is a list of individual observables.
Observable
Attributes
Trigger
True/False Evaluation
The trigger
attribute of an observable is a single dataref or a formula that is evaluated each time a dataref mentioned in the formula changes. The result of a the formula is compared to 0, i.e. True (different from zero) or False (equal to zero).
If the result of the formula is True, commands listed into the actions
attributes are executed.
Value Changed
Another method to trigger the flow of action(s) is to select the value changed mode. Actions get executed as the value of the dataref or of the computation has changed.
Observable
The observable is the data that is monitored. It can either be a single dataref or a formula.
Actions
The actions
attribute is a list of individual actions that gets carried out in sequence if the trigger attribute is True.
Action
Attributes
An action as the same attribute as a command carried out by a button:
- instruction
- delay
- condition
Examples
Here are a few examples of Observables, set from experience.
Simulation Event
Internal Changes
When a new aircraft is loaded, or when an aircraft livery is changed, "internal" events are generated by the simulator software so that external entities like Cockpitdecks can be notified.
This is how Cockpitdecks detects aircraft or livery changes. Action triggered are very specific (to change the aircraft).
Aircraft Events
Auto Save on Event
Most simulators or aircrafts provide a command to save the situation and restore it later.
ToLiss aircrafts simulate Airbus which have the concept of flight phase.
We devised an Observable to trigger a situation phase on flight phase change. This allows to restart a flight right at the flight phase change.