Calculating Work done by a Closed Cylinder in Simulink and Simscape

14 visualizaciones (últimos 30 días)
H All,
I am attempting to calculate the heat work done by a cylinder in an internal combustion engine over a single cycle (V1->V2->V1), using simulink blocks in my Simscape model.
Using the following
I have been able to calculate (with code) the Work Done for the compression stroke (V1 to V2) and combustion stroke (V2 to V1) individually then sum them to get the total work done for the cycle, is this assumption correct, as I am struggling to find an answer in the literature
Work Done during Compression (V1 to V2)
%Define the v1 and v2 pressure and volume array
P_comp = [1.4, 45.82]; % pressure v1 pressure at v2 [bar]
V_comp = [797.44, 64.75]; % volume at v1 and v2 [cc]
%Use numerical integration to calculate the work done
W_comp = trapz(V_comp, P_comp)
Work Done by Combustion (V2 to V1)
%Define the v2 and v1 pressure and volume array
P_comb = [45.82, 5.45]; % pressure v2 pressure at v1 [bar]
V_comb = [64.75, 775.07]; % volume at v2 and v1 [cc]
%Use numerical integration to calculate the work done
W_comb = trapz(V_comb, P_comb)
%Total Work done during a single cycle with both strokes (V1->V2->V1)
W = W_comp+W_comb
I have attemped to implement integrating the pressure and volume in my Simulink model (function block) where I have both pressure and volume as signals but it get an error. I can implement by using the arrays for P and V as above. Any suggestions of how to implement work done using the signals and simulink rather than code?
function W = calc_work(P_comp, V_comp)
% Use numerical integration to calculate the work done
W = trapz(V_comp, P_comp);
end
Thanks in advance,
Patrick

Respuesta aceptada

Yifeng Tang
Yifeng Tang el 22 de Mzo. de 2023
You mentioned that you are using Simscape for the simulation of the cylinder. If that is indeed the case, I believe it would be easier to compute and integrate for the work more directly from information available in Simscape.
  1. measure the in-cylinder pressure using a pressure sensor, so you get a physical signal for p(t).
  2. measure the piston speed using a translational sensor, so you get v(t).
  3. given cylinder area A, you can calculate p*v*A using PS product and you should have p*v*A = p*(dV/dt), where V is the cylinder volume.
  4. integrate the term you get from (3), using a PS integrator (so you don't worry about unit conversion), should get you the work term.
Alternatively, you can also measure the force at the R port of the cylinder, and multiply by the velocity and integrate. The mechanical power obtained this way should match the fluid power; you may see some difference if you have some piston mass or friction set up.
Hope this makes sense.
  1 comentario
PB75
PB75 el 27 de Mzo. de 2023
Hi Yifeng,
Many thanks for responding, I have implemented the work done calc W=p*v*A and also W = f*v and then integrate using the Simulink blocks and the values seems reasonable and compare well to each other.
Thanks again,
Patrick

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Gas Models en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by