Parameter Groups — Making a Parameter Tree#
Parameters can be arranged in a tree.
Apps are the top-level parameter groups. By convention, these typically represent independent sub-systems or simulation models. Parameter groups have child parameters, but can also contain child parameter groups, forming a tree.
Like parameters, group identifiers have the same app name suffix to ensure uniqueness.
var config = new ConfigurationBuilder
{
Applications =
{
new ApplicationBuilder("hydro")
{
Description = "Hydraulics",
ChildParameterGroups =
{
new ParameterGroupBuilder("rat:hydro", "RAM Air Turbine")
{
ChildParameters =
{
new ParameterBuilder("ratDeployed:hydro", "ratDeployed", "RAT deployed")
}
},
new ParameterGroupBuilder("ptu:hydro", "Power Transfer Unit")
{
// ..
}
}
}
}
}.BuildConfiguration();
Tip
In the C# API, the Application
and ParameterGroup
classes — after building configuration — both implement IParameterTreeGroup
.
This interface provides description and tree-traversal abstractions.
Parameters are serialized as a flat list, and referenced from the "tree"
by identifier.
{
"hydro": {
"desc": "Hydraulics",
"tree": {
"groups": [
{
"id": "rat:hydro",
"desc": "RAM Air Turbine",
"params": [
"ratDeployed:hydro"
]
},
{
"id": "ptu:hydro",
"desc": "Power Transfer Unit"
}
]
},
"parameters": [
{
"id": "ratDeployed:hydro",
"name": "ratDeployed",
"desc": "RAT deployed"
}
]
}
}
Info
Parameters can be added into more than one parameter group, so that they appear in the tree in multiple places.
This can be useful where a parameter could fit into more than one logical category.