PID loops or Complementary filter for University project?

Click For Summary

Discussion Overview

The discussion revolves around the use of PID loops and complementary filters in the context of a university project focused on practical differential equations. Participants explore the applicability of these concepts to control systems, particularly in relation to a DC motor controlling a raft's position. The conversation includes considerations of differential equations, transfer functions, and the mathematical foundations of control systems.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant expresses uncertainty about whether PID loops involve differential equations, despite their use of integrals and derivatives.
  • Another participant provides a transfer function for a DC motor, suggesting it represents a second-order differential equation in the Laplace domain.
  • A participant discusses the formulation of a PID controller and its impact on the system's stability and robustness, emphasizing the use of root locus analysis.
  • There is a clarification regarding the variables in the transfer function, with a focus on the distinction between angular speed, supplied voltage, and the Laplace variable.
  • Participants discuss the role of PID controllers in calculating optimal torque rather than speed, highlighting the complexity of control systems.
  • One participant seeks sources for further understanding the concepts discussed, indicating a desire for additional resources to support their project.
  • There are mentions of the need to consider time delays and the differences between Laplace and z-transforms when implementing control systems using microcontrollers.

Areas of Agreement / Disagreement

The discussion contains multiple competing views and remains unresolved regarding the best approach to incorporate differential equations into the project. Participants have differing interpretations of the role and formulation of PID controllers and their relation to the project requirements.

Contextual Notes

Participants express uncertainty about the specific differential equations applicable to their projects and the complexity required for their assignments. There are also discussions about the assumptions underlying the transfer functions and the implications of using different mathematical domains (Laplace vs. z-transform).

Jarfi
Messages
384
Reaction score
12
I am studying "maths III" in my university. And the course has this project you have to do called "Practical differential equations". You are basically supposed to describe some practical system that uses differential equations.

My thought was PID loops, but I'm not sure if they use differential equations? I really wanted to use them though because I have used them before in a DIY project, although they use integrals and derivatives I'm not sure there is a differential equation.

My second possibility was using a low or high pass filter, or even a khalmann filter. In regards to combining IMU data(gyro and accelerometer) to form angle measurments. But I don't quite remember a solid differential equation from there, just a lot of usage of integrals and derivatives.

I need at least one differential equation used, preferably some of the more complex ones, like Laplace transforms or the delta functions, or something like Linear differential equations. I'm basically not sure weather PID loops cut the criteria. The System I planned on using for the PID loop was a DC motor controlling a simple raft with another object on it, this DC motor controlled the placement of the raft using a PID loop to regulate the current or force used to push this raft

Thank you in advance,
-Jarfi
 
Engineering news on Phys.org
Jarfi said:
I need at least one differential equation used, preferably some of the more complex ones, like Laplace transforms or the delta functions, or something like Linear differential equations. I'm basically not sure weather PID loops cut the criteria. The System I planned on using for the PID loop was a DC motor controlling a simple raft with another object on it, this DC motor controlled the placement of the raft using a PID loop to regulate the current or force used to push this raft
The DC motor could have a transfer function like:

ω(s)/V(s) = 5 / ( s2 + 11s + 10 )

That's a 2. order differential equation, formulated in the Laplace domain.

Now inserting a PID controller, which could be formulated: y(s)/x(s) = k ( s + a ) / ( s + b ), you multiply by a 1. order transfer function, giving a product of 3. order.
By means of root locus, you can predict when the controlled motor will be stable/unstable/robust, varying k, a, b.

That's "Practical differential equations".

If it's too easy, you can just design a more complex controller, e.g. to (velocity)control the DC-motor so that it will run with no following error at any speed and any load.
 
Hesch said:
The DC motor could have a transfer function like:

ω(s)/V(s) = 5 / ( s2 + 11s + 10 )

That's a 2. order differential equation, formulated in the Laplace domain.

Now inserting a PID controller, which could be formulated: y(s)/x(s) = k ( s + a ) / ( s + b ), you multiply by a 1. order transfer function, giving a product of 3. order.
By means of root locus, you can predict when the controlled motor will be stable/unstable/robust, varying k, a, b.

That's "Practical differential equations".

If it's too easy, you can just design a more complex controller, e.g. to (velocity)control the DC-motor so that it will run with no following error at any speed and any load.

This seems good. I am currently using a motor controller, But I presume that when I showcase the project I can just explain how a motor controller might have a transfer function like the one you described. Do you have sources on what you are explaining? I'd be great to have something to work with... So w is the angular speed, V is the speed of the DC motor, and S is the input I presume? I'd also assume that your variables such as 11 and 10 are random, and you'd f.ex set a / ( s2 + bs + c ). Where a, b, c are real numbers.

Concerning the PID controller, I did not get your equation y(s)/x(s) = k ( s + a ) / ( s + b ) but I assume that the PID loop would give out an optimal "speed" V the motor should be running at at any given moment. For reaching the command state, you use laplace transforms and solve the differential equation, getting the input S which can be a valid current output controlled by a microcontroller. Am I getting this correctly? This seems like a great way for say a turbine to reach a set-speed, seems practical.

If you were assuming the purpose of the PID loop I used was to reach an optimal velocity of the motor, that is not what it was. Which is still fine, as long as I have a useful differential equation to look into. The system I created was a PID loop to place the raft controlled by the motor to a certain position ranging from say +/- 20cm. I did this without even calculating the speed of the motor, but using a PID loop to decide where the output should be from Maximum power+/-(255) to minimum power(0) based on the three variables(location, speed, and acceleration). And then calibrating the variables. An encoder was used to measure rotation.
 
Jarfi said:
So w is the angular speed, V is the speed of the DC motor, and S is the input I presume?
No, ω is the angular speed, V is the supplied voltage to the motor, s is the Laplace variable ( complex variable ), like t is the variable in the time domain.
Jarfi said:
I'd also assume that your variables such as 11 and 10 are random
They are constants, describing the behavior of the tranfer function. If you write: s2 + 11s + 10 = 0, you will have the characteristic equation, which will tell you the time constant/oscillation frequency/damping ratio.
Jarfi said:
Concerning the PID controller, I did not get your equation y(s)/x(s) = k ( s + a ) / ( s + b )
A PID filter contains one zero ( at s = -a ) and one pole ( at s = -b ). It's a 1. order filter. k is the amplification.
Jarfi said:
I assume that the PID loop would give out an optimal "speed" V the motor should be running at at any given moment.
No, it will calculate the optimal torque needed to satisfy the speed requirements: Too low speed → more positive torque/acceleration.
Jarfi said:
For reaching the command state, you use laplace transforms and solve the differential equation, getting the input S which can be a valid current output controlled by a microcontroller.
By analysing the closed PID loop with root locus, I determine the optimal values of the k, a, b in the PID filter. Then the PID filter will solve:

y(s)/x(s) = k(s+a)/(s+b) →
y(s) = ( x(s)*k*(s+a) - s*y(s) ) / b

This is normally implemented by an electronic analog circuit. ( opamp + RC-network ).

If a microcontroller is to be used, you should use z-transform ( difference equations ) instead of Laplace transform ( differential equation ). That's because a μ-controller have to do the control by discrete samples with time-delays in between, thus the dx/dt operator will be changed to a Δx/Δt operator, which the z-transform handles, regarding these time-delays. The z-transform transfer function of a "PID" filter has the same structure as the Laplace transform, but the z-domain is completely different from the s-domain. So the significance of the location of roots/zeroes/poles is different in the two domains.

The three variables: acceleration/velocity/position are accomplished:

Time domain: a(t) = k , v(t) = k*∫a(t) , p(t) = k*∫v(t).
Laplace domain: a(s) = k , v(s) = k/s , p(s) = k/s2
z-domain: a(z) = k , v(z) = k*z / ( z-1 ) , p(z) = k*z2/( z2 - 2z + 1 )
 
  • Like
Likes   Reactions: Jarfi
Hesch said:
No, ω is the angular speed, V is the supplied voltage to the motor, s is the Laplace variable ( complex variable ), like t is the variable in the time domain.

They are constants, describing the behavior of the tranfer function. If you write: s2 + 11s + 10 = 0, you will have the characteristic equation, which will tell you the time constant/oscillation frequency/damping ratio.

A PID filter contains one zero ( at s = -a ) and one pole ( at s = -b ). It's a 1. order filter. k is the amplification.

No, it will calculate the optimal torque needed to satisfy the speed requirements: Too low speed → more positive torque/acceleration.

By analysing the closed PID loop with root locus, I determine the optimal values of the k, a, b in the PID filter. Then the PID filter will solve:

y(s)/x(s) = k(s+a)/(s+b) →
y(s) = ( x(s)*k*(s+a) - s*y(s) ) / b

This is normally implemented by an electronic analog circuit. ( opamp + RC-network ).

If a microcontroller is to be used, you should use z-transform ( difference equations ) instead of Laplace transform ( differential equation ). That's because a μ-controller have to do the control by discrete samples with time-delays in between, thus the dx/dt operator will be changed to a Δx/Δt operator, which the z-transform handles, regarding these time-delays. The z-transform transfer function of a "PID" filter has the same structure as the Laplace transform, but the z-domain is completely different from the s-domain. So the significance of the location of roots/zeroes/poles is different in the two domains.

The three variables: acceleration/velocity/position are accomplished:

Time domain: a(t) = k , v(t) = k*∫a(t) , p(t) = k*∫v(t).
Laplace domain: a(s) = k , v(s) = k/s , p(s) = k/s2
z-domain: a(z) = k , v(z) = k*z / ( z-1 ) , p(z) = k*z2/( z2 - 2z + 1 )
Thank you so much. I've been watching this series on LT System analysis and how to calculate the speed and torque of a motor given initial conditions etc etc and I think I'm good to go.

Am I safe to say in the presentation, that this system is used for high precision motor applications and motor controllers... Is this used in robotics?
 
Jarfi said:
calculate the speed and torque of a motor given initial conditions etc etc and I think I'm good to go.
Within mathematics, these initial conditions are a must, but in practical applications, as for a DC-motor, you normally set these conditions to zero ( a=0, v=0, p=0 ). I mean that when you switch on the application, this will normally be true. If you switch on your controller and the velocity of the motor at this instance = 2077√3/π [RPM] ( just an example ), how should the controller react? Well, if the set velocity = 0, the controller should bring the motor to a halt, but it should always do that, no matter what this initial condition might be.
Jarfi said:
this system is used for high precision motor applications and motor controllers
It is used to control motors/applications ( what is "high precision"? ). Remember that in an analog controller you are using components ( resistors, capacitors ) with some tolerances, thus it's not "high precision". But by digital control, using integer constants/calculations ( no rounding errors ) e.g. the velocity could be made exact, measured in encoder-counts per sample, and could be made with no following error ( ±1 count ) as said in #2.
Jarfi said:
Is this used in robotics?
Yes, digital control is preferred as robots must be accurate. Say you want to bring the robot to a halt, you must by analog control measure that the robot is halted by means of a tacho generator or a D/A-converter. But if there is an offset in your measurements ( which there is ), the motor will drift ( 1 RPM ). By digital control, using an encoder, 1 count = 1 count, and integer calculation will take care of that and will bring the robot back to correct position, even if the motor is velocity controlled.
 
Last edited:

Similar threads

  • · Replies 12 ·
Replies
12
Views
4K
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 39 ·
2
Replies
39
Views
21K
  • · Replies 8 ·
Replies
8
Views
8K
  • · Replies 7 ·
Replies
7
Views
4K
Replies
1
Views
2K
Replies
13
Views
5K