I would like to reconfigure my electrical system from Python, i.e. connect the components in different ways programmatically. Ideally, I would create a subsystem for each part of the circuit and then connect these subsystems in various configurations via Python/RPC.
Is there a way to do this in PLECS, or any recommended workaround?
At the moment, the only solution I can think of is to build a large matrix of controlled electrical switches.
There isn’t a native API to make/modify electrical connections. The overall circuit must be constructed and then reconfigured via variables you can set through the RPC interface.
Electrical switches are one option, however depending on how you connect the switches the various electrical systems will still be simulated.
Two suggestions:
Use Wire Multiplexer and Wire Selector components. This might have less electrical clutter than a matrix of switches. See the Implicit Model Vectorization tutorial for a few ways to use the component, for example to have various converters in parallel.
Use Configurable Subsystems which could contain different electrical circuits and even “empty” implementations to disable the circuit.