[Reddit Cross Post] Connect Simulink signal to Electrical (Simscape) signal

23 views (last 30 days)
I need to use a signal generated in a Simulink subsystem and output its voltage to Simscape Electrical model.
While I know how to convert Simscape signals to Simulink (using a sensor and the PS-Simulink Converter), I'm stuck doing the reverse.
What is the standard method for converting a Simulink signal into the Simscape Electrical domain to control a source? The Simulink-PS Converter block doesn't seem to connect directly to the control port of the electrical sources.
Is this a practical approach for integrating two large, existing systems? Any examples would be great.

Answers (1)

Neal
Neal on 16 Oct 2025 at 6:42
Hi Toshiaki,
This might be bit of a convoluted way, since I haven't actually spent any time trying out other ways. But off the top of my head you could write out your simulink signal to your workspace as a variable (this might be a challenge as the block "to Workspace" only writes after the simulation has ended or paused, alternatively you could try a matlab function block with "assignin" function, I donot know if it writes after every sample time or at the end of the simulation) and then parameterise your simscape electrical source to accept that variable as its amplitude.
Good luck.

Products


Release

R2025b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!