pathsim.utils.portreference module

class pathsim.utils.portreference.PortReference(block=None, ports=None)[source]

Bases: object

This is a container class that holds a reference to a block and a list of ports.

Note

The default port, when no ports are defined in the arguments is 0.

Parameters:
  • block (Block) – internal block reference

  • ports (list[int, str]) – list of port indices or names

block
ports
to(other)[source]

Transfer the data between two PortReference instances, in this direction self -> other. From outputs to inputs.

Parameters:

other (PortReference) – the PortReference instance to transfer data to from self

get_inputs()[source]

Return the input values of the block at specified ports

Returns:

out – input values of block

Return type:

list[float, obj]

set_inputs(vals)[source]

Set the block inputs with values at specified ports

Parameters:

vals (list[float, obj]) – values to set at block input ports

get_outputs()[source]

Return the output values of the block at specified ports

Returns:

out – output values of block

Return type:

list[float, obj]

set_outputs(vals)[source]

Set the block outputs with values at specified ports

Parameters:

vals (list[float, obj]) – values to set at block output ports

to_dict()[source]

Serialization into dict