Grand-tour subject

The module needs no extra. The grand tour (tutorial 9) uses it.

The subject of the grand tour: one mission architecture and its preset.

A subject is one mission architecture. It names a mission (a key of longeron.analysis.dashboard.DEFAULT_MISSIONS), one variant of the mission’s airframe variation point, one variant for each remaining variation point, and a set of transient attribute overrides. A bare airframe is never a subject, because the subject parameter of a mission requirement is a MissionUAV.

The module has three pure functions over the model and the trade study (longeron.analysis.trades). No function creates a widget.

  • preset() pins the airframe and picks the trade study’s best selection for it. A verified mix is a mix that violates none of the mission’s constraints. The preset is the verified mix with the largest mission metric. If the airframe has no verified mix, the preset is the mix with the fewest violations, and Preset.basis says so.

  • craft_variant() maps a clicked definition to its airframe variant. A build configuration such as Rotorcraft::QuadCopter is not a catalog airframe, so it maps to None.

  • requirement_set() pairs each requirement definition, and each requirement usage that a package owns, with the first instance of the subject where the requirement applies. The interpreter decides conformance to the subject parameter and applicability.

longeron.analysis.subject.MissionName

the keys of DEFAULT_MISSIONS, one per mission context of ScoutMissions (a test keeps the two equal)

alias of Literal[‘ISR’, ‘logistics’, ‘intercept’]

class longeron.analysis.subject.Preset(architecture, basis)[source]

Bases: object

The trade study’s selection for one airframe in one mission.

architecture: Architecture

the chosen mix, its metrics and violations

subject(mission, *, point='airframe')[source]

The subject that this preset fills, with no overrides.

Return type:

Subject

longeron.analysis.subject.PresetBasis

how preset() chose its mix: "verified" is the best verified mix, "fewest_violations" is the fallback for an airframe with no verified mix

alias of Literal[‘verified’, ‘fewest_violations’]

class longeron.analysis.subject.Subject(mission, airframe, selection, overrides=<factory>)[source]

Bases: object

One mission architecture: the referent of every tour pane.

selection maps each variation point except the airframe point to a variant name. overrides maps an attribute path to a transient value. A transient value replaces the model value for the analysis only and never writes the model.

airframe: str

the variant name of the airframe variation point

mix(*, point='airframe')[source]

The full selection, in the form TradeStudy.evaluate() takes.

Return type:

dict[str, str]

longeron.analysis.subject.craft_variant(study, element, *, point='airframe')[source]

The variant of point that element names, or None.

element is a variant usage of the point’s variation definition, or the definition that types a variant. The match is exact: a specialization of a variant’s type does not match that variant. A build configuration such as Rotorcraft::QuadCopter types no variant, so the function returns None for it.

Return type:

str | None

longeron.analysis.subject.preset(study, airframe, metric, *, point='airframe')[source]

The best mix for airframe by metric, larger values first.

The function pins point to airframe and evaluates every mix of the other variation points with the interpreter. The result is the verified mix with the largest metric. If no mix is verified, the result is the mix with the fewest violations, and the larger metric breaks a tie. The basis field tells the two cases apart. Every DEFAULT_MISSIONS metric is larger-is-better.

Return type:

Preset

longeron.analysis.subject.requirement_set(mission, airframe, *, interp)[source]

Each applicable requirement, with the instance it scores.

A requirement here is a requirement definition, or a requirement usage that a package owns (such as DeepScout::installation). A nested requirement usage scores with its owner. mission is an instance of the mission definition, and airframe is the airframe instance that mission holds. If mission or airframe conforms to the type of the subject parameter, the requirement definition is a candidate. The interpreter checks a candidate against mission first, then against airframe. The first instance that satisfies every assume constraint is the pair. An assume constraint that the interpreter cannot evaluate does not hold. A requirement that applies to neither instance is not in the result. The keys are qualified names, in model order.

Return type:

dict[str, Instance]