Model of two differential equations of RLC circuit (Simulink)

23 views (last 30 days)
Hello,
I have made an RLC circuit and I want to simulate this system. I know, that I can model the exact same circuit, but I want to get graphs from my two differential equations. I am kinda struggling with the model of those equations. I have already read a lot of articles, but i still can not figure out, how to apply the knowledge from those articles and from my self-studying.
I have those differential equations:
where U is voltage (I will probably use sinwave block); i1, i2, i3 are 3 currents.
Could somebody, please, give me a hint or any simillar example of Simulink model?
  4 Comments
Sam Chak
Sam Chak on 27 Jun 2022
Hi @Techie,
I'm not used to seeing dynamical equations in integral form. Can you put them in differential equations?
You have 3 states, so generally there should be 3 differential equations. However, the can be substituted and recovered from this info:
,
thus, making only two state equations are sufficient to solve the problem.
Generally, it is faster and efficient to type out the equations in MATLAB. But for newbies, it is more effective to learn what happen to the system and signals (because you virtually attach a Scope at each signal) using the graphical approach in Simulink.
Since this is a Linear RLC System, you can do a fast simulation using the State-Space Block in Simulink. Else, you have to use the Integrator blocks to obtain and .
Can you put up the basic blocks first?
Tech
Tech on 27 Jun 2022
Hello,
thank you for your comment! I am not sure if I understand you right, but am I allowed to derivate both of those first equations and then substitute i3(t) = i1(t) - i2(t)? I was wondering how to create a Simulink model with integral form in equations. I can put both of them together and i will get one differential equation with derivated U and 2 different functions (i1(t), i2(t)) and i do not know, how to model it.
If you have time, could you please try to give me a hint or something like that, how to model those differential equations?
Thank you very much for your answer.

Sign in to comment.

Accepted Answer

Sam Chak
Sam Chak on 27 Jun 2022
Hi @Techie,
I have requested that the differential equations to be provided, but you seemed to overlook the message. So, I'm unsure if the following model is correct or not. Modify the model as you wish.
Subs Equation 3 into Equation 1
Subs Equation 3 into Equation 2
Rewrite them in state-space form
Re = 1;
Li = 1;
Ca = 1;
A = [0 0 1 0; 0 0 0 1; -2/(Li*Ca) 1/(Li*Ca) -Re/Li 0; 1/(Li*Ca) -1/(Li*Ca) 0 -Re/Li];
B = [0; 0; 1/Li; 0];
C = [1 0 0 0; 0 1 0 0; 1 -1 0 0];
D = [0; 0; 0];
sys = ss(A, B, C, D)
sys = A = x1 x2 x3 x4 x1 0 0 1 0 x2 0 0 0 1 x3 -2 1 -1 0 x4 1 -1 0 -1 B = u1 x1 0 x2 0 x3 1 x4 0 C = x1 x2 x3 x4 y1 1 0 0 0 y2 0 1 0 0 y3 1 -1 0 0 D = u1 y1 0 y2 0 y3 0 Continuous-time state-space model.
Assuming that the voltage input is a sine wave , then .
t = 0:0.01:20;
dU = cos((2*pi/5)*t);
x0 = [1 -0.5 0 0]; % initial values: i1(0) = 1, i2(0) = -0.5
lsim(sys, dU, t, x0)
grid on
If you implement this system in Simulink using the State-space block, then you should obtain similar results.
  1 Comment
Tech
Tech on 28 Jun 2022
Thank you @Sam Chak!
Although this is not the solution that i was looking for, it is really interesting and so much helpful. Thank you very much.
To be completely honest I was thinking about solution like this one:
This is just one of my attempts to model those equations, but there are many mistakes and it is not even completed.
I want to use this kind of Simulink model, so I would be able to get for example graph of voltage on capacitor and stuffs like that.
But anyway thank you very much for your comment and your solution!
I hope that you now understand what I want to do.

Sign in to comment.

More Answers (1)

Torsten
Torsten on 27 Jun 2022
Edited: Torsten on 27 Jun 2022
Solve the system of differential equations
dI1/dt = i1, I1(0) = 0
dI3/dt = i3, I3(0) = 0
L*di1/dt = U - R*i1 - 1/c * I1 - 1/c * I3, i1(0) = ?
L*di2/dt = -R*i2 + 1/c * I3, i2(0) = ?
L*di3/dt = (U - R*i1 - 1/c * I1 - 1/c * I3) - (-R*i2 + 1/c * I3), i3(0) = i1(0)-i2(0)
It is equivalent to yours.
  1 Comment
Tech
Tech on 28 Jun 2022
Hello @Torsten
I would like to model those equations in Simulink instead of solving them mathematicaly.
I want a model like this one:
Thank you anyway.

Sign in to comment.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!