I want to make a feeedback closed loop for PWM controlled dc motor in simulink

5 views (last 30 days)
TASK - DC motor speed control • Create a 3D model of a DC motor with an output shaft. You can install the shaft e.g. gear or propeller to better track its movement. •
Create a feedback model of the speed control of a DC motor in the Matlab environment. The electrical and mechanical parameters will be given to you. Choose the regulator at your own discretion. Import the motor model similarly as in project 1. •
Transfer the control system to the Nucleo STM32 board and spin a real DC motor with it.
Problem :I am stuck in making the feedback control for the PWM controlled dc motor I am unable to connect the the loop. I know that my output of ideal rotational sensor port A should go in transfer function then in pid then it should feed as input to pwm controlled at ref+ but the lines are not connecting can anyone please help me

Answers (1)

Aravind
Aravind on 17 Dec 2024
It sounds like you are trying to close the feedback loop in your PWM-based motor speed control model but are facing issues with connecting the lines.
To apply a varying voltage across the “ref+” and “ref-” ports of the “Controlled PWM Voltage” block, you should use the “Controlled Voltage Source” block instead of the “Voltage Source” block. The “Controlled Voltage Source” block includes an additional port for providing a varying signal that represents the voltage to be maintained across the source terminals. You can find more details about this block here: https://www.mathworks.com/help/simscape/ref/controlledvoltagesource.html.
From the model image you shared, it appears you are using blocks from both Simscape Electrical and Simscape Mechanical libraries. Since these blocks belong to different libraries, you cannot connect them directly. The signals in Simscape blocks are physical signals, which differ from standard Simulink signals.
To bridge this gap, use a “PS-Simulink Converter” block to convert a physical signal to a Simulink signal. This Simulink signal can then be processed using normal Simulink blocks, including the “PID Controller” block. After processing the signal to determine the required PWM voltage, convert it back to a physical signal using the “Simulink-PS Converter” block. This converted signal should be connected to the input port of a “Controlled Voltage Source,” which is placed across the “ref+” and “ref-” ports of the “Controlled PWM Voltage” block. By following this method, you can successfully close the feedback loop and achieve the desired motor speed control.
For more information on the blocks mentioned, you can refer to these links:
  1. PS-Simulink Converter: https://www.mathworks.com/help/simscape/ref/pssimulinkconverter.html
  2. Simulink-PS Converter: https://www.mathworks.com/help/simscape/ref/simulinkpsconverter.html
  3. PID Controller: https://www.mathworks.com/help/simulink/slref/pidcontroller.html
I hope this helps resolve your query.

Community Treasure Hunt

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

Start Hunting!