I'm developing the ECAM system for the Airbus.
I have no problem with actually making the messages and displaying them, but I have not a clue how to start with prioritizing and displaying them below each other if multiple messages are active, based on priority!
Essentially, what I need is a hash as far as I know:
- Code: Select all
active_messages = [];
I already have a hash that lists all the possible messages, e.g.:
- Code: Select all
messages = [
message.new(name: "RAM AIR P/B ON", text: "RAM AIR ON", priority: 5, logic_prop: "/controls/pneumatic/switches/ram-air", color: 4, display: 2),
message.new(name: "EMERGENCY GENERATOR", text: "EMER GEN", priority: 5, logic_prop: "/controls/electrical/switches/emer-gen", color: 4, display: 2),
message.new(name: "GROUND SPOILERS ARMED", text: "GND SPLRS ARMED", priority: 5, logic_prop: "/controls/flight/speedbrake-arm", color: 4, display: 1)];
There is probably a more efficient way to add the messages to that list, but for now, that isn't important
I want to ADD any message from the messages list to the active_messages lsit if the logic_prop is TRUE, and REMOVE it if it is no longer true. I need to be able to display them in order: for example,
- Code: Select all
setprop("/ECAM/line[" ~ active_messages.id ~ "]", "b");
That is, for the first active message, sorted by priority, I want to setprop it to the first line. Then the next one in active_messages is setproped to the second line.
I would appreciate any advice or hints as to how to even start!
Please ask me for more information if you do not understand what I am asking or describing
Jonathan
PS. In future I am not working on such a complex aircraft as the Airbus
3736 pages of documentation of the ECAM logic alone...