pySimBlocks.blocks.systems.sofa.sofa_exchange_i_o

class pySimBlocks.blocks.systems.sofa.sofa_exchange_i_o.SofaExchangeIO(name: str, input_keys: list[str], output_keys: list[str], slider_params: Dict[str, List[float]] | None = None, sample_time: float | None = None)[source]

Bases: Block

SOFA exchange interface block.

Acts as a data exchange boundary between a pySimBlocks model and an external SOFA controller. Input and output ports are declared dynamically from input_keys and output_keys. The block is stateless and performs no computation — outputs are produced by upstream blocks in the pySimBlocks model through normal signal propagation.

input_keys

Names of the input ports fed by the SOFA controller.

output_keys

Names of the output ports consumed by the SOFA controller.

slider_params

Optional ImGui slider configuration, mapping "BlockName.attr" to [min, max] bounds.

direct_feedthrough = False

True if outputs depend directly on inputs.

is_source = False

True if the block produces signals with no inputs.

classmethod adapt_params(params: Dict[str, Any], params_dir: Path | None = None) Dict[str, Any][source]

Strip the scene_file key which is not used by this block.

Parameters:
  • params – Raw parameter dict loaded from the YAML project file.

  • params_dir – Directory of the project file. Not used here.

Returns:

Parameter dict with scene_file removed.

initialize(t0: float) None[source]

No-op: ports are already declared in __init__.

output_update(t: float, dt: float) None[source]

Verify that all inputs are present; outputs are set by upstream blocks.

Parameters:
  • t – Current simulation time in seconds.

  • dt – Current time step in seconds.

Raises:

RuntimeError – If any expected input port is None.

state_update(t: float, dt: float) None[source]

No-op: SofaExchangeIO carries no internal state.