



/*************************************************************************
* File	:	dlghlp.cpp
* Description	:	Helper functions for aga10win main dialog box
* Version	:	1.7   2002.11.17
* Author	:	W.B. Peterson
* Revisions	:	
* Copyright (c) 2002 American Gas Association
**************************************************************************/

#include "aga10win.h" #include "aga10.h"

/* variables declared externally */ extern HINSTANCE hInst ;

extern double total ; extern long int lPb_unit ; extern long int lPf_unit ; extern long int lTb_unit ; extern long int lTf_unit ; extern long int lRhob_unit ; extern long int lRhof_unit ; extern long int lSOS_unit ;

extern long int lEnthalpy_unit ; extern long int lEntropy_unit ;

/* a local buffer for text strings */ static char szBuffer[FIELD40] ;

/**************************************************************************

*	Function	:	WriteInputs()
*	Arguments	:	HWND
*	Returns	:	void
*	Purpose	:	Function for writing the input fields of the main window
*	Notes	:	Uses non-portable, run-time library function _gcvt()
*			for converting strings to double precision floats.
*	Revisions	:	
**************************************************************************/

void WriteInputs(HWND hDlg, AGA10STRUCT *A10)

{




HWND hListBox; int i ;
double Pbx, Tbx, Pfx, Tfx ;

/* calculate Pb in specified unit of measure */ switch (lPb_unit)
{
case KILOPASCAL :

Pbx = A10->dPb * 1.0e-3 ; break ;

	case MEGAPASCAL :
	Pbx =	A10->dPb * 1.0e-6 ;
	break ;
	case PSI :	
}	Pbx =	A10->dPb / 6894.75729 ;
		
/*	calculate Pf in specified unit of measure */
switch (lPf_unit)	
{	case KILOPASCAL :
	
	Pfx =	A10->dPf * 1.0e-3 ;
	break ;
	case MEGAPASCAL :
	Pfx =	A10->dPf * 1.0e-6 ;
	break ;
	case PSI :	
}	Pfx =	A10->dPf / 6894.75729 ;
		
/*	calculate Tb in specified unit of measure */
switch (lTb_unit)	
{	case CELSIUS :
	
	Tbx =	A10->dTb - 273.15 ;
	break	;



	case FAHRENHEIT :
	Tbx =	(A10->dTb * 1.8) - 459.67 ;
	break	;
	case KELVIN	:
	Tbx =	A10->dTb ;
	break	;
	case RANKINE :
}	Tbx =	A10->dTb * 1.8 ;
		
/*	calculate Tf in specified unit of measure */
switch (lTf_unit)	
{	case CELSIUS :
	
	Tfx =	A10->dTf - 273.15 ;
	break ;
	case FAHRENHEIT :
	Tfx =	(A10->dTf * 1.8) - 459.67 ;
	break	;
	case KELVIN	:
	Tfx =	A10->dTf ;
	break	;
	case RANKINE :
}	Tfx =	A10->dTf * 1.8 ;
		

// Pb

_gcvt (Pbx, 9, szBuffer);
SetDlgItemText (hDlg, IDC_PB, szBuffer) ; // Tb
_gcvt (Tbx, 9, szBuffer);
SetDlgItemText (hDlg, IDC_TB, szBuffer) ; // Pf

_gcvt (Pfx, 9, szBuffer);




SetDlgItemText (hDlg, IDC_PF, szBuffer) ; // Tf

_gcvt (Tfx, 9, szBuffer);
SetDlgItemText (hDlg, IDC_TF, szBuffer) ; // composition

_gcvt (A10->adMixture[XiC1] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIC1, szBuffer) ;
_gcvt (A10->adMixture[XiN2] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIN2, szBuffer) ;

_gcvt (A10->adMixture[XiCO2] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XICO2, szBuffer) ;
_gcvt (A10->adMixture[XiC2] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIC2, szBuffer) ;

_gcvt (A10->adMixture[XiC3] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIC3, szBuffer) ;

_gcvt (A10->adMixture[XiH2O] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIH2O, szBuffer) ;
_gcvt (A10->adMixture[XiH2S] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIH2S, szBuffer) ;

_gcvt (A10->adMixture[XiH2] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIH2, szBuffer) ;
_gcvt (A10->adMixture[XiCO] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XICO, szBuffer) ;

_gcvt (A10->adMixture[XiO2] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIO2, szBuffer) ;

_gcvt (A10->adMixture[XiIC4] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIIC4, szBuffer) ;
_gcvt (A10->adMixture[XiNC4] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XINC4, szBuffer) ;

_gcvt (A10->adMixture[XiIC5] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XIIC5, szBuffer) ;
_gcvt (A10->adMixture[XiNC5] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XINC5, szBuffer) ;

_gcvt (A10->adMixture[XiNC6] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XINC6, szBuffer) ;
_gcvt (A10->adMixture[XiNC7] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XINC7, szBuffer) ;

_gcvt (A10->adMixture[XiNC8] * 100.0, 9, szBuffer); SetDlgItemText (hDlg, IDC_XINC8, szBuffer) ;

_gcvt (A10->adMixture[XiNC9] * 100.0, 9, szBuffer);




SetDlgItemText (hDlg, IDC_XINC9, szBuffer) ; _gcvt (A10->adMixture[XiNC10] * 100.0, 9, szBuffer);

SetDlgItemText (hDlg, IDC_XINC10, szBuffer) ; _gcvt (A10->adMixture[XiHe] * 100.0, 9, szBuffer);

SetDlgItemText (hDlg, IDC_XIHE, szBuffer) ; _gcvt (A10->adMixture[XiAr] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIAR, szBuffer) ;

for (i=0, total = 0.0 ; i<NUMBEROFCOMPONENTS; i++) total += A10->adMixture[i]; sprintf(szBuffer, "%6.6f", total * 100.0) ;

SetDlgItemText(hDlg, IDC_TOTAL, szBuffer) ;

hListBox = GetDlgItem(hDlg, IDC_PB_U) ;

if (!SendMessage(hListBox, CB_GETCOUNT, 0,0)) PressureDlgHelp(hListBox) ; LoadString(hInst, lPb_unit, szBuffer, FIELD40) ;

SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;

hListBox = GetDlgItem(hDlg, IDC_PF_U) ;

if (!SendMessage(hListBox, CB_GETCOUNT, 0,0)) PressureDlgHelp(hListBox) ; LoadString(hInst, lPf_unit, szBuffer, FIELD40) ;

SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;

hListBox = GetDlgItem(hDlg, IDC_TB_U) ;

if (!SendMessage(hListBox, CB_GETCOUNT, 0,0)) TemperatureDlgHelp(hListBox) ; LoadString(hInst, lTb_unit, szBuffer, FIELD40) ;

SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;

hListBox = GetDlgItem(hDlg, IDC_TF_U) ;

if (!SendMessage(hListBox, CB_GETCOUNT, 0,0)) TemperatureDlgHelp(hListBox) ; LoadString(hInst, lTf_unit, szBuffer, FIELD40) ;
SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;

hListBox = GetDlgItem(hDlg, IDC_RHOB_U) ;

if (!SendMessage(hListBox, CB_GETCOUNT, 0,0)) DensityDlgHelp(hListBox) ; LoadString(hInst, lRhob_unit, szBuffer, FIELD40) ; SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;

hListBox = GetDlgItem(hDlg, IDC_RHOF_U) ;

if (!SendMessage(hListBox, CB_GETCOUNT, 0,0)) DensityDlgHelp(hListBox) ; LoadString(hInst, lRhof_unit, szBuffer, FIELD40) ;




SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;

hListBox = GetDlgItem(hDlg, IDC_SOS_U) ;

if (!SendMessage(hListBox, CB_GETCOUNT, 0,0)) SOSDlgHelp(hListBox) ; LoadString(hInst, lSOS_unit, szBuffer, FIELD40) ; SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;

hListBox = GetDlgItem(hDlg, IDC_ENTHALPY_U) ;

if (!SendMessage(hListBox, CB_GETCOUNT, 0,0)) EnthalpyDlgHelp(hListBox) ; LoadString(hInst, lEnthalpy_unit, szBuffer, FIELD40) ; SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;

hListBox = GetDlgItem(hDlg, IDC_ENTROPY_U) ;

if (!SendMessage(hListBox, CB_GETCOUNT, 0,0)) EntropyDlgHelp(hListBox) ; LoadString(hInst, lEntropy_unit, szBuffer, FIELD40) ; SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;

}

/**************************************************************************

*	Function	:	WriteInputs()
*	Arguments	:	HWND
*	Returns	:	void
*	Purpose	:	Function for writing the input fields of the main window
*	Notes	:	Uses non-portable, run-time library function _gcvt()
*			for converting strings to double precision floats.
*	Revisions	:	
**************************************************************************/

void WriteOutputs(HWND hDlg, AGA10STRUCT *A10)

{

double Rhofx, SOSx, Enthalpyx, Entropyx ;

/* calculate Rhof in specified unit of measure */ switch (lRhof_unit)

{

case KGPERCUBICMETRE : Rhofx = A10->dRhof ; break ;

case LBMPERCUBICFOOT :




Rhofx = (A10->dRhof	/ 0.45359237) * pow(0.3048, 3.0)	;

}				
/*	calculate SOS in specified unit of measure	*/	
switch (lSOS_unit)			
{	case METREPERSECOND :			
				
	SOSx = A10->dSOS ;			
	break ;			
	case FOOTPERSECOND :			
}	SOSx = A10->dSOS  / 0.3048  ;			
				
/*	calculate specific enthalpy in specified unit of measure	*/
switch (lEnthalpy_unit)			
{	case KJPERKG :			
				
	Enthalpyx = A10->dH * 0.001 ;			
	break ;			
	case BTUPERLBM :			
}	Enthalpyx = A10->dH / ((5000./9.) * 4.1868) ;		
				
/*	calculate specific entropy in specified unit of measure	*/
switch (lEntropy_unit)			
{	case KJPERKGK :			
				
	Entropyx = A10->dS * 0.001 ;			
	break ;			
	case BTUPERLBMF :			
}	Entropyx = A10->dS / (1.0e3 * 4.1868)  ;		
				
/*	write the outputs to the window	*/		
_gcvt (Rhofx, 9, szBuffer);			
SetDlgItemText (hDlg, IDC_RHOF, szBuffer) ;		





_gcvt (SOSx, 9, szBuffer);

SetDlgItemText (hDlg, IDC_SOS, szBuffer) ;

_gcvt (A10->dZb, 9, szBuffer); SetDlgItemText (hDlg, IDC_ZB, szBuffer) ;

_gcvt (A10->dZf, 9, szBuffer); SetDlgItemText (hDlg, IDC_ZF, szBuffer) ;

_gcvt (A10->dFpv, 9, szBuffer); SetDlgItemText (hDlg, IDC_FPV, szBuffer) ;

_gcvt (A10->dDf, 9, szBuffer); SetDlgItemText (hDlg, IDC_DF, szBuffer) ;

_gcvt (A10->dRD_Ideal, 9, szBuffer); SetDlgItemText (hDlg, IDC_RD_IDEAL, szBuffer) ;

_gcvt (A10->dRD_Real, 9, szBuffer); SetDlgItemText (hDlg, IDC_RD_REAL, szBuffer) ;

_gcvt (A10->dMrx, 9, szBuffer); SetDlgItemText (hDlg, IDC_MRX, szBuffer) ;

_gcvt (A10->dCpi * 0.001, 9, szBuffer); SetDlgItemText (hDlg, IDC_CPI, szBuffer) ;

_gcvt (A10->dCp * 0.001, 9, szBuffer); SetDlgItemText (hDlg, IDC_CP, szBuffer) ;

_gcvt (A10->dCv * 0.001, 9, szBuffer); SetDlgItemText (hDlg, IDC_CV, szBuffer) ;

_gcvt (A10->dk, 9, szBuffer); SetDlgItemText (hDlg, IDC_K, szBuffer) ;

_gcvt (A10->dKappa, 9, szBuffer); SetDlgItemText (hDlg, IDC_KAPPA, szBuffer) ;

_gcvt (A10->dHo * 0.001, 9, szBuffer);




SetDlgItemText (hDlg, IDC_HO, szBuffer) ;

_gcvt (Enthalpyx, 9, szBuffer); SetDlgItemText (hDlg, IDC_H, szBuffer) ;

_gcvt (Entropyx, 9, szBuffer); SetDlgItemText (hDlg, IDC_S, szBuffer) ;

// reality check included for C*

if (A10->dCstar > 0.3 && A10->dCstar < 1.3)
{

_gcvt (A10->dCstar, 9, szBuffer); SetDlgItemText (hDlg, IDC_CSTAR, szBuffer) ;
}
else

{
	lstrcpy(szBuffer, "Cannot Solve!") ;
}	SetDlgItemText (hDlg, IDC_CSTAR, szBuffer) ;
	
/*	update status indicator, based on return codes  */
if (A10->lStatus == 9000)
{

lstrcpy(szBuffer, "Calculation Completed") ; SetDlgItemText (hDlg, IDC_LSTATUS, szBuffer) ;

}

else
{

_ltoa (A10->lStatus, szBuffer, 10); SetDlgItemText (hDlg, IDC_LSTATUS, szBuffer) ;
}
}

/**************************************************************************

*	Function	:	ReadInputs()
*	Arguments	:	HWND
*	Returns	:	void
*	Purpose	:	Function for reading the input fields of the main window
*	Revisions	:	
**************************************************************************/




void ReadInputs(HWND hDlg, AGA10STRUCT *A10)

{
HWND hListBox; int iSelection; int i ;
char * stopstr;

//Pb

GetDlgItemText(hDlg, IDC_PB, szBuffer, FIELD30) ; hListBox = GetDlgItem(hDlg, IDC_PB_U) ;

iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ; switch (iSelection)

{
case 0 :

lPb_unit = KILOPASCAL ;

A10->dPb = strtod(szBuffer, &stopstr) * 1.0e3 ; break ;

case 1 :
lPb_unit = MEGAPASCAL ;

A10->dPb = strtod(szBuffer, &stopstr) * 1.0e6 ; break ;
case 2 :
lPb_unit = PSI ;
A10->dPb = strtod(szBuffer, &stopstr) * 6894.75729 ;

}

//Pf

GetDlgItemText(hDlg, IDC_PF, szBuffer, FIELD30) ; hListBox = GetDlgItem(hDlg, IDC_PF_U) ;

iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ; switch (iSelection)

{
case 0 :

lPf_unit = KILOPASCAL ;

A10->dPf = strtod(szBuffer, &stopstr) * 1.0e3 ; break ;

case 1 :
lPf_unit = MEGAPASCAL ;

A10->dPf = strtod(szBuffer, &stopstr) * 1.0e6 ;




break ; case 2 :

lPf_unit = PSI ;
A10->dPf = strtod(szBuffer, &stopstr) * 6894.75729 ;
}

//Tb

GetDlgItemText(hDlg, IDC_TB, szBuffer, FIELD30) ; hListBox = GetDlgItem(hDlg, IDC_TB_U) ;

iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ; switch (iSelection)
{
case 0 :
lTb_unit = CELSIUS ;

A10->dTb = strtod(szBuffer, &stopstr) + 273.15; break ;
case 1 :
lTb_unit = FAHRENHEIT ;

A10->dTb = (strtod(szBuffer, &stopstr) + 459.67) / 1.8 ; break ;

case 2 :

lTb_unit = KELVIN ;
A10->dTb = strtod(szBuffer, &stopstr) ; break ;

case 3 :
lTb_unit = RANKINE ;

A10->dTb = strtod(szBuffer, &stopstr) / 1.8;
}


//Tf

GetDlgItemText(hDlg, IDC_TF, szBuffer, FIELD30) ; hListBox = GetDlgItem(hDlg, IDC_TF_U) ;

iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ; switch (iSelection)
{
case 0 :
lTf_unit = CELSIUS ;

A10->dTf = strtod(szBuffer, &stopstr) + 273.15; break ;




case 1 :

lTf_unit = FAHRENHEIT ;

A10->dTf = (strtod(szBuffer, &stopstr) + 459.67) / 1.8 ; break ;

case 2 :
lTf_unit = KELVIN ;

A10->dTf = strtod(szBuffer, &stopstr) ; break ;

case 3 :
lTf_unit = RANKINE ;

A10->dTf = strtod(szBuffer, &stopstr) / 1.8;

}

//Rhof

hListBox = GetDlgItem(hDlg, IDC_RHOF_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ; switch (iSelection)
{
case 0 :

lRhof_unit = KGPERCUBICMETRE ; break ;
case 1 :
lRhof_unit = LBMPERCUBICFOOT ;
}

//SOS

hListBox = GetDlgItem(hDlg, IDC_SOS_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ; switch (iSelection)

{

case 0 :
lSOS_unit = METREPERSECOND ; break ;

case 1 :
lSOS_unit = FOOTPERSECOND ;

}

//Enthalpy

hListBox = GetDlgItem(hDlg, IDC_ENTHALPY_U) ; iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ;




switch (iSelection)

{
case 0 :

lEnthalpy_unit = KJPERKG ; break ;

case 1 :

lEnthalpy_unit = BTUPERLBM ;
}

//Entropy

hListBox = GetDlgItem(hDlg, IDC_ENTROPY_U) ; iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ; switch (iSelection)

{
case 0 :

lEntropy_unit = KJPERKGK ; break ;
case 1 :
lEntropy_unit = BTUPERLBMF ;
}

// composition

GetDlgItemText(hDlg,IDC_XIC1, szBuffer, FIELD30) ; A10->adMixture[XiC1] = strtod(szBuffer, &stopstr) * 0.01 ; GetDlgItemText(hDlg,IDC_XIN2, szBuffer, FIELD30) ; A10->adMixture[XiN2] = strtod(szBuffer, &stopstr) * 0.01 ; GetDlgItemText(hDlg,IDC_XICO2, szBuffer, FIELD30) ; A10->adMixture[XiCO2] = strtod(szBuffer, &stopstr) * 0.01 ; GetDlgItemText(hDlg,IDC_XIC2, szBuffer, FIELD30) ; A10->adMixture[XiC2] = strtod(szBuffer, &stopstr) * 0.01 ; GetDlgItemText(hDlg,IDC_XIC3, szBuffer, FIELD30) ; A10->adMixture[XiC3] = strtod(szBuffer, &stopstr) * 0.01 ; GetDlgItemText(hDlg,IDC_XIH2O, szBuffer, FIELD30) ; A10->adMixture[XiH2O] = strtod(szBuffer, &stopstr) * 0.01 ; GetDlgItemText(hDlg,IDC_XIH2S, szBuffer, FIELD30) ; A10->adMixture[XiH2S] = strtod(szBuffer, &stopstr) * 0.01 ; GetDlgItemText(hDlg,IDC_XIH2, szBuffer, FIELD30) ; A10->adMixture[XiH2] = strtod(szBuffer, &stopstr) * 0.01 ; GetDlgItemText(hDlg,IDC_XICO, szBuffer, FIELD30) ; A10->adMixture[XiCO] = strtod(szBuffer, &stopstr) * 0.01 ;




GetDlgItemText(hDlg,IDC_XIO2, szBuffer, FIELD30) ;

A10->adMixture[XiO2] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIIC4, szBuffer, FIELD30) ;
A10->adMixture[XiIC4] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC4, szBuffer, FIELD30) ;

A10->adMixture[XiNC4] = strtod(szBuffer, &stopstr) * 0.01 ;

GetDlgItemText(hDlg,IDC_XIIC5, szBuffer, FIELD30) ;
A10->adMixture[XiIC5] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC5, szBuffer, FIELD30) ;
A10->adMixture[XiNC5] = strtod(szBuffer, &stopstr) * 0.01 ;

GetDlgItemText(hDlg,IDC_XINC6, szBuffer, FIELD30) ;

A10->adMixture[XiNC6] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC7, szBuffer, FIELD30) ;
A10->adMixture[XiNC7] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC8, szBuffer, FIELD30) ;

A10->adMixture[XiNC8] = strtod(szBuffer, &stopstr) * 0.01 ;

GetDlgItemText(hDlg,IDC_XINC9, szBuffer, FIELD30) ;
A10->adMixture[XiNC9] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC10, szBuffer, FIELD30) ;
A10->adMixture[XiNC10] = strtod(szBuffer, &stopstr) * 0.01 ;

GetDlgItemText(hDlg,IDC_XIHE, szBuffer, FIELD30) ;

A10->adMixture[XiHe] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIAR, szBuffer, FIELD30) ;
A10->adMixture[XiAr] = strtod(szBuffer, &stopstr) * 0.01 ;

// sum up the mole fractions

for (i=0,total = 0.0; i<NUMBEROFCOMPONENTS; i++) total += A10->adMixture[i]; sprintf(szBuffer, "%6.6f", total * 100.0) ;

SetDlgItemText(hDlg, IDC_TOTAL, szBuffer) ;
}


/**************************************************************************

*	Function	:	PressureDlgHelp()
*	Arguments	:	HWND
*	Returns	:	void
*	Purpose	:	Helper function for loading strings into pressure
*			drop-list controls
*	Revisions	:	
**************************************************************************/




void PressureDlgHelp(HWND hListBox)

{
LoadString(hInst, KILOPASCAL, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 0, (LONG)(LPSTR) szBuffer) ; LoadString(hInst, MEGAPASCAL, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 1, (LONG)(LPSTR) szBuffer) ; LoadString(hInst, PSI, szBuffer, FIELD40) ;
SendMessage(hListBox, CB_INSERTSTRING, 2, (LONG)(LPSTR) szBuffer) ;
}


/**************************************************************************
*	Function	:	TemperatureDlgHelp()
*	Arguments	:	HWND
*	Returns	:	void
*	Purpose	:	Helper function for loading strings into temperature
*			drop-list controls
*	Revisions	:	
**************************************************************************/

void TemperatureDlgHelp(HWND hListBox)

{
LoadString(hInst, CELSIUS, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 0, (LONG)(LPSTR) szBuffer) ; LoadString(hInst, FAHRENHEIT, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 1, (LONG)(LPSTR) szBuffer) ; LoadString(hInst, KELVIN, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 2, (LONG)(LPSTR) szBuffer) ; LoadString(hInst, RANKINE, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 3, (LONG)(LPSTR) szBuffer) ;

}


/**************************************************************************
*	Function	:	DensityDlgHelp()
*	Arguments	:	HWND
*	Returns	:	void
*	Purpose	:	Helper function for loading strings into density
*			drop-list controls




*	Revisions	:

**************************************************************************/

void DensityDlgHelp(HWND hListBox)

{
LoadString(hInst, KGPERCUBICMETRE, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 0, (LONG)(LPSTR) szBuffer) ; LoadString(hInst, LBMPERCUBICFOOT, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 1, (LONG)(LPSTR) szBuffer) ;

}


/**************************************************************************
*	Function	:	SOSDlgHelp()
*	Arguments	:	HWND
*	Returns	:	void
*	Purpose	:	Helper function for loading strings into SOS
*			drop-list controls
*	Revisions	:	
**************************************************************************/

void SOSDlgHelp(HWND hListBox)

{
LoadString(hInst, METREPERSECOND, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 0, (LONG)(LPSTR) szBuffer) ; LoadString(hInst, FOOTPERSECOND, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 1, (LONG)(LPSTR) szBuffer) ;

}


/**************************************************************************
*	Function	:	EnthalpyDlgHelp()
*	Arguments	:	HWND
*	Returns	:	void
*	Purpose	:	Helper function for loading strings into enthalpy
*			drop-list controls
*	Revisions	:	
**************************************************************************/

void EnthalpyDlgHelp(HWND hListBox)




{

LoadString(hInst, KJPERKG, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 0, (LONG)(LPSTR) szBuffer) ; LoadString(hInst, BTUPERLBM, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 1, (LONG)(LPSTR) szBuffer) ;

}

/**************************************************************************
*	Function	:	EntropyDlgHelp()
*	Arguments	:	HWND
*	Returns	:	void
*	Purpose	:	Helper function for loading strings into entropy
*			drop-list controls
*	Revisions	:	
**************************************************************************/

void EntropyDlgHelp(HWND hListBox)

{
LoadString(hInst, KJPERKGK, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 0, (LONG)(LPSTR) szBuffer) ; LoadString(hInst, BTUPERLBMF, szBuffer, FIELD40) ; SendMessage(hListBox, CB_INSERTSTRING, 1, (LONG)(LPSTR) szBuffer) ;

}

/**************************************************************************

*	Function	:	SetDefaults()
*	Arguments	:	void	
*	Returns	:	void	
*	Purpose	:	initializes AGA10STRUCT and units of measure
*	Revisions	:		
**************************************************************************/
void SetDefaults(AGA10STRUCT *A10)	
{	A10->lStatus = 9000 ;	/* 9000 is status code for 'ok' */
		
	A10->bForceUpdate = true;	/* ensures that full calculation is performed */
	A10->dPb = 101325.0 ;	/* 1 atm */
	A10->dTb = 288.15;		/* 15 C */
	A10->dPf = 4000000.0 ;	/* 4 MPa */
	A10->dTf = 283.15;		/* 10 C */




A10->adMixture[XiC1] = 0.906724;	/* AMARILLO example composition...*/

A10->adMixture[XiN2] = 0.031284;
A10->adMixture[XiCO2] = 0.004676;
A10->adMixture[XiC2] = 0.045279;
A10->adMixture[XiC3] = 0.00828;

A10->adMixture[XiH2O] = 0.0;

A10->adMixture[XiH2S] = 0.0;
A10->adMixture[XiH2] = 0.0;
A10->adMixture[XiCO] = 0.0;
A10->adMixture[XiO2] = 0.0;

A10->adMixture[XiIC4] = 0.001037;

A10->adMixture[XiNC4] = 0.001563;
A10->adMixture[XiIC5] = 0.000321;
A10->adMixture[XiNC5] = 0.000443;
A10->adMixture[XiNC6] = 0.000393;

A10->adMixture[XiNC7] = 0.0;

A10->adMixture[XiNC8] = 0.0;
A10->adMixture[XiNC9] = 0.0;
A10->adMixture[XiNC10] = 0.0;
A10->adMixture[XiHe] = 0.0;

A10->adMixture[XiAr] = 0.0;

/* reset units of measure	*/

lPb_unit = KILOPASCAL ;
lPf_unit = KILOPASCAL ;

lTb_unit = CELSIUS ;

lTf_unit = CELSIUS ; lRhob_unit = KGPERCUBICMETRE ; lRhof_unit = KGPERCUBICMETRE ; lSOS_unit = METREPERSECOND ; lEnthalpy_unit = KJPERKG ; lEntropy_unit = KJPERKGK ;

}






