Calculating Work done by a Closed Cylinder in Simulink and Simscape
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Elements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!