Grand-tour knobs¶
The module needs no extra. The grand tour (tutorial 9) uses it.
The knobs of the grand tour, derived from the model.
A knob is a slider or a dropdown that the tour derives from the model
for one subject (longeron.analysis.subject). No annotation and no
Python table declares a knob. derive_knobs() reads the knobs off
one definition with these rules:
An input attribute is an attribute whose value is a numeric literal, not a derived expression. The function lists the input attributes of the definition, own and inherited.
A bound source is an
assertconstraint of the definition, or arequireconstraint of a requirement definition whose subject type the definition conforms to. The function removes the subject name from arequirebody, souav.xbecomesx.An
assumeconstraint is never a bound source. An assume constraint states where a requirement applies, not a range.The function folds
x >= aandx <= bin both orientations and throughandconjunctions. Only a literalaorbcounts.An input attribute with a lower and an upper bound becomes a
Sliderover the closed interval. The slider starts at the literal value.An input attribute with one bound gets no slider.
KnobSet.skippedlists it with the reason, so a notebook can print the gap.Each variation point of the trade study becomes a
Dropdownover its variants, except the airframe point. A click in the tour fills the airframe point.With a trade study, a slider is kept only if its input reaches the mission: the metric, or a constraint of the study’s assembly that reads more than the input itself. A constraint that reads only the input is the input’s range, not a use of it.
TradeStudy.dependentsanswers the question from the model’s references, so no attribute name is matched. An input that does not reach goes toKnobSet.skippedas"unreachable". For example, the ISR mission never reads the airframe’scruiseSpeed.
The module imports no third-party package, and no function creates a widget. The knob set describes the knobs, and the tour builds them.
- class longeron.analysis.knobs.Dropdown(point, variants, selected)[source]¶
Bases:
objectA variation point and its variants, in model order.
- class longeron.analysis.knobs.KnobSet(sliders, dropdowns, skipped)[source]¶
Bases:
objectThe knobs of one subject, in model order.
- longeron.analysis.knobs.SkipReason¶
why an input attribute with a bound gets no slider:
"lower_only"and"upper_only"name the one bound found,"default_outside"says the literal value is outside the interval, and"unreachable"says the input reaches neither the metric nor a constraint of the subject mission (rule 8)alias of
Literal[‘lower_only’, ‘upper_only’, ‘default_outside’, ‘unreachable’]
- class longeron.analysis.knobs.Skipped(name, reason, low, high)[source]¶
Bases:
objectAn input attribute with a bound but no slider, and the reason.
- class longeron.analysis.knobs.Slider(name, low, high, step, value)[source]¶
Bases:
objectAn input attribute with two literal bounds.
nameis the override key ofTradeStudy.evaluate. An attribute of the airframe variant takes the form<point>.<attribute>.
- longeron.analysis.knobs.derive_knobs(interp, definition, *, study=None, selection=None, point='airframe', metric=None)[source]¶
The knobs of
definitionby the rules of this module.definitionis a mission definition, an airframe definition, an airframe variant usage, or a sizing context such asScoutSizing::IsrPrime.studyis the trade study overdefinition. Each of its variation points exceptpointbecomes a dropdown. Without a study, the knob set has no dropdowns.selectionmaps variation points to variant names, in the form ofTradeStudy.evaluate. If it names apointvariant, the sliders of that variant join the set as<point>.<attribute>. Each dropdown selects the variant thatselectionnames, or the first variant ifselectionnames none. Aselectionneeds astudy.With a
study, rule 8 removes each slider whose input reaches neithermetric(a derived attribute of the study, the mission metric) nor a constraint of the study’s assembly.- Return type: