How can i replace Simscape "DC Voltage Source" with a Simulink signal?
Show older comments
(UPDATED)
Hello, there is this elec_motor_dc_pwm example which is SimScape electric motor controlled by PWM (it uses PWM signal for motor speed and has an integrated H-Bridge model).
In the example it uses a "DC Voltage Source" block to set PWM reference voltage that controls simulated motor.
What i want is to be able to somehow set the motor voltage with a Simulink "double" data type signal instead of that constant "DC Voltage Source" ("double" data type signal from Simulink will be changing over time during simulation).

The first thing that came to my mind was to use a "S PS" converter block but "DC voltage source" block needs two inputs and it wouldn't connect anyway

So i found a "Controlled Voltage Source Block". I changed its type to "DC", set "Initialize", "Initial amplitude 0" and set "Measurements Voltage".
After that i connected Simulink "double" data type signal to "S" input of "Controlled Voltage Source" and after that i tried replacing Simscape "DC Voltage Source" with new block like below

but the signals still wont connect, when i get them close to each other a little red crossed circle icon appears.
I'm obviously missing something, some additional conversion but i have no idea what is it.
Accepted Answer
More Answers (1)
Daniel Burke
on 4 Aug 2017
2 votes
I’m not entirely sure by your description but it seems like you have tried replacing the "PWM reference voltage" block with a controlled voltage source, then routing the output of a S-PS converter block into the input of that controlled voltage source. I was able to run it using a constant as my input to the S-PS converter and setting the “Input signal unit” parameter inside of the S-PS converter to V in the drop-down menu. If this is not working on your end the problem might instead be with the signal you are trying to use from Simulink.
2 Comments
Multiplexer
on 7 Aug 2017
Mark Sherstan
on 20 Nov 2018
I ran across this post looking for something else but you needed a Simulink-PS Converter to bridge between simulink and simscape.
Communities
More Answers in the Power Electronics Control
Categories
Find more on Converters (High Power) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

