Asset factories¶
Overview¶
This page is a contributor-facing map of the ESDL asset factory layer. Use it when you need to see
what each concrete mapper adds on top of EsdlMapperAbstract during ESDL-to-entity conversion.
The key distinction is small but important: the abstract contract only declares the conversion
methods, while each concrete mapper implements simulator-specific construction logic in
to_entity. In the current codebase, every mapper on this page leaves to_esdl
unimplemented and raises NotImplementedError.
For the broader orchestration path that uses these mappers, see General architecture.
Abstract mapper contract¶
EsdlMapperAbstract defines exactly two abstract methods:
to_esdl(entity)for mapping a simulator entity back to an ESDL asset object.to_entity(model)for mapping an ESDL asset object into a simulator entity.
The base class does not provide shared field extraction, defaults, validation, or branching
behavior. Those responsibilities are entirely delegated to each concrete mapper. In the current
implementation, the concrete mappers on this page only specialize to_entity and intentionally
leave to_esdl unavailable.
Concrete mapper comparison¶
Mapper - Entity returned - ESDL data read - Defaults, branching, or validation |
|---|
|
|
|
|
|
|
|
Per-mapper notes¶
Producer mapper¶
EsdlAssetProducerMapper is the simplest specialization of the abstract contract. Its
to_entity method constructs a ProductionCluster from only three inputs:
esdl_asset.esdl_asset.name, esdl_asset.esdl_asset.id, and esdl_asset.get_port_ids().
It does not inspect any producer-specific ESDL properties, apply defaults, or perform validation.
Consumer mapper¶
EsdlAssetConsumerMapper mirrors the producer mapper, but returns a DemandCluster.
Its to_entity method also reads only the asset name, asset id, and port ids. No extra
consumer-specific properties are interpreted, and there is no branching or fallback logic.
ATES mapper¶
EsdlAssetAtesMapper extends the minimal name/id/ports pattern by reading a larger property set
before constructing an AtesCluster. In addition to the shared asset metadata, it reads these
ESDL properties, each falling back to ATES_DEFAULTS when absent:
ESDL property - Internal field - Default - Unit |
|---|
|
|
|
|
|
|
|
|
|
|
The mapper does not add extra branching logic; its specialization is that it always tries to populate the ATES-specific constructor arguments, even when the ESDL asset omits them.
aquiferMidTemperature is the one property in this set mapped in degrees Celsius. Every other
temperature-like property mapped elsewhere on this page (for example the pipe mapper’s
external_temperature) uses Kelvin; this is an existing inconsistency in the source data, noted
here for contributor awareness rather than something this page changes.
Heat pump mapper¶
EsdlAssetHeatPumpMapper adds the first substantive construction branch. It checks
esdl_asset.get_number_of_ports() and chooses the returned entity type from that port count:
4ports produces aHeatPumpfor the water-to-water case.2ports produces anAirToWaterHeatPump.
ESDL property - Internal field - Default - Unit - Applies to |
|---|
|
|
Any other port count raises NotImplementedError with a message that documents the supported
two-port and four-port shapes.
Heat exchanger mapper¶
EsdlAssetHeatExchangerMapper reads a single property beyond the shared asset metadata before
constructing a HeatExchanger:
ESDL property - Internal field - Default - Unit |
|---|
|
There is no branching or validation beyond this single fallback lookup.
Ideal heat storage mapper¶
EsdlIdealHeatStorageMapper constructs an IdealHeatStorage from two defaulted properties and
two port-derived temperatures:
ESDL property - Internal field - Default - Unit |
|---|
|
|
port |
port |
Unlike every other property on this page, the two temperatures have no static default: if the
ESDL port temperature profile does not supply a value, get_temperature raises rather than
falling back to a constant.
Pipe mapper¶
EsdlAssetPipeMapper performs the richest property mapping on this page. Its to_entity
method constructs a Pipe from direct properties, helper-derived values, and multiple
fallbacks:
ESDL property - Internal field - Default - Unit |
|---|
|
|
|
|
|
Two further fields are derived rather than read with a single direct default:
Inner diameter:
_get_diameter()first readsinnerDiameter(m). If that value is zero, it triesdiameteras a nominal DN value. When a DN value is available, the mapper looks up the corresponding EDR object with the default schedule fromPIPE_DEFAULTSand returns itsinnerDiameter(m). If neither source is available, it falls back toPIPE_DEFAULTS.diameter=1.2m.Heat-transfer coefficient:
_get_heat_transfer_coefficient()usesget_thermal_conductivity_table()andcalculate_inverse_heat_transfer_coefficient()to derive analpha_valuein W/(m2 K). If no conductivity table can be built, it falls back toPIPE_DEFAULTS.alpha_value=0.0.
This mapper also contains the main failure path in the group. If DN-based diameter lookup requires
EDR access and _get_esdl_object_from_edr() cannot retrieve the expected object, it raises
RuntimeError rather than silently accepting an invalid diameter.