Thanks for watching! Industrial process control is an excellent topic for controls application. Many of the ideas used in aerospace control are equally effective in these other areas.
Hey Ben, love the videos, thanks for the effort. What is the difference between the variables "q" and "q^bar" in the nonlinear aircraft dynamics equations? Also I am assuming that Z_E is the displacement of the thrust vector from the center of mass?
Hey Ben, this is a great video, and it's already helped me a lot, but while I've been trying to understand control theory, the variable s has confused me thoroughly. How is s defined? Can I choose whatever value s will take on (I know that it at least holds the value wj where j is the imaginary number)? or is it based directly on my delta e variable at that point in time that I am simulating. I appreciate your help.
A lot of the research I have done into trying to figure this out tells me that omega is the input frequency, but if I am not using discrete time-steps or I just need to figure out what s is when time = 0, I have no idea what I could use to find that value
Hello there, for our purposes s=jw where w is frequency and j is the imaginary number is sufficient, although there is deeper discussion to be had for sure. Note, the frequency domain analysis assumes that the dynamics are only driven by the oscillatory input and that the transients due to a nonzero initial condition have decayed to where they are negligible. The system output is independent of the initial condition at t=0.
@@LearnGandC Thank you, this helps my understanding somewhat, but a more specific question. How exactly do I calculate the frequency based on a control input? Also, how would I go from finally building my P controller to actually being able to simulate the flight of my model over time?
For controller tuning and analysis, we often use a combination of frequency and time domain methods. However, for simulation of the controller in the loop with the plant, it's done completely in the time domain.
Is there also any way to get s more explicit view of how you did some parts of the process/ calculations. For example when you showed us the equations of motion I wasn’t sure if to treat α as a variable or a constant (trim condition) and if α_T was a variable or constant. I also don’t know what exactly you used as inputs for the Moment/Torque in 7:10. The video is magnificent but some things were skipped such that it is quite hard for me (an enthusiast) to follow/ model by myself with the use of Matlab.
Hi Ben, I just posted a question. It got deleted somehow. Let me paste the entire question here, yet again. It will be missing a diagram but hopefully it will be still meaningful I am trying to simulate a plant on a microcontroller. The transfer function of the plant is 2 Gp(s) = ----------------------------------------- (s+3)(s-1) The step response for this function from Octave is The step response graph cant be pasted but its a curve touching 200 at 6 seconds. The value goes to 200 in 6 seconds and this is what I am trying to reproduce through the difference equation I show a little later The z transform of the above with Ts of 0.001s with zero order hold is 9.993e-07 z + 9.987e-07 Gp(z) = ------------------------- z^2 - 1.998 z + 0.998 The difference equation derived from Gp(z) is y(t) = 9.993e-7 x(t - Ts) + 9.987e-7 x(t - 2Ts) + 1.998 y(t - Ts) - 0.998 y(t - 2Ts) Here is the C code I wrote to realise the above difference equation #include float xtp0 = 0.0; float etp0 = 0.0; float xtp0_minus_Ts = 0.0; float etp0_minus_Ts = 0.0; float xtp0_minus_2Ts = 0.0; float etp0_minus_2Ts = 0.0; float plant0(float input){ etp0 = input; xtp0 = (9.993e-7F * etp0_minus_Ts) + (9.987e-7F * etp0_minus_2Ts) + (1.998F * xtp0_minus_Ts) - (0.998F * xtp0_minus_2Ts); //Saving the history xtp0_minus_2Ts = xtp0_minus_Ts; etp0_minus_2Ts = etp0_minus_Ts; xtp0_minus_Ts = xtp0; etp0_minus_Ts = etp0;
return xtp0; } int main(){ float x = 0.0F; int i; for(i = 0 ; i < 6000; i++){ if(i == 0){ x = plant0(0.0F); } else{ x = plant0(1.0F); } } printf("%f ",x); } I am trying to run the loop 6000 times as that would amount to 6 seconds since the sampling period is 0.001 seconds. I am expecting the value to be 200 as observed in the step response graph. However I get the value 5.321684 from the program. Running the same program on the microcontroller is also giving the same output of 5.321684. My intention as I stated previously, is to make the difference equation respond in the same way as the step response seen in the plot. Where am I going wrong here?
I understand what you are asking, but don't have the time at the moment to dig into this. Offhand, I don't see the issue. If I get time in the coming days, I'll investigate.
@@LearnGandC I got the solution. It was happening because I was using truncated values in the z transform coefficients. After doing a 'format long' in Octave and then extracting the coefficients I got the more accurate values which solved the problem . Now I'm able to simulate the plant in real time, on a CM4F microcontroller.
Hello, "t" is actually tau and it represents the time constant of the system. The variable "s" represents the complex variable j*w, where j = sqrt(-1) is the imaginary number (also commonly denoted i) and w is frequency in rad/s.
Hi Ben I have been following Christopher Lum and I have tried to make the RCAM model, I can't afford matlab, so I am using python. I managed to get a similar function to Christopher Lums matlab version, but I am struggling at making an autopilot for it. th-cam.com/video/bFFAL9lI2IQ/w-d-xo.html this is the video i have tried to remake in python. I was wondering if your course covered, how to make an autopilot within python, or is it only matlab? kind regards Tobias from Denmark
God level information 🙏🏻. Amazed how we have access to such PhD level information for free, these days. Thank you sir.
Hello! Thank you very much! You can access all my videos in one convenient place at www.learngandc.com
@@LearnGandC Thank you very much.
I am really impressed about how do you clearly explain this.
Thank you so much for your generous contribution. 🎉🎉🎉🎉🎉🎉
Thank you, I enjoy making these lessons.
Thank you for this series I would like to know how does control theory applies to things like reactors and chemical plant
Thanks for watching! Industrial process control is an excellent topic for controls application. Many of the ideas used in aerospace control are equally effective in these other areas.
Hey Ben, love the videos, thanks for the effort. What is the difference between the variables "q" and "q^bar" in the nonlinear aircraft dynamics equations? Also I am assuming that Z_E is the displacement of the thrust vector from the center of mass?
Hey Joseph, q is pitch rate and qbar is dynamic pressure. Correct on z_e. Thanks for watching!
Hey Ben, this is a great video, and it's already helped me a lot, but while I've been trying to understand control theory, the variable s has confused me thoroughly. How is s defined? Can I choose whatever value s will take on (I know that it at least holds the value wj where j is the imaginary number)? or is it based directly on my delta e variable at that point in time that I am simulating. I appreciate your help.
A lot of the research I have done into trying to figure this out tells me that omega is the input frequency, but if I am not using discrete time-steps or I just need to figure out what s is when time = 0, I have no idea what I could use to find that value
Hello there, for our purposes s=jw where w is frequency and j is the imaginary number is sufficient, although there is deeper discussion to be had for sure. Note, the frequency domain analysis assumes that the dynamics are only driven by the oscillatory input and that the transients due to a nonzero initial condition have decayed to where they are negligible. The system output is independent of the initial condition at t=0.
@@LearnGandC Thank you, this helps my understanding somewhat, but a more specific question. How exactly do I calculate the frequency based on a control input? Also, how would I go from finally building my P controller to actually being able to simulate the flight of my model over time?
@@LearnGandC Also, is there a way I can access the Octave code that you wrote to do all of this and generate your plots?
For controller tuning and analysis, we often use a combination of frequency and time domain methods. However, for simulation of the controller in the loop with the plant, it's done completely in the time domain.
7:10 shouldn’t the last equation contain a big M (aka M being Torque/Moment)? As currently shown m is a mass. Great video by the way!
You are correct! I'll update the errata in the description. Thanks for catching that.
18:14 I also noticed that in the flight control section it should be -e i think.
Is there also any way to get s more explicit view of how you did some parts of the process/ calculations. For example when you showed us the equations of motion I wasn’t sure if to treat α as a variable or a constant (trim condition) and if α_T was a variable or constant. I also don’t know what exactly you used as inputs for the Moment/Torque in 7:10. The video is magnificent but some things were skipped such that it is quite hard for me (an enthusiast) to follow/ model by myself with the use of Matlab.
Hi, where I can find the numerical data used in linearized dynamics? Thank you
Hello there, the data can be reproduced by running the codes, which are available on my patreon page. Search Learn Guidance and Control.
My God, who figured all of this out
We stand on the shoulders of many smart people who came before us!
Hi Ben, I just posted a question. It got deleted somehow. Let me paste the entire question here, yet again. It will be missing a diagram but hopefully it will be still meaningful
I am trying to simulate a plant on a microcontroller. The transfer function of the plant is
2
Gp(s) = -----------------------------------------
(s+3)(s-1)
The step response for this function from Octave is
The step response graph cant be pasted but its a curve touching 200 at 6 seconds.
The value goes to 200 in 6 seconds and this is what I am trying to reproduce through the difference equation I show a little later
The z transform of the above with Ts of 0.001s with zero order hold is
9.993e-07 z + 9.987e-07
Gp(z) = -------------------------
z^2 - 1.998 z + 0.998
The difference equation derived from Gp(z) is
y(t) = 9.993e-7 x(t - Ts) + 9.987e-7 x(t - 2Ts) + 1.998 y(t - Ts) - 0.998 y(t - 2Ts)
Here is the C code I wrote to realise the above difference equation
#include
float xtp0 = 0.0;
float etp0 = 0.0;
float xtp0_minus_Ts = 0.0;
float etp0_minus_Ts = 0.0;
float xtp0_minus_2Ts = 0.0;
float etp0_minus_2Ts = 0.0;
float plant0(float input){
etp0 = input;
xtp0 = (9.993e-7F * etp0_minus_Ts)
+ (9.987e-7F * etp0_minus_2Ts)
+ (1.998F * xtp0_minus_Ts)
- (0.998F * xtp0_minus_2Ts);
//Saving the history
xtp0_minus_2Ts = xtp0_minus_Ts;
etp0_minus_2Ts = etp0_minus_Ts;
xtp0_minus_Ts = xtp0;
etp0_minus_Ts = etp0;
return xtp0;
}
int main(){
float x = 0.0F;
int i;
for(i = 0 ; i < 6000; i++){
if(i == 0){
x = plant0(0.0F);
}
else{
x = plant0(1.0F);
}
}
printf("%f
",x);
}
I am trying to run the loop 6000 times as that would amount to 6 seconds since the sampling period is 0.001 seconds. I am expecting the value to be 200 as observed in the step response graph. However I get the value 5.321684 from the program. Running the same program on the microcontroller is also giving the same output of 5.321684.
My intention as I stated previously, is to make the difference equation respond in the same way as the step response seen in the plot. Where am I going wrong here?
I understand what you are asking, but don't have the time at the moment to dig into this. Offhand, I don't see the issue. If I get time in the coming days, I'll investigate.
@@LearnGandC I got the solution. It was happening because I was using truncated values in the z transform coefficients. After doing a 'format long' in Octave and then extracting the coefficients I got the more accurate values which solved the problem . Now I'm able to simulate the plant in real time, on a CM4F microcontroller.
Oh! I suspected that, but wanted to test it out. Thanks for letting me know!
@@LearnGandC Welcome 👍🏻 I got the solution from dsp stack exchange
what do the variables "t" and "s" represent in the first order low-pass filter `1/(ts + 1)`?
Hello, "t" is actually tau and it represents the time constant of the system. The variable "s" represents the complex variable j*w, where j = sqrt(-1) is the imaginary number (also commonly denoted i) and w is frequency in rad/s.
Hi Ben
I have been following Christopher Lum and I have tried to make the RCAM model, I can't afford matlab, so I am using python.
I managed to get a similar function to Christopher Lums matlab version, but I am struggling at making an autopilot for it.
th-cam.com/video/bFFAL9lI2IQ/w-d-xo.html
this is the video i have tried to remake in python.
I was wondering if your course covered, how to make an autopilot within python, or is it only matlab?
kind regards Tobias from Denmark
Hi Tobias,
Presently, I use Octave, which is very similar to Matlab but open software.
I plan to code Python in the future.
Regards,
Ben