High pass Filter Design

Thread Starter

Abdul Wali

Joined Mar 19, 2016
35
Hi.
i am given a controller T*s/(k*s+k) and a motor k/(T*s^2+s). the controller controls the ac motor. i am required to modify the Simulink block diagram by breaking the controller transfer function into its components and then sending the output to the motor in order to control the motor. i am also given the expected output, bode diagram and signal characteristics of the system. now when i start modifying the controller transfer function, during the process I come to a stage that I need to use the derivative block as shown in the following link (https://www.mathworks.com/help/simulink/slref/derivative.html#br3m9zv-1 ). when i add the derivative block to the system now i am sure that my broken transfer funciton is equal to the given controller transfer function. but there is one problem as i am given the expected output of the system so finally my modified design should also have the same output becouse i didnt bring anything new i just broke the transfer function into its components and then connected all the blocks together so at the end i get the same transfer function BUT my modified version output has a litlle bit noise and the settling time increase. according the MATLAB website i found that the noise is becouse of the derivative block and they have a given a solution (that the derivative block should be replaced by a filter [s/cs + 1] where c=1/fc as shown in the following link https://www.mathworks.com/help/simulink/slref/derivative.html#br3m9zv-1 Now since i am given all of the expected signal characteristics, bode diagram and output signal as shown in the following link ( https://drive.google.com/open?id=0B9NQhKDld_D4T0xwZTdZY1V6NHM ) so can someone help me that how should i choose the value of fc for the filter so that i can get the expected output?
 
Last edited:

MrAl

Joined Jun 17, 2014
13,702
Hi,

I think you need to make your two transfer functions more clear.
You probably need to add parens in the denominator.

For an example though, if you have a transfer function like this:
Hs=(a*s^2)/((b*s+1)*(c*s+1))

then the solutions to the denominator are:
-1/c and -1/b

and this leads to exponentials of the form:
e^(-t/c) and e^(-t/b)

and so b and c are like the RC time constants.

This means the longest time constant would be involved in the settling time.
That is, if b>c then b takes most precedent, and if c>b then c does.

You then have to define what your settling time is. For example, setting to within 5 percent of final value, or settling to within 1 percent of final value.

You can then find the initial value, then solve for the times where it reaches to within x percent of that value, then choose the appropriate one.

The entire time response with a unit step input of the above is:
F(t)=(a*e^(-t/b))/(b*(c-b))-(a*e^(-t/c))/(c*(c-b))

and the initial value is a/(b*c).

If you have values we can do this right here.

For an example, if in the above we make a=1, b=2, c=3, we have a settling time to 1 percent of initial value, of 3*5=15 seconds, and the exact value is 15.53659422 seconds to that many decimal places.
For the approximate settling time to 1 percent all we did was multiply the longest time constant by 5 because 5 time constants result in slightly less than 1 percent settling value.

This doesnt work as well if both time constants are very close to each other though, but should still get a rough idea what it will be. For example with a=1, b=2.9, c=3 it comes out to about 18.6 seconds whcih is a little greater than 15, and represents an error of about 25 percent.
 
Last edited:

Thread Starter

Abdul Wali

Joined Mar 19, 2016
35
Hi,

I think you need to make your two transfer functions more clear.
You probably need to add parens in the denominator.

For an example though, if you have a transfer function like this:
Hs=(a*s^2)/((b*s+1)*(c*s+1))

then the solutions to the denominator are:
-1/c and -1/b

and this leads to exponentials of the form:
e^(-t/c) and e^(-t/b)

and so b and c are like the RC time constants.

This means the longest time constant would be involved in the settling time.
That is, if b>c then b takes most precedent, and if c>b then c does.

You then have to define what your settling time is. For example, setting to within 5 percent of final value, or settling to within 1 percent of final value.

You can then find the initial value, then solve for the times where it reaches to within x percent of that value, then choose the appropriate one.

The entire time response with a unit step input of the above is:
F(t)=(a*e^(-t/b))/(b*(c-b))-(a*e^(-t/c))/(c*(c-b))

and the initial value is a/(b*c).

If you have values we can do this right here.
@MrAl Thanks for your reply.
Screen Shot 2017-07-26 at 11.05.57 PM.png controller transfer function= ts/ks+k
motor transfer function (that is being controlled) = k/ts^2+s
where k= 0.4 and t= 2.7763
filter equation: s/(1/fc)s+1
the remaining information of the signal is in the attached picture.
 

MrAl

Joined Jun 17, 2014
13,702
Hi,

Sorry but you are not making this clear so i will ask a few questions so that i can know exactly what you have.

It seems clear that k=0.4 and t=2.7763 but instead of lower case T i'll use upper case T. Lower case T is used for time. So T=2.7763 also.

First, your controller transfer function is T*s/(k*s+k). True or not true?
You motor is k/(T*s^2+s). True or not true?
The filter you added is s/(Tc*s+1) where Tc=1/fc. True or not true?

Now assuming we can clear that up, how do you have this connected?
You can show a simple block diagram but dont forget any subtraction signs if there are any.

I dont want to have to guess how exactly you have this connected and where you put the filter. It's better to get this all straight first.
 

Thread Starter

Abdul Wali

Joined Mar 19, 2016
35
Hi,

Sorry but you are not making this clear so i will ask a few questions so that i can know exactly what you have.

It seems clear that k=0.4 and t=2.7763 but instead of lower case T i'll use upper case T. Lower case T is used for time. So T=2.7763 also.

First, your controller transfer function is T*s/(k*s+k). True or not true?
You motor is k/(T*s^2+s). True or not true?
The filter you added is s/(Tc*s+1) where Tc=1/fc. True or not true?

Now assuming we can clear that up, how do you have this connected?
You can show a simple block diagram but dont forget any subtraction signs if there are any.

I dont want to have to guess how exactly you have this connected and where you put the filter. It's better to get this all straight first.
Hi,

Sorry but you are not making this clear so i will ask a few questions so that i can know exactly what you have.

It seems clear that k=0.4 and t=2.7763 but instead of lower case T i'll use upper case T. Lower case T is used for time. So T=2.7763 also.

First, your controller transfer function is T*s/(k*s+k). True or not true?
You motor is k/(T*s^2+s). True or not true?
The filter you added is s/(Tc*s+1) where Tc=1/fc. True or not true?

Now assuming we can clear that up, how do you have this connected?
You can show a simple block diagram but dont forget any subtraction signs if there are any.

I dont want to have to guess how exactly you have this connected and where you put the filter. It's better to get this all straight first.
Hi, my answer for all of the above-mentioned question is YES. plz refer to the simulink block diagram as attached below. the filter is added in the controller transfer function. so i break down the parameters of the controller transfer function and added a pole to the term 2.7763s which becomes as 2.7763s/0.01s+1.
 

Attachments

Last edited:

Thread Starter

Abdul Wali

Joined Mar 19, 2016
35
or let me put it this way to u:
i am given a controller T*s/(k*s+k) and a motor k/(T*s^2+s). the controller controls the ac motor. i am required to modify the Simulink block diagram by breaking the controller transfer function into its components and then sending the output to the motor in order to control the motor. i am also given the expected output, bode diagram and signal characteristics of the system. now when i start modifying the controller transfer function, during the process I come to a stage that I need to use the derivative block as shown in the following link (https://www.mathworks.com/help/simulink/slref/derivative.html#br3m9zv-1 ). when i add the derivative block to the system now i am sure that my broken transfer funciton is equal to the given controller transfer function. but there is one problem as i am given the expected output of the system so finally my modified design should also have the same output becouse i didnt bring anything new i just broke the transfer function into its components and then connected all the blocks together so at the end i get the same transfer function BUT my modified version output has a litlle bit noise and the settling time increase. according the MATLAB website i found that the noise is becouse of the derivative block and they have a given a solution (that the derivative block should be replaced by a filter [s/cs + 1] where c=1/fc as shown in the following link https://www.mathworks.com/help/simulink/slref/derivative.html#br3m9zv-1 Now since i am given all of the expected signal characteristics, bode diagram and output signal as shown in the following link ( https://drive.google.com/open?id=0B9NQhKDld_D4T0xwZTdZY1V6NHM ) so can you help me that how should i choose the value of fc for the filter so that i can get the expected output?
 

MrAl

Joined Jun 17, 2014
13,702
Hello again,

Are you sure something else is not right here? I ask because i am finding that the response does in fact settle at less than 10 seconds, but please verify the block diagram i presented in the attachment at the top of the image.

I am seeing something around 8.6 seconds, and this is without a 'high pass filter' addition.

The procedure i used was a very straightforward time domain approach, where we can actually see the waveform output as it settles down after a transient on the input. This is the most intuitive way and we can back it up later with some other ideas from theory too if needed. I also provided the time domain response at the top of the page to the right of the block diagram so you can check that out too. It can be simplified down to one exponential and one cosine term with a phase shift, but it will be the same wave.

Once we have the time domain response we can then find the solution to all he peaks, and examining the amplitudes, we find the peak that is just before the peak where the amplitude is less than the settling time specification which here i assume is 1 percent. We can then home in on the value by finding the solution near that previous peak, or we can just look at it on the graph. In the two graphs in the attachment, the red line is the 99 percent amplitude and the response crosses that line for the last time at around 8.6 seconds so that's the settling time. The heavy green vertical line shows where it crosses the time axis. The light green horizontal line is 1 percent above the final value, just in case it settled above the final value and not below it.

Mathematically, this goes like this...
1. Find the frequency domain response F(s).
2. Transform to the time domain using the Inverse Laplace Transform F(t).
3. Find the derivative dF(t)/dt, set that equal to zero, calculate several peaks starting at the first peak.
4. Find the first peak that goes under 1 percent, select the peak just before that one.
5. Find the exact time solution near that peak, that's the settling time.

This is actually a lot easier than it might sound, especially with this particular system transfer function.

Since it looks like the response does settle in the required time (i think you said 10 seconds) it looks ok, so if you are having a problem with that then maybe something else is wrong.
 

Attachments

Last edited:

Thread Starter

Abdul Wali

Joined Mar 19, 2016
35
Hello again,

Are you sure something else is not right here? I ask because i am finding that the response does in fact settle at less than 10 seconds, but please verify the block diagram i presented in the attachment at the top of the image.

I am seeing something around 8.6 seconds, and this is without a 'high pass filter' addition.

The procedure i used was a very straightforward time domain approach, where we can actually see the waveform output as it settles down after a transient on the input. This is the most intuitive way and we can back it up later with some other ideas from theory too if needed. I also provided the time domain response at the top of the page to the right of the block diagram so you can check that out too. It can be simplified down to one exponential and one cosine term with a phase shift, but it will be the same wave.

Once we have the time domain response we can then find the solution to all he peaks, and examining the amplitudes, we find the peak that is just before the peak where the amplitude is less than the settling time specification which here i assume is 1 percent. We can then home in on the value by finding the solution near that previous peak, or we can just look at it on the graph. In the two graphs in the attachment, the red line is the 99 percent amplitude and the response crosses that line for the last time at around 8.6 seconds so that's the settling time. The heavy green vertical line shows where it crosses the time axis. The light green horizontal line is 1 percent above the final value, just in case it settled above the final value and not below it.

Mathematically, this goes like this...
1. Find the frequency domain response F(s).
2. Transform to the time domain using the Inverse Laplace Transform F(t).
3. Find the derivative dF(t)/dt, set that equal to zero, calculate several peaks starting at the first peak.
4. Find the first peak that goes under 1 percent, select the peak just before that one.
5. Find the exact time solution near that peak, that's the settling time.

This is actually a lot easier than it might sound, especially with this particular system transfer function.

Since it looks like the response does settle in the required time (i think you said 10 seconds) it looks ok, so if you are having a problem with that then maybe something else is wrong.
Hi @MrAl first of all i would say that i really appreciate your help. there is nothing else. actually u are correct the settling time is 8.6 seconds, i was mistaken. now my question is that how we can we relate these all analysis to the main thing that we are doing these all for (fc) Cuttoff frequency of the filter?
 

MrAl

Joined Jun 17, 2014
13,702
Hi @MrAl first of all i would say that i really appreciate your help. there is nothing else. actually u are correct the settling time is 8.6 seconds, i was mistaken. now my question is that how we can we relate these all analysis to the main thing that we are doing these all for (fc) Cuttoff frequency of the filter?
Hello again,

I dont understand your question here because there is no high pass filter now.

But are you saying that you still want to add one anyway, and if so, is that as shown in the attachment?
SystemResponse_20170727-2.gif
 

MrAl

Joined Jun 17, 2014
13,702
Hi,

What do you mean you want to break the transfer function up?
You mean into separate blocks?

If you do not break it up, is that diagram in post #9 correct or incorrect?
 

Thread Starter

Abdul Wali

Joined Mar 19, 2016
35
Hi,

What do you mean you want to break the transfer function up?
You mean into separate blocks?

If you do not break it up, is that diagram in post #9 correct or incorrect?
By breaking the transfer function into components mean like the picture (modified version controller blocks) in the link below.
https://drive.google.com/open?id=0B9NQhKDld_D4T0xwZTdZY1V6NHM
when i dont break up the transfer function into components then the transfer functions will look the same as in the above diagram but then i will also not need the filter, as i have explained in my post 6 that why i need to filter and how and where i need to add. @MrAl
 

MrAl

Joined Jun 17, 2014
13,702
Hi,

You dont seem to be making sense.
You are saying that if you dont break up the function the output will look the same as the diagram with the function broken up. That does not make sense at all because it's a contradiction.

Besides, why would breaking the function up into components change the output? If that happens then something else is wrong or maybe you dont have the right diagram. Note also the diagram you linked to is not correct in total (see attachment).

Who did the function breakup?

I redrew the block diagram in your link. Verify that it is correct or not. Also verify that it is the derivative block that you want to change.

This stuff is easy it should not take this long. Try to be as detailed and accurate as possible, and you may have to go over some of the stuff handed to you first.

Also note in the attachment the point "B". It looks like your quoted controller transfer function but that's not the actual total output.
 

Attachments

Thread Starter

Abdul Wali

Joined Mar 19, 2016
35
Hi,

You dont seem to be making sense.
You are saying that if you dont break up the function the output will look the same as the diagram with the function broken up. That does not make sense at all because it's a contradiction.

Besides, why would breaking the function up into components change the output? If that happens then something else is wrong or maybe you dont have the right diagram. Note also the diagram you linked to is not correct in total (see attachment).

Who did the function breakup?

I redrew the block diagram in your link. Verify that it is correct or not. Also verify that it is the derivative block that you want to change.

This stuff is easy it should not take this long. Try to be as detailed and accurate as possible, and you may have to go over some of the stuff handed to you first.

Also note in the attachment the point "B". It looks like your quoted controller transfer function but that's not the actual total output.
@MrAl Thank you very much for still being with me, i appreciate your help. the picture u sent in the above post, the transfer function and your analysis are very correct and I understood the same way, and I feel that now you reach to the point where u will understand the exact problem.

Your Question: why would the output be different when we break the transfer function from the Not-Broken-Transfer-function?

Answer: because when we don't break the transfer function so we will directly put it in a block BUT when we break the transfer function we have to use the derivative block and here we are already using it before the point B in the picture that you sent in post #13 and this derivative block has some limitations that affect the output signal, the limitations and the reason is as below:

"The Derivative block output might be very sensitive to the dynamics of the entire model. The accuracy of the output signal depends on the size of the time steps taken in the simulation. Smaller steps allow a smoother and more accurate output curve from this block. However, unlike with blocks that have continuous states, the solver does not take smaller steps when the input to this block changes rapidly. Depending on the dynamics of the driving signal and model, the output signal of this block might contain unexpected fluctuations. These fluctuations are primarily due to the driving signal output and solver step size.
The exact linearization of the Derivative block is difficult because the dynamic equation for the block is y=˙u, which you cannot represent as a state-space system.
The Laplace domain transfer function for the operation of differentiation is:

Y(s)/X(s)=s

This equation is not a proper transfer function, nor does it have a state-space representation.
However, you can approximate the linearization by adding a pole to the Derivative to create a transfer function s/(c∗s+1). The addition of a pole filters the signal before differentiating it, which removes the effect of noise.
A best practice is to change the value of c to1/fb, where fb is the break frequency for the filter
" [ https://www.mathworks.com/help/simulink/slref/derivative.html#br3m9zv-1 ].

The reference above is from official Matlab Website which is 100% verified by Matlab, so we can totally relay on it.

 
Last edited:

MrAl

Joined Jun 17, 2014
13,702
Hello again,

You're welcome. You are still not making as much sense as i would have hoped with this break or not break the transfer function, so we should put that aside and i'll just ask you a couple more questions.

1. Are you taking the output of the controller from point B in my previous diagram or from Vout?
2. Do you want to replace the derivative block in that diagram with the filter, and once done, will you take the output from B or from the very output Vout?

So that's three questions in total which requires three answers :)
We should be able to make progress after this.
 

Thread Starter

Abdul Wali

Joined Mar 19, 2016
35
Hello again,

You're welcome. You are still not making as much sense as i would have hoped with this break or not break the transfer function, so we should put that aside and i'll just ask you a couple more questions.

1. Are you taking the output of the controller from point B in my previous diagram or from Vout?
2. Do you want to replace the derivative block in that diagram with the filter, and once done, will you take the output from B or from the very output Vout?

So that's three questions in total which requires three answers :)
We should be able to make progress after this.
Answer 1: what you dont understand about breaking? do you mean that why i am breaking the transfer function? it is because i am trying to make he system more dynamic and let the K and T change with respect to Load automatically.

Answer 2: i am taking the output from Vout

Answer 3: the output is always taken from Vout (in all conditions).

@MrAl
 

MrAl

Joined Jun 17, 2014
13,702
Answer 1: what you dont understand about breaking? do you mean that why i am breaking the transfer function? it is because i am trying to make he system more dynamic and let the K and T change with respect to Load automatically.

Answer 2: i am taking the output from Vout

Answer 3: the output is always taken from Vout (in all conditions).

@MrAl
Hello again,

Ok so answer 3 is you take the output from Vout always, but your previous posts had shown a different transfer function for the controller, that's why i asked you to confirm the block diagram i had attached which was the same as the one you linked too, but i even had to correct that.
So i have to ask again, are you taking the output from Vout or are you using the controller transfer function that you first presented here which is the same as B in the diagram i presented?

We have to get these details down perfect or we cant move forward.
Also, it is of no use for you to keep talking about 'breaking' the transfer function BECAUSE you are not showing exactly HOW and WHERE you are 'breaking' it. My suggestion is that you redraw the block diagram to show what exactly you want to do and/or change. That will help a lot here.

You also have to answer the questions i ask you. One of them was do you intend to replace the derivative block with the high pass filter.

These questions are very important because they help lead to a solution. I cant provide a solution unless you show exactly what it is you want, and that is best done with a diagram rather than a dialog.

Not sure if you ever heard the old adage for engineers, "Do a diagram, figure it out" :)
 

Thread Starter

Abdul Wali

Joined Mar 19, 2016
35
Hello again,

Ok so answer 3 is you take the output from Vout always, but your previous posts had shown a different transfer function for the controller, that's why i asked you to confirm the block diagram i had attached which was the same as the one you linked too, but i even had to correct that.
So i have to ask again, are you taking the output from Vout or are you using the controller transfer function that you first presented here which is the same as B in the diagram i presented?

We have to get these details down perfect or we cant move forward.
Also, it is of no use for you to keep talking about 'breaking' the transfer function BECAUSE you are not showing exactly HOW and WHERE you are 'breaking' it. My suggestion is that you redraw the block diagram to show what exactly you want to do and/or change. That will help a lot here.

You also have to answer the questions i ask you. One of them was do you intend to replace the derivative block with the high pass filter.

These questions are very important because they help lead to a solution. I cant provide a solution unless you show exactly what it is you want, and that is best done with a diagram rather than a dialog.

Not sure if you ever heard the old adage for engineers, "Do a diagram, figure it out" :)
Dear Sir, i told you that the output is always taken from Vout. the project is very huge, it is just a small part it, so its will hard for me to explain everything here, i think i already gave the information that you need else you be specific that what you want me to share with you? @MrAl
 

MrAl

Joined Jun 17, 2014
13,702
Dear Sir, i told you that the output is always taken from Vout. the project is very huge, it is just a small part it, so its will hard for me to explain everything here, i think i already gave the information that you need else you be specific that what you want me to share with you? @MrAl

Hi,

Well what puzzled me is that you gave one transfer function in your first and following posts, and then now you say you are using Vout which gives a different transfer function.

I ask very very simple and straightforward questions and you dont answer them directly. I have to ask questions because there is so much ambiguity in this project, sorry to say. Even the block diagram had "divde 1" above a block that was actually a multiplier.

If the problem is specified properly it takes about 10 minutes to solve. Since there is some kind of communication problem here all i can say is you will have to proceed wth the following general procedure.

Break up the function any way you wish, then insert the function for your high pass filter in the derivative block as i believe that is what you want to do at this point. Calculate your new transfer function F(s) or whatever you want to call it. Plot F(x) in the frequency domain or take an inverse Laplace Transform to get F(t).
There is only ONE single variable here, either 'c' or 'fc' as you noted earlier. That means you only have one parameter to vary in order to find your solution. As you vary the parameter, you'll see either the frequency domain solution start to look like your desired result, or in the time domain you'll see the settling time start to change and then all you have to do is change 'c' or 'fc' until you get the desired settling time. I had given one way to calculate the settling time previously but you can get an approximate result by simply plotting the output in the time domain. It doesnt get any simpler than that :)

If you have trouble calculating anything then you will have to provide me with a BLOCK DIAGRAM of the system the way you intend to use it in it's final form. This will NOT be the block diagram you had already linked to, but will be a block diagram that you either draw yourself or modify the linked to blcok diagram. It must be in it's final form as i dont want to have to interpret what you think you want anymore.

This isnt that hard as you are making it. You only have ONE parameter to think about, and by varying that parameter you can find the solution in several ways. Just sit back and relax and think about it in simple terms.

So either "Do a diagram, figure it out", or draw up a new diagram and i'll calculate it for you.
Those are the only two options at this point, take it or leave it :)
 
Top