Information Sharing via CouplingParameters and MiddleLevelDataStorage¶
Two LocalSubSystemBasis instances exchange relevant information through a pairwise-shared resource MiddleLevelDataStorageBasis instance. Every coordination method seeks to satisfy the pairwise coupling constraints between two LocalSubSystemBasis instances (recall Categorization and Selection of Suitable Solution Approaches). For this reason, the MiddleLevelDataStorageBasis between them holds information on _mappedresponses \(^{i}_{j}\)\(H\), _couplingvariable \(^{i}_{j}\)\(h\), _shareddesignvariable \(^{i}_{j}\)\(z\) and _targetshareddesignvariable \(^{i}_{j}\)\(z_{t}\) as illustrated below. Depending on the specific coordination method, additional information may be exchanged between subsystems.
Similarly, there exists a single MiddleLevelDataStorageBasis instance between a LocalSubSystemBasis instance and a ControllerSubSystemBasis as illustrated below.
Each coupling therefore has two complementary representations. The MiddleLevelDataStorageBasis instances described above are the shared interface storage through which neighboring subsystems exchange coupling information; because the innerloop runs each subsystem in its own process (via multiprocessing), this shared storage is the mechanism by which information crosses process boundaries. Its counterpart is the subsystem-local view of each coupling, held in the couplingparameters package: every LocalSubSystemBasis keeps a list of coupling-parameter instances — one per pairwise coupling with a neighbor, each inheriting from CouplingParametersBasis — and copies values to and from the shared middlelevel coupling object inside the middlelevel, which always inherits from MiddleLevelCouplingBasis.
Both the middlelevel coupling class and the subsystem-local coupling-parameter class follow the same endpoint-dependent split. A coupling between two LocalSubSystemBasis instances uses the richer SubSysMiddleLevelCouplingBasis (middlelevel) and SubSysCouplingParametersBasis (subsystem-local), which extend MiddleLevelCouplingBasis and CouplingParametersBasis respectively with the four standard coupling quantities (_mappedresponses, _couplingvariable, _shareddesignvariable, _targetshareddesignvariable). A coupling between a LocalSubSystemBasis and a ControllerSubSystemBasis does not use either richer class; because such a coupling is generally asymmetric, it instead splits into directional subclasses inheriting directly from MiddleLevelCouplingBasis / CouplingParametersBasis: LocalToController_MiddleLevelCouplingBasis / ControllerToLocal_MiddleLevelCouplingBasis at the middlelevel, and LocalToController_CouplingParametersBasis / ControllerCouplingParametersBasis at the subsystem-local level.
The complete inheritance structure of both hierarchies is shown on middlelevel and couplingparameters API reference pages.
Each subsystem exchanges coupling information with its neighbors through the shared MiddleLevelDataStorageBasis instances, with both directions protected by a multiprocessing lock: reads via SubSystemBasis.CopyFromMiddleLevel() and writes via SubSystemBasis.CopyToMiddleLevel().
Highlighted lines are linked to the implementation. Hover or click to see the implementing classes/methods, then click through to the full API documentation.
SubSysMiddleLevelCouplingBasis.get_MappedResponses()
SubSysCouplingParametersBasis.set_Copy_MappedResponses()SubSysMiddleLevelCouplingBasis.get_CouplingVariable()
SubSysCouplingParametersBasis.set_Copy_CouplingVariable()Highlighted lines are linked to the implementation. Hover or click to see the implementing classes/methods, then click through to the full API documentation.
SubSysCouplingParametersBasis.get_MappedResponses()
SubSysMiddleLevelCouplingBasis.set_MappedResponses()SubSysCouplingParametersBasis.get_CouplingVariable()
SubSysMiddleLevelCouplingBasis.set_CouplingVariable()By convention the coupling-parameter attributes mirror the naming of the matching SubSysMiddleLevelCouplingBasis class. In addition, each SubSysCouplingParametersBasis holds a set of _copy_* attributes that store the data pulled from the middlelevel (i.e. the neighbor's values). The mapping between the two is realized by the CouplingParametersInterface methods, of which a concrete coupling class must supply the two copy procedures:
CopyFromMiddleLevelCoupling(middlelevelcouplingIn)— read the neighbor's shared values out of the middlelevel into the local_copy_*attributes.CopyToMiddleLevelCoupling(middlelevelcouplingIn)— write this subsystem's own values into the middlelevel for the neighbor to read.
The other two interface methods are largely handled by the base class: get_ID() is already implemented in CouplingParametersBasis, where it returns the stored _id (the identifier of the neighboring subsystem), and update_state(other_coupling) — the multiprocessing state transfer that moves numerical values from a copy returned by a worker process back onto the original object without changing its memory address — already covers _id in the base and only needs extending when a subclass adds numerical attributes.
A key design point is that a CouplingParametersBasis subclass may hold information that is never written to the shared middlelevel — it stays local to the subsystem but remains associated with a specific neighbor. What is and is not communicated is decided entirely by CopyToMiddleLevelCoupling() and CopyFromMiddleLevelCoupling().