system-failuresfalsevbox
# Code to populate the engine entries.
var groups = cmdarg().getChildren("group");
var group = groups[1].getChildren("group")[2];
var engines = props.globals.getNode("/engines");
var row = 4;
var engine = 0;
var i = 0;
group.removeChildren("checkbox");
group.removeChildren("input");
group.removeChildren("text");
# Copy in the labels.
var target = group.getNode("text[" ~ i ~ "]", 1);
props.copy(group.getNode("engine-label"), target);
i += 1;
target = group.getNode("text[" ~ i ~ "]", 1);
props.copy(group.getNode("mtbf-label"), target);
i += 1;
foreach (var e; engines.getChildren("engine")) {
var starter = e.getChild("starter");
var running = e.getChild("running");
(starter != nil and starter != "" and starter.getType() != "NONE")
or (running != nil and running != "" and running.getType() != "NONE")
or continue;
row = row + 1;
# Set up the label
target = group.getNode("text[" ~ i ~ "]", 1);
props.copy(group.getNode("text-template"), target);
target.getNode("row").setValue(row);
if (size(engines.getChildren("engine")) == 1) {
target.getNode("label").setValue("Engine");
} else {
# Engines are indexed from 1 in the GUI.
target.getNode("label").setValue("Engine " ~ (engine + 1));
}
# Now the checkbox
target = group.getNode("checkbox[" ~ i ~ "]", 1);
props.copy(group.getChild("checkbox-template"), target);
target.getNode("row").setValue(row);
var failure = "/sim/failure-manager/engines/engine[" ~ engine ~ "]/serviceable";
target.getNode("property").setValue(failure);
# Finally the MTBF
target = group.getNode("input[" ~ i ~ "]", 1);
props.copy(group.getChild("input-template"), target);
target.getNode("row").setValue(row);
i += 1;
var mtbf = "/sim/failure-manager/engines/engine[" ~ engine ~ "]/mtbf";
target.getNode("property").setValue(mtbf);
engine += 1;
}
hbox11lefthboxlefttablecentertop0