Mathematical engine modeling (FHM) on Matlab

In summary: The function dydx returns the pressure at a given crank angle in kPa. The function vol1 returns the volume at a given crank angle in m3. The function hrf returns the heat release rate at a given crank angle in kW. The function dvolume returns the volume of heat released at a given crank angle in m3.
  • #1
Altairs
127
0
I am trying to replicate a JAVA based applet on MATLAB. Applet can be seen http://www.engr.colostate.edu/~allan/thermo/page6/EngineParm1/engine.html" .

The theory behind the functions of the applet is http://www.engr.colostate.edu/~allan/thermo/page6/page6.html" .

It is actually a finite heat release model to give pressure, volume and work curves with respect to crank angle from -180 to 180.

It is quite simple actually. Simple integration using Runge-Kutta Order 4 method and this ODE is also of the first order. I am going to post the code below.

Problem is that the shape of the curve is alright but the amplitude (pressure) is totally unrealistic...it shoots to X10^76 or something where as originally in the applet its just 8800 KPa.

Can someone please check what I am doing wrong ? I have spent about a week and still no luck and something tells me that whatever it is it is very small (thats why I can see it :D).

Call the function by writing following on main

Initial conditions used are the same as used in the applet. (theta(x) from -180 to 180 and initial pressure is 1 bar)

Code:
[x,P] = ode45 ('final', [-180 180], 1)
and then
Code:
plot(x,P)

Note the amplitude

final.m
Code:
function dydx = final(x,P)
dydx = -1.4*(P/v1(x))*dvol(x)+((1.4-1)/v1(x))*HRF(x);

v1.m
Code:
function vol1=v1(x)
R=3;
Vd=(pi/4)*(0.1^2)*(0.1);
vol1=(Vd/9)+(Vd/2)*(R+1-cosd(x)-(R^2-sind(x)^2)^(1/2));

dvol.m
Code:
function dvolume = dvol(x)
R=3;
Vd=(pi/4)*(0.1^2)*(0.1);
dvolume=(Vd/2)*sind(x)*[1+cosd(x)*(R^2-sind(x)^2)^(-1/2)];

HRF.m
Code:
function hrf = HRF(x)
n=3;
a=5;
thetaD=40;
thetaS=0;
Qin=1800;
xb=0.99;
if(x<thetaS || x>(thetaS+thetaD)) 
    hrf=0;
else
    hrf = (n*a*(Qin/thetaD)*(1-xb)*((x-thetaS)/thetaD)^(n-1));
end;

Please check. I am so stuck at this :(
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Hi,

I get the same problem...

Did you get the solution of this problem ?
 
  • #3
I do not remember axactly, as this is quite an old post, but I think the problem had something to do with angle conversion from degree to radian or vice versa...that is why the amplitude was not coming out correct...but once correct, the results were beautiful :D
Try playing around with angle..if you are using deg convert to radians...if you are using radians try degree...
 
  • #4
Thanks !

Do you still have your code in order to compare with mine ?
 
  • #5
Must work with radians and then convert at the end back to degrees for the plot of pressure vs crank angle. Also, the burn fraction (xb) is not a constant but rather a function of crank angle as well. See the website below for the calculation.
http://www.engr.colostate.edu/~allan/thermo/page6/page6.html

In order for units to match, keep in mind that 1 bar is 10x5 Pa or 100 kPa.
 

1. What is Mathematical Engine Modeling (FHM)?

Mathematical Engine Modeling, also known as FHM (Flexible Hybrid Model), is a mathematical tool used for simulating and analyzing systems that can be described by mathematical equations. It is commonly used in engineering and scientific fields to understand and predict the behavior of complex systems.

2. What is the role of Matlab in Mathematical Engine Modeling?

Matlab is a software platform that is commonly used for designing and implementing mathematical models. It provides a user-friendly interface for creating, testing, and analyzing FHM models, making it a valuable tool for researchers and engineers.

3. How does FHM differ from other modeling techniques?

FHM is a hybrid modeling technique that combines both analytical and numerical methods to create a more accurate representation of a system. It also allows for the integration of different types of models, such as continuous and discrete, to capture a wider range of behaviors and interactions.

4. Can FHM models be used for real-world applications?

Yes, FHM models can be used for real-world applications in various fields such as aerospace, automotive, and environmental engineering. These models can help in predicting system performance, optimizing designs, and identifying potential issues before implementation.

5. Are there any limitations of using FHM on Matlab?

Like any modeling tool, there are some limitations to using FHM on Matlab. These include the need for a good understanding of the underlying mathematics and assumptions made in the model, as well as the availability of accurate data for model validation. Additionally, complex systems may require significant computational resources and time to run the simulations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Thermodynamics
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
993
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
Back
Top