Make your own free website on Tripod.com

The Expansion Chamber Design Software

Download the software here

Description:

The expansion chamber design software is used to design the tuned pipe for the exhaust system of the micro car engine. One can choose to design a single stage, two-stage or a three-stage diffuser chamber according to their requirements. This section details the various parameters and design formulae, which have been implemented in the software design project.

Sections of a Tuned Pipe:

Header - Attaches to the engine and is the straight or slightly divergent (opens up 2-3 degrees) section of the pipe. It helps to suck the exhaust gases out of the engine. The header pipe cross-sectional area should be 10-15% greater than the exhaust port window for when maximum output at maximum RPM's is desired. In some cases the area of the header pipe may have a cross-sectional area 150% of the exhaust port area. The length should be 6-8 of its diameters for maximum horsepower, for a broader power curve 11 times pipe diameter may be used. The part you trim off to tune.

Divergent (Diffuser) Cone - The section of the pipe that attaches to the header and opens up at an angle like a megaphone. It intensifies and lengthens the returning sound waves thus broadening the power curve. The steeper the angle the more intense the negative wave returns, but also the shorter the duration. The lesser the angle, of course, returns a less intense wave, but for a longer period of time (duration). The outlet area should be 6.25 times the inlet area. 7-10 degree taper angle.

Belly - Located between the divergent and convergent cones, it's length determines the relative timing of the negative and positive waves. The shorter the belly the shorter the distance positive waves travel and the narrower the RPM range. This is good for operating at HIGH RPM only. The longer the belly the broader the RPM range. The diameter of the belly has little or no effect.

Convergent (Baffle) Cone - Located after the belly and before the stinger, reflects the positive waves back to the open exhaust port and forces the fresh fuel mixture back into the combustion chamber as the exhaust port closes. The steeper the angle the more intense the positive wave and the gentler the angle the less intense. 14-20 degree taper angle. The taper angle primarily influences the shape of the power curve past the point at which maximum power is obtained.

Stinger - Located at the opposite end of the pipe from the header and after the convergent cone, it is the "pressure relief valve" of the pipe where the exhaust gasses eventually leave the pipe. The back pressure in the pipe is caused by the size (diameter) or length of the stinger. A smaller stinger causes more back pressure and thus a denser medium for the sound waves to travel in. Sound waves love denser mediums and thus travel better. A draw back to a small stinger is heat build up in the pipe and engine. The stinger diameter should be 0.58--0.62 times that of the header pipe and a length equal to 12 of it's own diameters.

When the engine fires it detonates the fuel mixture in the combustion chamber, pushes the piston down, opens the exhaust port and allows the burnt gases to escape along with the sound wave produced when the engine fired. The negative sound waves pull the exhaust gasses out of the exhaust port. The positive sound waves, reflected back from the convergent (baffle) cone, force the fresh fuel mixture back into the combustion chamber through the exhaust port thus super-charging your engine.

Common Engine Parameters to be calculated:

BMEP =

Average Exhaust Temperature based on BMEP

BMEP, bar Avg. Exhaust Temp
11 + 650
8 500
9-10 600
5 350

Speed of Sound A0 =

Where g is specific heat ratio of air i.e. 1.4

R is the Gas Constant of air i.e. 287

Texc is exhaust gas temperature

The values for k1 and k 2 are ranges depending on the type of engine. k1 ranges from 1.05 to 1.125 while k 2 ranges from 2.125 to 3.25.

Finally the tuned length

Lt =

Where q ep is exhaust port open duration in degrees

Single Stage Diffuser Expansion Chamber Design:

Design Formulae:

Lt =

Where Lt is tuned length

Eo is exhaust-open period

Vs is sonic wave speed

N is crankshaft speed

L1 =

L2 =

L3 = D1 x (6 to11)

L4 =

L5 = L1 - (L3 + L4)

L6 =

L7 = D3 x 12

D1 is 10 to 15% greater than exhaust port window

D2 =

D3 = D1 x (0.58 to 0.62)

A1 = (half the diffuser's angle of divergence)

A2 = (half the baffle-cone's angle of divergence)

Two Stage Diffuser Expansion Chamber Design:

 

D1 = K1.EXD

D3 = K2.EXD

D4 = K0.EXD

LP01 = 0.10LT

LP12 = 0.41LT

LP23 = 0.14LT

LP34 = 0.11LT

LP45 = 0.24LT

LP56 = LP45

Three Stage Diffuser Expansion Chamber Design:

D4 = K2.EXD

D5 = K0.EXD

D1 = K1.EXD

D2 =

D3 =

 

 

 

 

 

 

 

Notice also that an extra coefficient has been introduced. This coefficient Kh is called the horn coefficient, with typical values between one and two. Small values of Kh are best suited to Grand Prix engines with narrow power bands, larger values are for wider more flexible engines.

LP01 = 0.10LT

LP12 = 0.275LT

LP23 = 0.183LT

LP34 = 0.092LT

LP45 = 0.11LT

LP56 = 0.24LT

LP67 = LP56

Coding:

The software is coded in Microsoft® Visual C++ 6.0 using the Microsoft Foundation Class (MFC) AppWizard. This software is intended for use on the Windows® 98 operating system. The important MFC code snippet of the calculating and displaying functions are shown below:

// TunedPipeView.cpp : implementation of the CTunedPipeView class

//

#include "stdafx.h"

#include "TunedPipe.h"

#include "math.h"

#include "TunedPipeDoc.h"

#include "TunedPipeView.h"

#ifdef _DEBUG

#define new DEBUG_NEW

#undef THIS_FILE

static char THIS_FILE[] = __FILE__;

#endif

/////////////////////////////////////////////////////////////////////////////

// CTunedPipeView

IMPLEMENT_DYNCREATE(CTunedPipeView, CFormView)

BEGIN_MESSAGE_MAP(CTunedPipeView, CFormView)

//{{AFX_MSG_MAP(CTunedPipeView)

ON_BN_CLICKED(IDC_CALCULATE, OnCalculate)

ON_BN_CLICKED(IDC_RESET, OnReset)

ON_BN_CLICKED(IDC_ONE_STAGE, OnOneStage)

ON_BN_CLICKED(IDC_TWO_STAGE, OnTwoStage)

ON_BN_CLICKED(IDC_THREE_STAGE, OnThreeStage)

//}}AFX_MSG_MAP

// Standard printing commands

ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)

ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)

ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)

END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////

// CTunedPipeView construction/destruction

CTunedPipeView::CTunedPipeView()

: CFormView(CTunedPipeView::IDD)

{

//{{AFX_DATA_INIT(CTunedPipeView)

m_ExhaustWidth = 0;

m_ExhaustPeriod = 0;

m_ExhaustHeight = 0;

m_CrankSpeed = 0;

m_TransferPeriod = 0.0;

m_BMEP = 0.0;

A0 = 0.0;

Kh = 0.0;

K0 = 0.0;

K2 = 0.0;

K1 = 0.0;

m_Power = 0.0;

m_ExhaustTemp = 0.0;

m_Capacity = 0.0;

m_ChamberType = -1;

//}}AFX_DATA_INIT

// TODO: add construction code here

m_DataReady= FALSE;

m_ChamberType =ONE_STAGE;

}

CTunedPipeView::~CTunedPipeView()

{

}

void CTunedPipeView::DoDataExchange(CDataExchange* pDX)

{

CFormView::DoDataExchange(pDX);

//{{AFX_DATA_MAP(CTunedPipeView)

DDX_Text(pDX, IDC_EX_WIDTH, m_ExhaustWidth);

DDX_Text(pDX, IDC_EX_PER, m_ExhaustPeriod);

DDX_Text(pDX, IDC_EX_HEIGHT, m_ExhaustHeight);

DDX_Text(pDX, IDC_CR_SPEED, m_CrankSpeed);

DDX_Text(pDX, IDC_TR_OPEN, m_TransferPeriod);

DDX_Text(pDX, IDC_BMEP, m_BMEP);

DDX_Text(pDX, IDC_A0, A0);

DDX_Text(pDX, IDC_HORN_COEFF, Kh);

DDX_Text(pDX, IDC_K0, K0);

DDX_Text(pDX, IDC_K2, K2);

DDX_Text(pDX, IDC_K1, K1);

DDX_Text(pDX, IDC_POWER, m_Power);

DDX_Text(pDX, IDC_GAS_TEMP, m_ExhaustTemp);

DDX_Text(pDX, IDC_ENGINE_CC, m_Capacity);

DDX_Radio(pDX, IDC_ONE_STAGE, m_ChamberType);

//}}AFX_DATA_MAP

}

BOOL CTunedPipeView::PreCreateWindow(CREATESTRUCT& cs)

{

return CFormView::PreCreateWindow(cs);

}

void CTunedPipeView::OnInitialUpdate()

{

CFormView::OnInitialUpdate();

GetParentFrame()->RecalcLayout();

ResizeParentToFit();

GetDlgItem(IDC_SCREEN)->GetWindowRect(&m_ScreenRect);

ScreenToClient(&m_ScreenRect);

InflateRect(&m_ScreenRect, -5, -15);

GetDlgItem(IDC_TXTSCREEN)->GetWindowRect(&m_TextScreen);

ScreenToClient(&m_TextScreen);

InflateRect(&m_TextScreen, -5, -15);

m_OneStagePipeFig.LoadBitmap(IDB_ONE_STAGE_PIPE_FIG);

m_TwoStagePipeFig.LoadBitmap(IDB_TWO_STAGE_PIPE_FIG);

m_ThreeStagePipeFig.LoadBitmap(IDB_THREE_STAGE_PIPE_FIG);

}

/////////////////////////////////////////////////////////////////////////////

// CTunedPipeView printing

BOOL CTunedPipeView::OnPreparePrinting(CPrintInfo* pInfo)

{

return DoPreparePrinting(pInfo);

}

 

 

/////////////////////////////////////////////////////////////////////////////

// CTunedPipeView diagnostics

#ifdef _DEBUG

void CTunedPipeView::AssertValid() const

{

CFormView::AssertValid();

}

void CTunedPipeView::Dump(CDumpContext& dc) const

{

CFormView::Dump(dc);

}

CTunedPipeDoc* CTunedPipeView::GetDocument() // non-debug version is inline

{

ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTunedPipeDoc)));

return (CTunedPipeDoc*)m_pDocument;

}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////

// CTunedPipeView message handlers

void CTunedPipeView::DisplayBitmap(CDC *pDC, int X, int Y, CBitmap *pBitmap)

{

BITMAP BM;

CDC MemDC;

MemDC.CreateCompatibleDC(NULL);

MemDC.SelectObject(pBitmap);

pBitmap->GetObject(sizeof(BM),&BM);

pDC->BitBlt(X, Y,

BM.bmWidth,

BM.bmHeight,

&MemDC,

0,

0,

SRCCOPY);

}

void CTunedPipeView::DrawPipe()

{

CClientDC pDC(this);

OnPrepareDC(&pDC);

pDC.FillSolidRect(&m_ScreenRect,RGB(255,255,255));

switch(m_ChamberType)

{

case ONE_STAGE:

DisplayBitmap(&pDC,m_ScreenRect.left,m_ScreenRect.top,&m_OneStagePipeFig);

break;

case TWO_STAGE:

DisplayBitmap(&pDC,m_ScreenRect.left,m_ScreenRect.top,&m_TwoStagePipeFig);

break;

case THREE_STAGE:

DisplayBitmap(&pDC,m_ScreenRect.left,m_ScreenRect.top,&m_ThreeStagePipeFig);

break;

}

}

double portarea, eqportdia,A1, A2, D1, D2, D3, D4, D5 ,Lt, L1, L2, L3, L4, L5, L6, L7,velsound, velrot;

double LP01 ,LP12,LP23 ,LP34,LP45 , LP56, LP67 ;

void CTunedPipeView::OnCalculate()

{

UpdateData(TRUE);

if( m_ExhaustWidth == 0 || m_ExhaustPeriod == 0 ||

m_ExhaustHeight == 0 || m_CrankSpeed == 0 ||

m_TransferPeriod== 0 || Kh == 0 ||

m_Power == 0 || m_Capacity== 0 )

return;

m_DataReady = TRUE;

CalculateAndDraw();

}

void CTunedPipeView::CalculateAndDraw()

{

double spheatratio, gascons;

velsound = 500;//m/s

velrot = (double)(2.0 * 3.142 * m_CrankSpeed)/60.0;

A1=7;//in deg

A2=2*A1;// in deg

A1 = (A1 *3.142) /180;

A2 = (A2 *3.142) /180;

portarea = (m_ExhaustHeight*m_ExhaustWidth);

eqportdia =(double)sqrt((double)((4*(double)portarea)/3.142));

//for enduro

K0 = 0.7;

K1 = 1.125;

K2 = 2.25;

spheatratio = 1.4;

gascons = 287;

m_BMEP = (600000 * m_Power)/(m_Capacity * m_CrankSpeed);

if(m_BMEP > 11)

m_ExhaustTemp = 650;

else if(m_BMEP >9)

m_ExhaustTemp = 600;

else if(m_BMEP >8)

m_ExhaustTemp = 500;

else

m_ExhaustTemp = 350;

 

 

A0 = sqrt(spheatratio * gascons *(m_ExhaustTemp+273));

switch(m_ChamberType)

{

case ONE_STAGE:

CalculateOneStage();

UpdateData(FALSE);

DisplayDataOneStage();

break;

case TWO_STAGE:

CalculateTwoStage();

UpdateData(FALSE);

DisplayDataTwoStage();

break;

case THREE_STAGE:

CalculateThreeStage();

UpdateData(FALSE);

DisplayDataThreeStage();

break;

}

}

void CTunedPipeView::CalculateOneStage()

{

// TODO: Add your control notification handler code here

CClientDC pDC(this);

OnPrepareDC(&pDC);

D1 = 1.2 * eqportdia;

D2 = 2.5 * eqportdia;

D3 = 0.6 * eqportdia;

L1 = 8.0 * D1;

// L2 = (velsound *(m_TransferPeriod+m_ExhaustPeriod))/(24.0 * velrot);

L2 = ((D2/2) * (1/tan(A2)))/2;

L3 = 10 * D3;

L4 = ((D2-D1)/2)*(1/tan(A1));

L5 = L1 - L3 + L4;

L6 = ((D2-D3)/2)*(1/tan(A2));

L7 = D3 * 12;

}

void CTunedPipeView::CalculateTwoStage()

{

Lt = (83.3 * velsound *m_ExhaustPeriod)/m_CrankSpeed;

D1 = K1 *eqportdia;

D3 = K2 *eqportdia;

D4 = K0 *eqportdia;

LP01 = 0.10 * Lt ;

LP12 = 0.41 * Lt ;

LP23 = 0.14 * Lt ;

LP34 = 0.11 * Lt ;

LP45 = 0.24 * Lt ;

LP56 = LP45 ;

D2 = (LP12/(LP12 + LP23));

D2 = pow(D2,1.33);

D2 = D3 *D2;

 

}

void CTunedPipeView::CalculateThreeStage()

{

double X13, X12;

//horn coeff typical values between one and two. Small values of Kh are best

//suited to Grand Prix engines with narrow power bands,

//larger values are for wider more flexible engines.

Kh = 2;

Lt = (83.3 * velsound *m_ExhaustPeriod)/m_CrankSpeed;

D1 = K1 *eqportdia;

D4 = K2 *eqportdia;

D5 = K0 *eqportdia;

LP01 = 0.10 * Lt ;

LP12 = 0.275*Lt ;

LP23 = 0.183*Lt ;

LP34 = 0.092*Lt ;

LP45 = 0.11*Lt ;

LP56 = 0.24*Lt ;

LP67 = LP56 ;

X12 = (LP12)/(LP12 +LP23 +LP34);

X12 = pow(X12,Kh);

X12 = X12 * log(D4/D1);

X13 = (LP12 + LP23)/(LP12 +LP23 +LP34);

X13 = pow(X13,Kh);

X13 = X12 * log(D4/D1);

D2 = D1 *exp(X12);

D3 = D1 *exp(X13);

 

}

void CTunedPipeView::DisplayData()

{

switch(m_ChamberType)

{

case ONE_STAGE:

DisplayDataOneStage();

break;

case TWO_STAGE:

DisplayDataTwoStage();

break;

case THREE_STAGE:

DisplayDataThreeStage();

break;

}

}

void CTunedPipeView::DisplayDataOneStage()

{

int basex, basey;

char statchar[1024];

TEXTMETRIC TM;

basex=m_TextScreen.left+2;

basey=m_TextScreen.top;

CClientDC pDC(this);

OnPrepareDC(&pDC);

pDC.SelectStockObject(ANSI_VAR_FONT);

pDC.GetTextMetrics(&TM);

pDC.FillSolidRect(&m_TextScreen,RGB(255,255,255));

if(!m_DataReady)

return;

sprintf(statchar,"Port Area=%6.2f",portarea);

/* if(basex+((int)strlen(statchar)*TM.tmAveCharWidth) >m_TextScreen.left + m_TextScreen.Width())

{

basex=m_TextScreen.left;

basey += TM.tmHeight+TM.tmExternalLeading;

}*/

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"Eq. Port Dia=%6.2f",eqportdia);

/* if(basex+((int)strlen(statchar)*TM.tmAveCharWidth) > m_TextScreen.left +m_TextScreen.Width())

{

basex=m_TextScreen.left;

basey += TM.tmHeight+TM.tmExternalLeading;

}*/

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"D1=%6.2f",D1);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"Max. Dia,D2=%6.2f",D2);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"Endpipe dia,D3=%6.2f",D3);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar, "A1=%6.2f rad",A1);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"A2=%6.2f rad",A2);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"L1=%6.2f",L1);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"L2=%6.2f",L2);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"L3=%6.2f",L3);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"L4=%6.2f",L4);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"L5=%6.2f",L5);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"L6=%6.2f",L6);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"L7=%6.2f",L7);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

}

void CTunedPipeView::DisplayDataTwoStage()

{

int basex, basey;

char statchar[1024];

TEXTMETRIC TM;

basex=m_TextScreen.left+2;

basey=m_TextScreen.top;

CClientDC pDC(this);

OnPrepareDC(&pDC);

pDC.SelectStockObject(ANSI_VAR_FONT);

pDC.GetTextMetrics(&TM);

pDC.FillSolidRect(&m_TextScreen,RGB(255,255,255));

if(!m_DataReady)

return;

sprintf(statchar,"Port Area=%6.2f",portarea);

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"Eq. Port Dia, EXD=%6.2f",eqportdia);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"D1=%6.2f",D1);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"D2=%6.2f",D2);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

 

sprintf(statchar,"D3=%6.2f",D3);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"D4=%6.2f",D4);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"Lt=%6.2f",Lt);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP01=%6.2f",LP01);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP12=%6.2f",LP12);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP23=%6.2f",LP23);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP34=%6.2f",LP34);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP45=%6.2f",LP45);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP56=%6.2f",LP56);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

}

void CTunedPipeView::DisplayDataThreeStage()

{

int basex, basey;

char statchar[1024];

TEXTMETRIC TM;

basex=m_TextScreen.left+2;

basey=m_TextScreen.top;

CClientDC pDC(this);

OnPrepareDC(&pDC);

pDC.SelectStockObject(ANSI_VAR_FONT);

pDC.GetTextMetrics(&TM);

pDC.FillSolidRect(&m_TextScreen,RGB(255,255,255));

if(!m_DataReady)

return;

sprintf(statchar,"Port Area=%6.2f",portarea);

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"Eq. Port Dia, EXD=%6.2f",eqportdia);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"D1=%6.2f",D1);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"D2=%6.2f",D2);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

 

sprintf(statchar,"D3=%6.2f",D3);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"D4=%6.2f",D4);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"D5=%6.2f",D5);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"Lt=%6.2f",Lt);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP01=%6.2f",LP01);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP12=%6.2f",LP12);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP23=%6.2f",LP23);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP34=%6.2f",LP34);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP45=%6.2f",LP45);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP56=%6.2f",LP56);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

sprintf(statchar,"LP67=%6.2f",LP67);

basey += TM.tmHeight+TM.tmExternalLeading;

pDC.TextOut(basex,basey,statchar);

}

void CTunedPipeView::OnDraw(CDC* pDC)

{

DrawPipe();

UpdateData(TRUE);

if( m_DataReady)

CalculateAndDraw();

}

void CTunedPipeView::OnReset()

{

m_ExhaustWidth=m_ExhaustPeriod=m_ExhaustHeight=m_TransferPeriod=m_CrankSpeed=0;

UpdateData(FALSE);

m_DataReady = FALSE;

DisplayData();

}

void CTunedPipeView::OnOneStage()

{

if(IsDlgButtonChecked(IDC_ONE_STAGE))

{

m_ChamberType = ONE_STAGE;

InvalidateRect(&m_ScreenRect);

InvalidateRect(&m_TextScreen);

UpdateWindow();

}

}

void CTunedPipeView::OnTwoStage()

{

if(IsDlgButtonChecked(IDC_TWO_STAGE))

{

m_ChamberType = TWO_STAGE;

InvalidateRect(&m_ScreenRect);

InvalidateRect(&m_TextScreen);

UpdateWindow();

}

}

void CTunedPipeView::OnThreeStage()

{

if(IsDlgButtonChecked(IDC_THREE_STAGE))

{

m_ChamberType = THREE_STAGE;

InvalidateRect(&m_ScreenRect);

InvalidateRect(&m_TextScreen);

UpdateWindow();

}

}

The Software Operation:

First we need to select the Expansion Chamber Type from the radio buttons on the top left. Next the various details of the engine are entered into the input boxes. The following details is required to be entered:

After all the values are entered into the input the Calculate button is pressed to compute the necessary details for the selected chamber type. You can also change the chamber type after entering the values to calculate the dimensions for another chamber type. You can also reset the values to zero by pressing the Reset button.

A snapshot of the software program is shown below