My aim is to design a pid - motor controller in simulink, and i also have to use h-bridges and PWM generator. The motor is a single phase dc-motor. And the aim is to control the speed. The reference signal contains the desired speed interms of volts. this is the proposed design. before i started designing the pid i simply connected the output port of (abs) to the controlled voltage source without adding the summing block and the feedback blocks. The output matched the signal and it looked pretty good. But the aim was to use pid control with feed back so i assembled the system as shown above. Here is where the problem comes in...


When i added the summing block and the pid i got the error algebraic loops which i " corrected " it by going to simulation/ configuration / diagnostics/ and making the error sign to none.

The real problem actually is at my reference and my output. To make it clearer, here is another picture:reference at the signal builder block this is the output of the speed of the motor We can see that that the output of the speed is zero for the first 5 seconds which should actually be somwhere about 700. The weird thing about this is i tried it with a different signal reference and look at what happens.second reference with a slight delay second solution We can see from the picture that it went back to some desired location( or atleast a better one ). But i only changed my reference nothing else. I have done a small delay on the reference so that it is visible. I can even go furthur and delay it even closer to zero so that it would be as if the system works fine as shown below. reference 3 with very small delay (0 from t=0 to t=0.05) solution 3 for reference 3

So what is this phenomenon? I really don't understand where this comes from? Why didn't the signal follow the reference on the first solution and then follow the reference on the rest of the solutions? Is it because of the algebraic loop errors? I really need your help because it has been frustrating me all day! For more information:

$K$ values on the figure simply convert from the voltage signal source to actual rpm values. It is found from steady state analysis by initial value theorem ( answers the question what is the voltage required to rotate the motor at some rpm value $w=K*V$

$PID$ controller is actually a $PI$ controller. I have set $D=0$ P is found root locus plot so that we have a better performance. P=0.04*K. $I$ Is set to 0.1 to reduce steady state error. Found from simple experimentation.

Saturation is set to 0 (lower limit) and 5 (upper limit).

  • \$\begingroup\$ I'm not going to debug it for you, but you need to break it down to defined inputs for acceleration, and velocity with expected inertia, and monitor the sum of Kp, Ki,Kd separately and compare with your expected solutions. \$\endgroup\$ Jan 7, 2019 at 4:34
  • \$\begingroup\$ Welcome to EE.SE! Can you crop your images? \$\endgroup\$
    – winny
    Jan 7, 2019 at 10:14

1 Answer 1


Well... there are a number of concerning points in this model before looking at what is possibly the main query

1) The H-bridge block as the REV pin tied to the inverse of the demand. Is this really needed? what is the "reverse threshold" in the block options. This appears to be a way to disable something but not in the correct method.

2) You are Abs the demand (ok) but you are also Abs the feedback. This is a potential source of problems as now control loop is unable to respond to negative feedback. IF there is not meant to be any negative feedback, other aspects should stop this.

3) You have a PID controller block and then an output saturation block. The PID block comes with an "Output saturation" option as well as integrator anti-windup capability. Without knowing what you are doing here or the relevant settings, how this block is interacting with other blocks could be a source of your odd responses

As to algebraic loop. This occur when the output depends on the input without any means to initialize. If the model is running in discrete mode, put a "memory block" in the feedback (before Gain2). If the model is running in continuous mode, put a continuous transfer function \$ \frac{1}{\tau s + 1} \$ where \$ \tau \$ is say 100x time the frequency you are controlling to.

  • \$\begingroup\$ the rev pin is connected to the input so that reverse operation can operate. if i fix it to the ground or any other fixed point the motor will rotate in a fixed direction. Therefore the direction control is controlled by the rev pin while the magnitude control is controlled by the pid controller. however, i tried removing the saturation block,the absolute value blocks, and connected my REV pin to the ground. but there seems to be no change in the response. \$\endgroup\$
    – Socre
    Jan 14, 2019 at 15:51
  • \$\begingroup\$ the reverse threshold is set to 0 value. so when the signal is positive, the rev pin will get a negative signal and hence a positive rotation, however, if the demand is negative the rev pin will get a positve signal and hence reverse rotation \$\endgroup\$
    – Socre
    Jan 14, 2019 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.