pathsim.blocks.switch module

class pathsim.blocks.switch.Switch(state=None)[source]

Bases: Block

Switch block that selects between its inputs and copies one of them to the output.

Sets block output depending on self.state like this:

state = None -> outputs[0] = 0

state = 0 -> outputs[0] = inputs[0]

state = 1 -> outputs[0] = inputs[1]

state = 2 -> outputs[0] = inputs[2]

Parameters:

state (int, None) – state of the switch

update(t)[source]

Update switch output depending on inputs

Parameters:

t (float) – evaluation time