MATLAB Answers

0

How can i replace Simscape "DC Voltage Source" with a Simulink signal?

Asked by Multiplexer on 4 Aug 2017
Latest activity Commented on by Mark Sherstan on 20 Nov 2018
(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.

  0 Comments

Sign in to comment.

2 Answers

Answer by Multiplexer on 7 Aug 2017
Edited by Multiplexer on 7 Aug 2017
 Accepted Answer

Wow, ok, this is what it turned out to be the problem. I used "wrong" controlled voltage source block.
So apparently there are two blocks with exactly same name, one is
Specialized Technology/Fundamental Blocks/Electric Sources/Controlled Voltage Source
and the other is
Foundation Library/Electrical/Electrical Sources/Controlled Voltage Source
The second one would not connect at all to the circuit (as on images above) but when i picked the first one it worked.

  0 Comments

Sign in to comment.


Answer by Daniel Burke on 4 Aug 2017

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

Yeah, i might have not explain my problem very well, I'll try again, this time with images, this should clear things up (and ill update original post too).
So there is this elec_motor_dc_pwm example which is SimScape electric motor controlled by PWM.
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.
I ran across this post looking for something else but you needed a Simulink-PS Converter to bridge between simulink and simscape.

Sign in to comment.