ask intergral and derivate

One of the voltage equations in the LCL grid-connected inverter is as follows. This is an equation transformed into the synchronous reference frame.
To summarize this,
I can organize it in these two ways. One is the voltage equation that was first defined, which includes the differential term. The second is the iq2 current, which is integrated on both sides.
I made each equation into a simulated link equation. However, the result is different. Equations with differentials represent the correct values, but equations with integrals represent completely different values.
Please let me know what I need to do to express this
- integral equation block
- Derivative equation
Result :

10 commentaires

Sam Chak
Sam Chak le 18 Fév 2025
The differential equation appears relatively straightforward. If you can provide the constants in the equation and the initial value of the current, we can assist in simulating it in MATLAB using ode45 and subsequently compare the results with those obtained from Simulink.
승표
승표 le 18 Fév 2025
Is it correct that the two results are different?
Initial current is 0.
I also attached my model.(2022a version)
L_con = 0.005;
R_con = 0.001; %10e-3
L2=L_grid = 105.56e-6; %36.9e-6;
R2=R_grid = 10e-3;
R_LCL = 1; %1
C_LCL = 50e-6;
Actually, my design is LCL filter grid inverter. So i want to make observer to estimate grid voltage at discrete. But the equatation have problem now.
승표
승표 le 18 Fév 2025
Vgird.q, is 220 * sqrt(2/3) = 179
Vcap.q also almost same value with Vgrid.q
grid frequency is 60 Hz, so omega is 377.
Thank you for your response. However, I am unable to simulate it in MATLAB due to the missing values of ​ and ​. Could you please provide the constants? Additionally, I believe that the d-axis current ​ should be a time-varying signal and is described by a different ODE, that is coupled with the q-axis current .
function diq = ode(t, iq)
% Parameters
L_con = 0.005; % unused
R_con = 0.001; % unused
L2 = 105.56e-6;
R2 = 10e-3;
R_LCL = 1; %1 % unused
C_LCL = 50e-6; % unused
omega = 377;
Vgrid = 220*sqrt(2/3);
Vcap = Vgrid;
% id = ; % unavailable (probaby a state variable)
% Eq = ; % unavailable
% ODE
diq = (Vcap - R2*iq - omega*L2*id - Eq)/L2;
end
승표
승표 le 19 Fév 2025
function diq = ode(t, iq)
% Parameters
L_con = 0.005; % unused
R_con = 0.001; % unused
L2 = 105.56e-6;
R2 = 10e-3;
R_LCL = 1; %1 % unused
C_LCL = 50e-6; % unused
omega = 377;
Vgrid = 220*sqrt(2/3);
Vcap = Sensing value;
% id = Sensing value ;
% iq = Sensing value; % unavailable (probaby a state variable)
% Eq = Sensing value; % unavailable
It is Eq value
It is Id, Iq (Yellow Iq, Green Id)
It is Vcap_q
Sam Chak
Sam Chak le 19 Fév 2025
Initially, I considered simulating the given 1st-order differential equation in MATLAB without using Simulink and subsequently comparing the results with the plots you obtained from Simulink. Today, I reviewed your Simulink model, and I found that your problem is much more complicated than I had anticipated. Unfortunately, I do not have Simscape Electrical, so some of the blocks will not function properly. Without a complete mathematical model of the LCL grid-connected inverter, I cannot use ode45 to solve the model.
You should always verify that the response from the Simscape model matches the response obtained from simulating the mathematical model using MATLAB's ode45 function.
Perhaps you could consult with @Yifeng Tang, who is an expert in Simscape.
승표
승표 le 19 Fév 2025
I made a simplified model for you. In the actual model I use, Id, Iq, Eq, Vcap.q remain constant, but there are some oscillations.
To simulate this, a sine wave was added to make it similar, and the results are similar.
In this case, the model using the integrator and the model using the differentiator have completely different values.
Please review it with that model and let me know what I made a mistake.
Sam Chak
Sam Chak le 19 Fév 2025
The differential equation (also known as the state equation, where is the state variable):
,
can be rearranged to transform it into an integral equation form:
The Leibniz integral notation ∫ indicates that you should use the continuous-time Integrator block.
The input port is where you should input the 'integrand' mathematical expression, while the output port returns the q-axis current signal . Note that the 'integrand' includes the state variable , which implies that the output should be fed back into the 'integrand' through a feedback loop. However, I do not see any feedback loop in your Simulink model.
Before running the simulation, remember clicking on the Integrator block to enter the initial value of the state variable at time , denoted as .
Yifeng Tang
Yifeng Tang le 19 Fév 2025
Modifié(e) : Yifeng Tang le 19 Fév 2025
I'm afraid this is beyond my domain knowledge. I'm a mechanical engineer, and know very little about three-phase AC :p
The "example" model has a missing parameter omega, but it looks like whatever value I put there I'm getting a decreasing signal with some oscillation, while the other scope shows just oscillation.
This makes me wonder whether you have a constant somewhere in your integrand that needs to be zero-ed out first.
Sorry, just my random thoughts. I have no intuition which one is correct :(
승표
승표 le 19 Fév 2025
@Sam ChakI understand to some extent what you say, but it's not perfect yet.
If you give feedback on the model above, I would like to ask where to do it.

Connectez-vous pour commenter.

Réponses (1)

Sam Chak
Sam Chak le 20 Fév 2025

0 votes

I used the ordinary differential equations (ODEs) from this PMSM example because they are similar to your case. Specifying the ODEs using the Fcn block with appropriate labels is much easier to troubleshoot than adding multiple fundamental blocks, which may obscure your ability to trace signal flows in Simulink.
In the block diagram, there is a clear feedback loop that sends the outputs and , along with the other defined parameters, back to the ODEs in the Fcn blocks. In this example, the number of pole pairs (P) is assumed to be 1 for simplicity, and I directly specified it in the Fcn blocks without labeling it. The constants are somewhat unrealistic in this example, but you can modify them to suit your LCL grid-connected inverter.
I would also like to thank @Yifeng Tang for his response. I rarely use Simulink nowadays, so any tips or advice to help the OP improve modeling skills in Simulink/Simscape would be appreciated.
response:
response:

1 commentaire

승표
승표 le 20 Fév 2025
Thank you very much for your help.If you have any more questions, I'll leave it again.

Connectez-vous pour commenter.

Produits

Version

R2022b

Question posée :

le 18 Fév 2025

Commenté :

le 20 Fév 2025

Community Treasure Hunt

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

Start Hunting!

Translated by