How to create initial and final values on simulink?
46 次查看(过去 30 天)
显示 更早的评论
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
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
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
0 个评论
更多回答(1 个)
Alejandro Morales
2016-4-19
1 个评论
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 Center 和 File Exchange 中查找有关 General Applications 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!