Calculating Work done by a Closed Cylinder in Simulink and Simscape

조회 수: 12 (최근 30일)
PB75
PB75 2023년 3월 17일
댓글: PB75 2023년 3월 27일
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

채택된 답변

Yifeng Tang
Yifeng Tang 2023년 3월 22일
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
PB75
PB75 2023년 3월 27일
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

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Gas Models에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by