How to create initial and final values on simulink?

조회 수: 34 (최근 30일)
Alejandro Morales
Alejandro Morales 2016년 4월 13일
댓글: Stefan Raab 2016년 4월 19일
Hello I am currently working on a problem in which I have 5 identical tanks in series. I have found the transfer function of each tank to be of the form 1/(s+1). I am trying to model the system in simulink when the inlet flow concentration of A changes from 0.6 at t=0 to 0.45 when t>0.
The way I am setting it up is to use the step block and set the initial and final value to the ones above and making the step time 0. Then I connect this to 5 transfer functions in series and connect the output to a scope. However, no matter what I try the system always starts at 0 at t =0 and not 0.6 but it always goes to 0.45 after some time. I am new to simulink and don't know what is the correct way to tell the system to start at 0.6 and then go to 0.45.
Do I have to use another type of source block? I have tried everything with the step block and nothing sims to work.
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 13일
편집: Azzi Abdelmalek 2016년 4월 13일
Alejandro, try to make your question clear. What initial value? and what final value? what those have to do with a step block? Try just to focus on your real problem. For example telling us that you are connecting the output to the scope has nothing to do with your problem!

댓글을 달려면 로그인하십시오.

채택된 답변

Stefan Raab
Stefan Raab 2016년 4월 18일
Hello,
I suppose you mean the inital values for the transfer function states? This question might be related to your problem: http://de.mathworks.com/matlabcentral/answers/38446-how-to-give-initial-condition-to-transfer-function
NOTE: You will need the " Control System Toolbox" in order to do the following steps.
I would use MATLAB to create your transfer functions with the command
myTF1 = tf(num1,den1);
myTF2 = tf(num2,den2);
...
For more information on the "tf" function, execute the following command in the MATLAB Command Window (this will open the help browser):
web(fullfile(docroot, 'control/ref/tf.html'))
Either you create the combined transfer function for your system directly, or you create the individual transfer functions and then use the "connect" function. More information on "connect":
web(fullfile(docroot, 'control/ref/connect.html'))
As soon as you have the combined transfer function, you can use MATLAB to create a state space model from that:
myStateSpace = ss(myTF);
Use the state space matrices to fill the "Simulink/Continuous/State-Space" block. In the properties of this block you can also specify initial conditions.
I hope this might help you.
Kind regards, Stefan

추가 답변 (1개)

Alejandro Morales
Alejandro Morales 2016년 4월 19일
Thank you for your help. However I ended up finding a work around where my initial values were 0.6 and at t=0 it went to 0.45. I just put in the step block 0 as my initial value and -0.15 as my final, this is the difference. Then I put a "to workspace" block to send the data to Matlab and there I just added 0.6 to my simulink result array and plotted.
Also thank for the link, I which I had found it myself. I didn't see anywhere that the step function starts at 0, but I kind of figure it out after a while. I hope this helps somebody in the future.
  댓글 수: 1
Stefan Raab
Stefan Raab 2016년 4월 19일
Unfortunately I can't endorse your workaround. Acutally you are adding a constant disturbance to your output signal. This might have the same result as long as you are steady-state accurate, but as soon as you have an input that is not "perfectly suited" to this constant or the plant is more complex, the results are wrong. To underline my words, I made a simple model where the Transfer Function block and the State Space block represent the exact same system, but put the two different step inputs:
As you can see in the plot, the output signals are far from equivalent.
I don't know where your work is leading, but if you don't do this correctly, it may cause many errors in the end and nobody wants that. :)
By the way, you could also build the transfer functions with integrator blocks and feedbacks. The next picture shows the modeling of a PT1 block. In the Integrator block you can then also specify initial conditions:
Kind regards, Stefan

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by