Parameters and responses
The two value objects every discipline is built from.
A Parameter is one number cdadt puts into the black box: a value, the units it is
expressed in, and where it came from. A Response is one quantity cdadt reads back
out: a name, the path it lives at inside the box, and the units to read it in.
Both are deliberately small and both encapsulate their state. A parameter’s value is reachable
only through a property that validates it, so a discipline cannot end up holding a string, a
None or a NaN and only discover it when OpenMDAO raises three layers down. Neither
class knows anything about OpenMDAO or OpenConcept; they are plain state.
Provenance is not optional on a parameter. A number with no recorded source is indistinguishable from a guess in the report that quotes it, and this tool exists to produce reports that are argued from.
- class cdadt.parameters.Parameter(name, value, units=None, source='')[source]
Bases:
objectOne design parameter set on the black box.
- Parameters:
name (str) – Name of the variable as the black box publishes it, e.g.
"ac|geom|wing|S_ref".value (float) – Numeric value, expressed in
units.units (str or None, optional) – Units of
value, in OpenMDAO’s unit syntax ("m**2","lbf","kn").Nonefor a dimensionless quantity such as aspect ratio.source (str, optional) – Where the number came from – a reference, a measurement, a requirement, a decision. Default
"", which is allowed but is reported asunsourced.
- Raises:
ValueError – If
nameis empty, or ifvalueis not a finite real number.
Examples
>>> area = Parameter("ac|geom|wing|S_ref", 124.6, "m**2", source="b737.org.uk tech specs") >>> area.value 124.6 >>> area.value = 130.0 >>> area Parameter('ac|geom|wing|S_ref', 130.0, 'm**2')
- property name: str
Name of the variable in the black box. Fixed for the life of the parameter.
- property units: str | None
Units the value is expressed in, or
Noneif dimensionless. Fixed.
- property source: str
Where the value came from. Fixed.
- class cdadt.parameters.Response(name, path, units=None, description='', optional=False)[source]
Bases:
objectOne quantity read back out of the black box.
- Parameters:
name (str) – Short name cdadt reports it under, e.g.
"block_fuel". Unique within a discipline.path (str) – Where the quantity lives inside the black box, e.g.
"mission.descent.fuel_burn_integ.fuel_burn_final". This is the black box’s name, not cdadt’s, and it is written down here rather than assembled at read time so that the whole interface can be listed without running anything.units (str or None, optional) – Units to read the quantity in.
Nonefor dimensionless.description (str, optional) – One line explaining what the quantity is.
optional (bool, optional) – Whether the quantity may be absent. Default
False. A response is optional when it exists only in a particular black-box model – the per-component weight breakdown, for instance, exists because OpenConcept’s jet-transport empty-weight buildup publishes it, and a different sizing model need not. A missing required response is an error; a missing optional one is reported as unavailable.
Examples
>>> Response("block_fuel", "mission.descent.fuel_burn_integ.fuel_burn_final", "kg") Response('block_fuel', 'mission.descent.fuel_burn_integ.fuel_burn_final', 'kg')
- property name: str
Short name cdadt reports the quantity under.
- property path: str
Path of the quantity inside the black box.
- property units: str | None
Units the quantity is read in, or
Noneif dimensionless.
- property description: str
One line explaining what the quantity is.
- property optional: bool
Whether the quantity may legitimately be absent from a given black-box model.