1962 lines
46 KiB
C
1962 lines
46 KiB
C
|
/*************************************************************************
|
|||
|
|
|||
|
* File : aga10win.h
|
|||
|
* Description : function prototypes and defines for aga10win.cpp
|
|||
|
* Version : 1.7 2002.11.17
|
|||
|
* Author : W.B. Peterson
|
|||
|
* Revisions :
|
|||
|
* Copyright (c) 2002 American Gas Association
|
|||
|
|
|||
|
**************************************************************************/
|
|||
|
|
|||
|
#ifndef _AGA10WIN_H #define _AGA10WIN_H
|
|||
|
|
|||
|
#include <windows.h> #include <commdlg.h>
|
|||
|
|
|||
|
/* control IDs for windows interface */
|
|||
|
|
|||
|
#define IDC_LSTATUS 20
|
|||
|
#define IDC_XIC1 21
|
|||
|
#define IDC_XIN2 22
|
|||
|
#define IDC_XICO2 23
|
|||
|
#define IDC_XIC2 24
|
|||
|
#define IDC_XIC3 25
|
|||
|
#define IDC_XIH2O 26
|
|||
|
#define IDC_XIH2S 27
|
|||
|
#define IDC_XIH2 28
|
|||
|
#define IDC_XICO 29
|
|||
|
#define IDC_XIO2 30
|
|||
|
#define IDC_XIIC4 31
|
|||
|
#define IDC_XINC4 32
|
|||
|
#define IDC_XIIC5 33
|
|||
|
#define IDC_XINC5 34
|
|||
|
#define IDC_XINC6 35
|
|||
|
#define IDC_XINC7 36
|
|||
|
#define IDC_XINC8 37
|
|||
|
#define IDC_XINC9 38
|
|||
|
#define IDC_XINC10 39
|
|||
|
#define IDC_XIHE 40
|
|||
|
#define IDC_XIAR 41
|
|||
|
#define IDC_PB 42
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#define IDC_TB 43
|
|||
|
#define IDC_PF 44
|
|||
|
#define IDC_TF 45
|
|||
|
#define IDC_MRX 46
|
|||
|
#define IDC_ZB 47
|
|||
|
#define IDC_ZF 48
|
|||
|
#define IDC_FPV 49
|
|||
|
#define IDC_DB 50
|
|||
|
#define IDC_DF 51
|
|||
|
#define IDC_RHOB 52
|
|||
|
#define IDC_RHOF 53
|
|||
|
#define IDC_RD_IDEAL 54
|
|||
|
#define IDC_RD_REAL 55
|
|||
|
#define IDC_HO 56
|
|||
|
#define IDC_H 57
|
|||
|
#define IDC_S 58
|
|||
|
#define IDC_CPI 59
|
|||
|
#define IDC_CP 60
|
|||
|
#define IDC_CV 61
|
|||
|
#define IDC_K 62
|
|||
|
#define IDC_KAPPA 63
|
|||
|
#define IDC_SOS 64
|
|||
|
#define IDC_CSTAR 65
|
|||
|
#define IDC_PB_U 66
|
|||
|
#define IDC_TB_U 67
|
|||
|
#define IDC_PF_U 68
|
|||
|
#define IDC_TF_U 69
|
|||
|
#define IDC_SOS_U 70
|
|||
|
#define IDC_RHOB_U 71
|
|||
|
#define IDC_RHOF_U 72
|
|||
|
#define IDC_ENTHALPY_U 73
|
|||
|
#define IDC_ENTROPY_U 74
|
|||
|
#define IDC_TOTAL 75
|
|||
|
#define IDC_CLEAR 76
|
|||
|
#define IDC_NORMALIZE 77
|
|||
|
#define KILOPASCAL 78
|
|||
|
#define MEGAPASCAL 79
|
|||
|
#define PSI 80
|
|||
|
#define KELVIN 81
|
|||
|
#define CELSIUS 82
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#define RANKINE 83
|
|||
|
#define FAHRENHEIT 84
|
|||
|
#define KGPERCUBICMETRE 85
|
|||
|
#define LBMPERCUBICFOOT 86
|
|||
|
#define METREPERSECOND 87
|
|||
|
#define FOOTPERSECOND 88
|
|||
|
#define KJPERKG 89
|
|||
|
#define BTUPERLBM 90
|
|||
|
#define KJPERKGK 91
|
|||
|
#define BTUPERLBMF 92
|
|||
|
#define CM_FILEOPEN 93
|
|||
|
#define CM_FILESAVE 94
|
|||
|
#define CM_FILESAVEAS 95
|
|||
|
#define CM_HELPABOUT 96
|
|||
|
#define IDR_MENU1 97
|
|||
|
#define IDC_STATIC (-1)
|
|||
|
/* buffer sizes */
|
|||
|
#define FIELD40 40
|
|||
|
#define FIELD30 30
|
|||
|
|
|||
|
/* function prototypes */
|
|||
|
|
|||
|
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; void PressureDlgHelp(HWND) ;
|
|||
|
|
|||
|
void TemperatureDlgHelp(HWND) ; void DensityDlgHelp(HWND) ; void SOSDlgHelp(HWND) ;
|
|||
|
|
|||
|
void EnthalpyDlgHelp(HWND) ; void EntropyDlgHelp(HWND) ; void FileInitialize (HWND) ;
|
|||
|
BOOL FileOpenDlg (HWND, PSTR, PSTR) ;
|
|||
|
|
|||
|
BOOL FileSaveDlg (HWND, PSTR, PSTR) ; #endif
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*************************************************************************
|
|||
|
* File : aga10win.cpp
|
|||
|
* Description : Simple Win32 program demonstrating use of aga10.dll
|
|||
|
* Supports Windows dialog box and file operations
|
|||
|
* Version : 1.7 2002.11.17
|
|||
|
* Author : W.B. Peterson
|
|||
|
* Revisions :
|
|||
|
* Copyright (c) 2002 American Gas Association
|
|||
|
**************************************************************************/
|
|||
|
#include "aga10win.h"
|
|||
|
#include "aga10.h"
|
|||
|
/* create pointer to a data structure for exchanging data with aga10.dll */
|
|||
|
static AGA10STRUCT *A10 ;
|
|||
|
/* global variables for strings, filenames, etc */
|
|||
|
static char szAppName[] = "aga10win" ;
|
|||
|
static char szBuffer[FIELD40] ;
|
|||
|
char szFileName[_MAX_PATH] ;
|
|||
|
char szTitleName[_MAX_FNAME + _MAX_EXT] ;
|
|||
|
/* declare one application instance */
|
|||
|
HINSTANCE hInst ;
|
|||
|
/* global variables for units of measure and critical flow coefficient C* */
|
|||
|
double total = 0.0 ;
|
|||
|
long int lPb_unit ; /* unit of measure for base pressure */
|
|||
|
long int lPf_unit ; /* unit of measure for flowing pressure */
|
|||
|
long int lTb_unit ; /* unit of measure for base temperature */
|
|||
|
long int lTf_unit ; /* unit of measure for flowing temperature */
|
|||
|
long int lRhob_unit ; /* unit of measure for density at base conditions */
|
|||
|
long int lRhof_unit ; /* unit of measure for density at flowing conditions */
|
|||
|
long int lSOS_unit ; /* unit of measure for speed of sound */
|
|||
|
long int lEnthalpy_unit ; /* unit of measure for specific enthalpy */
|
|||
|
long int lEntropy_unit ; /* unit of measure for specific entropy */
|
|||
|
|
|||
|
// prototypes for support functions not prototyped in aga10win.h bool FileRead(HWND, PSTR, AGA10STRUCT *);
|
|||
|
|
|||
|
bool FileWrite(HWND, PSTR, AGA10STRUCT *) ;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void ReadInputs(HWND, AGA10STRUCT *) ; void WriteInputs(HWND, AGA10STRUCT *) ; void WriteOutputs(HWND, AGA10STRUCT *) ; void SetDefaults(AGA10STRUCT *) ;
|
|||
|
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* Function : WinMain()
|
|||
|
* Arguments : HINSTANCE, HINSTANCE, PSTR, int
|
|||
|
* Returns : int
|
|||
|
* Purpose : Every Windows application has a WinMain()
|
|||
|
* Revisions :
|
|||
|
**************************************************************************/
|
|||
|
|
|||
|
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
|
|||
|
{
|
|||
|
HWND hWnd ;
|
|||
|
MSG msg ;
|
|||
|
WNDCLASSEX wndclass ;
|
|||
|
|
|||
|
/* set window class properties */
|
|||
|
|
|||
|
wndclass.cbSize = sizeof (wndclass) ;
|
|||
|
wndclass.style = CS_HREDRAW | CS_VREDRAW;
|
|||
|
wndclass.lpfnWndProc = WndProc ;
|
|||
|
|
|||
|
wndclass.cbClsExtra = 0 ;
|
|||
|
|
|||
|
wndclass.cbWndExtra = DLGWINDOWEXTRA ;
|
|||
|
wndclass.hInstance = hInstance ;
|
|||
|
wndclass.hIcon = LoadIcon (hInstance, szAppName) ;
|
|||
|
|
|||
|
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
|
|||
|
|
|||
|
wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1) ;
|
|||
|
wndclass.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1) ;
|
|||
|
wndclass.lpszClassName = szAppName ;
|
|||
|
wndclass.hIconSm = LoadIcon (hInstance, szAppName) ;
|
|||
|
|
|||
|
/* register the class */ RegisterClassEx (&wndclass) ;
|
|||
|
|
|||
|
/* create a dialog box */
|
|||
|
|
|||
|
hWnd = CreateDialog (hInstance, "aga10win", 0, NULL) ;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/* start the application's message pump */ while (GetMessage (&msg, NULL, 0, 0))
|
|||
|
|
|||
|
{
|
|||
|
TranslateMessage(&msg) ;
|
|||
|
|
|||
|
DispatchMessage(&msg) ;
|
|||
|
|
|||
|
}
|
|||
|
return msg.wParam ;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* Function : WndProc()
|
|||
|
* Arguments : HWND, UINT, WPARAM, LPARAM
|
|||
|
* Returns : LRESULT
|
|||
|
* Purpose : One and only window process for this app
|
|||
|
* Revisions :
|
|||
|
**************************************************************************/
|
|||
|
|
|||
|
LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
int i = 0 ; double temp ;
|
|||
|
|
|||
|
switch (iMsg)
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
case WM_CREATE :
|
|||
|
/* get application instance */
|
|||
|
hInst = ((LPCREATESTRUCT) lParam)->hInstance ;
|
|||
|
|
|||
|
/* initialize file data */ FileInitialize (hwnd) ;
|
|||
|
|
|||
|
/* initialize calculation library */ AGA10_Init() ;
|
|||
|
|
|||
|
/* create an object at the pointer we have already defined */ if (NULL == (A10 = new AGA10STRUCT)) return TRUE ;
|
|||
|
|
|||
|
/* set the defaults for this application */
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
SetDefaults(A10) ; return FALSE ;
|
|||
|
|
|||
|
case WM_COMMAND :
|
|||
|
|
|||
|
/* refresh the input data, triggered by focus change */ if (lParam && HIWORD (wParam) == EN_KILLFOCUS)
|
|||
|
{
|
|||
|
ReadInputs(hwnd, A10) ;
|
|||
|
|
|||
|
WriteInputs(hwnd, A10) ; lstrcpy(szBuffer, "Press Calculate") ;
|
|||
|
|
|||
|
SetDlgItemText (hwnd, IDC_LSTATUS, szBuffer) ; return FALSE ;
|
|||
|
}
|
|||
|
|
|||
|
/* decode WM_COMMAND messages */
|
|||
|
|
|||
|
switch (LOWORD (wParam))
|
|||
|
|
|||
|
{
|
|||
|
case IDOK :
|
|||
|
|
|||
|
/* refresh input fields */ ReadInputs(hwnd, A10) ; WriteInputs(hwnd, A10) ;
|
|||
|
|
|||
|
//ensure the compositions adds up before proceeding
|
|||
|
|
|||
|
//find the current sum of fractions
|
|||
|
temp = 0.0 ;
|
|||
|
|
|||
|
for (i = 0 ; i < NUMBEROFCOMPONENTS ; i++) temp += A10->adMixture[i] ; if (temp < 0.9999 || temp > 1.0001)
|
|||
|
{
|
|||
|
MessageBox (hwnd,"Error. Composition must total 100%, +/- 0.01%", szAppName, MB_OK | MB_ICONERROR) ;
|
|||
|
|
|||
|
lstrcpy(szBuffer, "Error. Composition <> 100%.") ; SetDlgItemText (hwnd, IDC_LSTATUS, szBuffer) ; return FALSE ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// ensure the pressure is acceptable before proceeding if (A10->dPf < P_MIN || A10->dPf > P_MAX)
|
|||
|
|
|||
|
{
|
|||
|
MessageBox (hwnd,"Error. Pf out of range.", szAppName, MB_OK | MB_ICONERROR) ;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
lstrcpy(szBuffer, "Error. Pf out of range.") ; SetDlgItemText (hwnd, IDC_LSTATUS, szBuffer) ; return FALSE ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// ensure the temperature is acceptable before proceeding if (A10->dTf < T_MIN || A10->dTf > T_MAX)
|
|||
|
|
|||
|
{
|
|||
|
MessageBox (hwnd,"Error. Tf out of range.", szAppName, MB_OK | MB_ICONERROR) ;
|
|||
|
|
|||
|
lstrcpy(szBuffer, "Error. Tf out of range.") ; SetDlgItemText (hwnd, IDC_LSTATUS, szBuffer) ; return FALSE ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/* indicate that a calculation has begun */ lstrcpy(szBuffer, "Calculation In Progress") ; SetDlgItemText (hwnd, IDC_LSTATUS, szBuffer) ;
|
|||
|
|
|||
|
/* run the sound speed AND C* calculation */
|
|||
|
|
|||
|
Crit(A10, 0.0) ;
|
|||
|
|
|||
|
/* write the outputs to the dialog box */ WriteOutputs(hwnd, A10) ;
|
|||
|
|
|||
|
return FALSE ;
|
|||
|
|
|||
|
case IDC_CLEAR :
|
|||
|
|
|||
|
/* zero out the composition and then display it */
|
|||
|
for (i = 0 ; i < NUMBEROFCOMPONENTS ; i++) A10->adMixture[i] = 0.0 ; WriteInputs(hwnd, A10) ;
|
|||
|
return FALSE ;
|
|||
|
|
|||
|
case IDC_NORMALIZE :
|
|||
|
|
|||
|
//normalize the composition to equal 1.0000 ReadInputs(hwnd, A10) ;
|
|||
|
temp = 0.0 ;
|
|||
|
//find the current sum of fractions
|
|||
|
|
|||
|
for (i = 0 ; i < NUMBEROFCOMPONENTS ; i++) temp += A10->adMixture[i] ; // adjust each non-zero entry by the required proportion
|
|||
|
|
|||
|
for (i = 0 ; i < NUMBEROFCOMPONENTS ; i++)
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
if (A10->adMixture[i] > 0.0) A10->adMixture[i] /= temp ; // write the adjusted values to the screen
|
|||
|
|
|||
|
WriteInputs(hwnd, A10) ; return FALSE ;
|
|||
|
|
|||
|
case IDCANCEL :
|
|||
|
|
|||
|
/* start tear-down process */ SendMessage(hwnd, WM_CLOSE, 0,0L) ; return FALSE ;
|
|||
|
|
|||
|
case IDRETRY :
|
|||
|
|
|||
|
//reset the defaults SetDefaults(A10) ;
|
|||
|
|
|||
|
//display the input data to the screen WriteInputs(hwnd, A10) ;
|
|||
|
|
|||
|
//send a message back to this proc, requesting a calculation SendMessage(hwnd, WM_COMMAND, IDOK,0L) ;
|
|||
|
|
|||
|
return FALSE ;
|
|||
|
|
|||
|
case CM_FILEOPEN :
|
|||
|
|
|||
|
// standard Windows file operations
|
|||
|
GetFileTitle (szFileName, szTitleName, sizeof (szTitleName)) ; if (FileOpenDlg (hwnd, szFileName, szTitleName))
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
if (!FileRead (hwnd, szFileName, A10))
|
|||
|
{
|
|||
|
|
|||
|
MessageBox(hwnd,"Could not read file.", szTitleName, MB_OK | MB_ICONSTOP) ;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
else return FALSE ;
|
|||
|
|
|||
|
//Write the new values to the window WriteInputs(hwnd, A10) ;
|
|||
|
|
|||
|
//send a message back to this proc, requesting a calculation SendMessage(hwnd, WM_COMMAND, IDOK,0L) ;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return FALSE ;
|
|||
|
|
|||
|
case CM_FILESAVE :
|
|||
|
|
|||
|
// standard Windows file operations
|
|||
|
GetFileTitle (szFileName, szTitleName, sizeof (szTitleName)) ; if (szFileName[0])
|
|||
|
{
|
|||
|
if (FileWrite(hwnd, szFileName, A10))
|
|||
|
{
|
|||
|
return TRUE ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
MessageBox(hwnd,"Could not write file.", szTitleName, MB_OK | MB_ICONSTOP) ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return FALSE ;
|
|||
|
}
|
|||
|
|
|||
|
// fall through
|
|||
|
|
|||
|
case CM_FILESAVEAS :
|
|||
|
|
|||
|
// standard Windows file operations
|
|||
|
GetFileTitle (szFileName, szTitleName, sizeof (szTitleName)) ; if (FileSaveDlg (hwnd, szFileName, szTitleName))
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
if (FileWrite (hwnd, szFileName, A10))
|
|||
|
{
|
|||
|
return 1 ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
MessageBox(hwnd,"Could not write file.", szTitleName, MB_OK | MB_ICONSTOP) ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
return FALSE ;
|
|||
|
|
|||
|
case CM_HELPABOUT : MessageBox (hwnd,
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
"AGA10win.exe and AGA10.dll (c) American Gas Association, 2002", szAppName, MB_OK | MB_ICONINFORMATION) ;
|
|||
|
|
|||
|
return FALSE ;
|
|||
|
}
|
|||
|
return FALSE ;
|
|||
|
|
|||
|
case WM_CLOSE :
|
|||
|
|
|||
|
/* un-initialize the calculation library */ AGA10_UnInit() ;
|
|||
|
|
|||
|
// remove the AGA10STRUCT object from memory delete A10 ;
|
|||
|
|
|||
|
/* request Windows to terminate the app */ DestroyWindow (hwnd) ;
|
|||
|
|
|||
|
return FALSE ;
|
|||
|
|
|||
|
case WM_DESTROY :
|
|||
|
|
|||
|
/* final message exhange with Windows during shut-down */ PostQuitMessage (0) ;
|
|||
|
|
|||
|
return FALSE ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return DefWindowProc (hwnd, iMsg, wParam, lParam) ;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*************************************************************************
|
|||
|
* File : file.cpp
|
|||
|
* Description : Supports file access to AGA10 functions
|
|||
|
* Author : W.B. Peterson
|
|||
|
* Version : 1.7 2002.11.17
|
|||
|
* Revisions :
|
|||
|
* Copyright (c) 2002 American Gas Association
|
|||
|
**************************************************************************/
|
|||
|
|
|||
|
#include "aga10.h"
|
|||
|
|
|||
|
// declare a Windows-defined structure for file names static OPENFILENAME ofn ;
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
|
|||
|
* Function : FileInitialize()
|
|||
|
* Arguments : HWND
|
|||
|
* Returns : void
|
|||
|
* Purpose : Prepares for Windows file access
|
|||
|
* Revisions :
|
|||
|
**************************************************************************/
|
|||
|
|
|||
|
void FileInitialize (HWND hWnd)
|
|||
|
|
|||
|
{
|
|||
|
/* set file filters; assign the filename extension 'sos' for files of this type */
|
|||
|
|
|||
|
static char szFilter[] = "AGA10 Files (*.sos)\0*.sos\0" ; static char szExt[] = "sos" ;
|
|||
|
|
|||
|
// populate a OPENFILENAME structure
|
|||
|
ofn.lStructSize = sizeof (OPENFILENAME) ;
|
|||
|
ofn.hwndOwner = hWnd ;
|
|||
|
ofn.hInstance = NULL ;
|
|||
|
ofn.lpstrFilter = szFilter ;
|
|||
|
ofn.lpstrCustomFilter = NULL ;
|
|||
|
ofn.nMaxCustFilter = 0 ;
|
|||
|
ofn.nFilterIndex = 0 ;
|
|||
|
ofn.lpstrFile = NULL ;
|
|||
|
ofn.nMaxFile = _MAX_PATH ;
|
|||
|
ofn.lpstrFileTitle = NULL ;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT ;
|
|||
|
ofn.lpstrInitialDir = NULL ;
|
|||
|
ofn.lpstrTitle = NULL ;
|
|||
|
ofn.Flags = 0 ;
|
|||
|
ofn.nFileOffset = 0 ;
|
|||
|
ofn.nFileExtension = 0 ;
|
|||
|
ofn.lpstrDefExt = szExt ;
|
|||
|
ofn.lCustData = 0L ;
|
|||
|
ofn.lpfnHook = NULL ;
|
|||
|
ofn.lpTemplateName = NULL ;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
|
|||
|
* Function : FileOpenDlg()
|
|||
|
* Arguments : HWND, PSTR, PSTR
|
|||
|
* Returns : BOOL
|
|||
|
* Purpose : Access common controls for file-open operation
|
|||
|
* Revisions :
|
|||
|
**************************************************************************/
|
|||
|
|
|||
|
BOOL FileOpenDlg (HWND hWnd, PSTR pstrFileName, PSTR pstrTitleName)
|
|||
|
|
|||
|
{
|
|||
|
ofn.hwndOwner = hWnd ;
|
|||
|
ofn.lpstrFile = pstrFileName ;
|
|||
|
|
|||
|
ofn.lpstrFileTitle = pstrTitleName ;
|
|||
|
|
|||
|
ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT ;
|
|||
|
|
|||
|
return GetOpenFileName (&ofn) ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
|
|||
|
* Function : FileSaveDlg()
|
|||
|
* Arguments : HWND, PSTR, PSTR
|
|||
|
* Returns : BOOL
|
|||
|
* Purpose : Access common controls for file-save operation
|
|||
|
* Revisions :
|
|||
|
**************************************************************************/
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
BOOL FileSaveDlg (HWND hWnd, PSTR pstrFileName, PSTR pstrTitleName)
|
|||
|
|
|||
|
{
|
|||
|
ofn.hwndOwner = hWnd ;
|
|||
|
ofn.lpstrFile = pstrFileName ;
|
|||
|
|
|||
|
ofn.lpstrFileTitle = pstrTitleName ;
|
|||
|
|
|||
|
ofn.Flags = OFN_OVERWRITEPROMPT ;
|
|||
|
|
|||
|
return GetSaveFileName (&ofn) ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
|
|||
|
* Function : FileRead()
|
|||
|
* Arguments : HWND, PSTR, AGA10STRUCT
|
|||
|
* Returns : bool
|
|||
|
* Purpose : Reads contents of a .sos file into a AGA10STRUCT
|
|||
|
* Revisions :
|
|||
|
**************************************************************************/
|
|||
|
|
|||
|
bool FileRead(HWND hWnd, PSTR pstrFileName, AGA10STRUCT *A10)
|
|||
|
|
|||
|
{
|
|||
|
FILE *file ;
|
|||
|
|
|||
|
// open the file in binary mode, if it exists
|
|||
|
|
|||
|
if (NULL == (file = fopen (pstrFileName, "rb"))) return false ;
|
|||
|
|
|||
|
//set file position to beginning rewind(file) ;
|
|||
|
|
|||
|
//read one (only) data structure
|
|||
|
|
|||
|
if (fread(A10, sizeof (AGA10STRUCT), 1, file))
|
|||
|
{
|
|||
|
|
|||
|
fclose (file) ; return true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
// some problem encountered
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
fclose (file) ; return false ;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**************************************************************************
|
|||
|
* Function : FileWrite()
|
|||
|
* Arguments : HWND, PSTR, AGA10STRUCT
|
|||
|
* Returns : bool
|
|||
|
* Purpose : Writes contents of a AGA10STRUCT into a .vos file
|
|||
|
* Revisions :
|
|||
|
**************************************************************************/
|
|||
|
|
|||
|
bool FileWrite(HWND hWnd, PSTR pstrFileName, AGA10STRUCT *A10)
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
FILE *file ;
|
|||
|
|
|||
|
// open the file in binary mode; create if necessary
|
|||
|
|
|||
|
if (NULL == (file = fopen (pstrFileName, "wb"))) return false ;
|
|||
|
|
|||
|
//set file position to beginning rewind(file) ;
|
|||
|
|
|||
|
//write one (only) data structure
|
|||
|
|
|||
|
if (fwrite(A10, sizeof (AGA10STRUCT), 1, file))
|
|||
|
|
|||
|
{
|
|||
|
fclose (file) ; return true;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
// problem encountered; close and return 'false' fclose (file) ;
|
|||
|
|
|||
|
return false ;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*************************************************************************
|
|||
|
* 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 ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// File : resource.h
|
|||
|
// Description : header file used for Windows resource file
|
|||
|
// Version : 1.7 2002.11.17
|
|||
|
// Author : W.B. Peterson
|
|||
|
// Revisions :
|
|||
|
//Copyright (c) 2002 American Gas Association
|
|||
|
|
|||
|
//{{NO_DEPENDENCIES}}
|
|||
|
|
|||
|
//Microsoft Developer Studio generated include file.
|
|||
|
//Used by aga10win.rc
|
|||
|
|
|||
|
//
|
|||
|
|
|||
|
// Next default values for new objects
|
|||
|
//
|
|||
|
#ifdef APSTUDIO_INVOKED
|
|||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
|||
|
#define _APS_NO_MFC 1
|
|||
|
#define _APS_NEXT_RESOURCE_VALUE 105
|
|||
|
#define _APS_NEXT_COMMAND_VALUE 40003
|
|||
|
#define _APS_NEXT_CONTROL_VALUE 1018
|
|||
|
#define _APS_NEXT_SYMED_VALUE 101
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// File : aga10win.rc
|
|||
|
// Description : resource script for aga10win’s interface
|
|||
|
// Version : 1.7 2002.11.17
|
|||
|
// Author : W.B. Peterson
|
|||
|
// Revisions :
|
|||
|
//Copyright (c) 2002 American Gas Association
|
|||
|
|
|||
|
//Microsoft Developer Studio generated resource script.
|
|||
|
|
|||
|
//
|
|||
|
#include "resource.h"
|
|||
|
|
|||
|
#define APSTUDIO_READONLY_SYMBOLS
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
//
|
|||
|
// Generated from the TEXTINCLUDE 2 resource.
|
|||
|
|
|||
|
//
|
|||
|
|
|||
|
#define APSTUDIO_HIDDEN_SYMBOLS #include "windows.h"
|
|||
|
|
|||
|
#undef APSTUDIO_HIDDEN_SYMBOLS #include "aga10win.h"
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
// English (U.S.) resources
|
|||
|
|
|||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32
|
|||
|
|
|||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252)
|
|||
|
#endif //_WIN32
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
//
|
|||
|
|
|||
|
//Icon
|
|||
|
//
|
|||
|
|
|||
|
//Icon with lowest ID value placed first to ensure application icon
|
|||
|
|
|||
|
//remains consistent on all systems.
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
AGA10WIN ICON DISCARDABLE "aga10win.ico"
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
//
|
|||
|
// Dialog
|
|||
|
|
|||
|
//
|
|||
|
|
|||
|
AGA10WIN DIALOGEX 0, 0, 575, 315
|
|||
|
|
|||
|
STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
|||
|
EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT
|
|||
|
|
|||
|
CAPTION "AGA 10 Example Program"
|
|||
|
|
|||
|
MENU IDR_MENU1
|
|||
|
CLASS "aga10win"
|
|||
|
FONT 8, "MS Sans Serif"
|
|||
|
BEGIN
|
|||
|
|
|||
|
EDITTEXT IDC_XIHE,55,15,44,14,ES_AUTOHSCROLL | WS_GROUP
|
|||
|
|
|||
|
EDITTEXT IDC_XIH2,55,33,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XIN2,55,51,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XICO2,55,69,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XIH2S,55,87,44,14,ES_AUTOHSCROLL
|
|||
|
|
|||
|
EDITTEXT IDC_XIC1,55,105,44,14,ES_AUTOHSCROLL
|
|||
|
|
|||
|
EDITTEXT IDC_XIC2,55,123,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XIC3,153,16,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XIIC4,153,34,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XINC4,153,52,44,14,ES_AUTOHSCROLL
|
|||
|
|
|||
|
EDITTEXT IDC_XIIC5,153,70,44,14,ES_AUTOHSCROLL
|
|||
|
|
|||
|
EDITTEXT IDC_XINC5,154,89,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XINC6,154,107,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XINC7,154,125,44,14,ES_AUTOHSCROLL
|
|||
|
|
|||
|
EDITTEXT IDC_XINC8,259,16,44,14,ES_AUTOHSCROLL
|
|||
|
|
|||
|
EDITTEXT IDC_XINC9,259,34,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XINC10,259,52,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XIAR,259,70,44,14,ES_AUTOHSCROLL
|
|||
|
EDITTEXT IDC_XIH2O,259,88,44,14,ES_AUTOHSCROLL
|
|||
|
|
|||
|
EDITTEXT IDC_XICO,259,106,44,14,ES_AUTOHSCROLL
|
|||
|
|
|||
|
EDITTEXT IDC_XIO2,259,124,44,14
|
|||
|
PUSHBUTTON "Clear Mixture",IDC_CLEAR,47,149,60,20
|
|||
|
EDITTEXT IDC_PB,34,196,60,14,ES_AUTOHSCROLL
|
|||
|
COMBOBOX IDC_PB_U,98,197,60,44,CBS_DROPDOWNLIST | CBS_SORT |
|
|||
|
|
|||
|
WS_VSCROLL | WS_TABSTOP
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
EDITTEXT IDC_TB,34,215,60,14,ES_AUTOHSCROLL
|
|||
|
|
|||
|
COMBOBOX IDC_TB_U,98,216,60,44,CBS_DROPDOWNLIST | CBS_SORT |
|
|||
|
WS_VSCROLL | WS_TABSTOP
|
|||
|
EDITTEXT IDC_PF,191,196,60,14,ES_AUTOHSCROLL
|
|||
|
COMBOBOX IDC_PF_U,254,196,60,44,CBS_DROPDOWNLIST | CBS_SORT |
|
|||
|
|
|||
|
WS_VSCROLL | WS_TABSTOP
|
|||
|
|
|||
|
EDITTEXT IDC_TF,191,215,60,14,ES_AUTOHSCROLL
|
|||
|
COMBOBOX IDC_TF_U,255,215,60,44,CBS_DROPDOWNLIST | CBS_SORT |
|
|||
|
WS_VSCROLL | WS_TABSTOP
|
|||
|
DEFPUSHBUTTON "Calculate",IDOK,137,282,50,20
|
|||
|
|
|||
|
PUSHBUTTON "Initialize",IDRETRY,61,282,50,20
|
|||
|
|
|||
|
PUSHBUTTON "Quit",IDCANCEL,213,282,50,20,WS_GROUP
|
|||
|
GROUPBOX "Composition (Mole Percent)",IDC_STATIC,5,3,322,175
|
|||
|
LTEXT "Helium",IDC_STATIC,21,18,28,8,NOT WS_GROUP
|
|||
|
LTEXT "Hydrogen",IDC_STATIC,21,36,32,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "Nitrogen",IDC_STATIC,21,55,28,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "CO2",IDC_STATIC,22,71,15,8,NOT WS_GROUP
|
|||
|
LTEXT "H2S",IDC_STATIC,22,89,15,8,NOT WS_GROUP
|
|||
|
LTEXT "Methane",IDC_STATIC,22,108,29,8,NOT WS_GROUP
|
|||
|
LTEXT "Ethane",IDC_STATIC,22,126,24,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "Propane",IDC_STATIC,116,18,28,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "i-Butane",IDC_STATIC,116,37,27,8,NOT WS_GROUP
|
|||
|
LTEXT "n-Butane",IDC_STATIC,116,55,30,8,NOT WS_GROUP
|
|||
|
LTEXT "i-Pentane",IDC_STATIC,116,72,31,8,NOT WS_GROUP
|
|||
|
LTEXT "n-Pentane",IDC_STATIC,115,92,34,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "n-Hexane",IDC_STATIC,115,110,32,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "n-Heptane",IDC_STATIC,115,128,34,8,NOT WS_GROUP
|
|||
|
LTEXT "n-Octane",IDC_STATIC,218,19,30,8,NOT WS_GROUP
|
|||
|
LTEXT "n-Nonane",IDC_STATIC,218,37,32,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "n-Decane",IDC_STATIC,218,55,32,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "Argon",IDC_STATIC,219,73,27,8,NOT WS_GROUP
|
|||
|
LTEXT "Water",IDC_STATIC,219,91,23,8,NOT WS_GROUP
|
|||
|
LTEXT "CO",IDC_STATIC,219,109,11,8,NOT WS_GROUP
|
|||
|
LTEXT "O2",IDC_STATIC,219,128,24,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "TOTAL",IDC_STATIC,218,147,24,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "Static",IDC_TOTAL,259,146,44,12,SS_SUNKEN | NOT
|
|||
|
WS_GROUP
|
|||
|
GROUPBOX "Gas Temperature and Absolute Pressure",IDC_STATIC,6,182,
|
|||
|
322,56
|
|||
|
|
|||
|
LTEXT "Pb",IDC_STATIC,12,199,10,8
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
LTEXT "Tb",IDC_STATIC,11,217,10,8
|
|||
|
|
|||
|
LTEXT "Pf",IDC_STATIC,177,199,8,8
|
|||
|
LTEXT "Tf",IDC_STATIC,176,217,8,8
|
|||
|
GROUPBOX "Calculation Results",IDC_STATIC,334,3,234,306
|
|||
|
LTEXT "Speed of Sound",IDC_STATIC,348,24,52,8
|
|||
|
|
|||
|
LTEXT "Zf",IDC_STATIC,348,173,8,8
|
|||
|
|
|||
|
LTEXT "Zb",IDC_STATIC,348,158,10,8
|
|||
|
LTEXT "Fpv",IDC_STATIC,348,187,13,8
|
|||
|
LTEXT "Cp (real gas)",IDC_STATIC,348,232,40,8
|
|||
|
LTEXT "Cv (real gas)",IDC_STATIC,348,248,40,8
|
|||
|
|
|||
|
LTEXT "Cp/Cv",IDC_STATIC,348,264,22,8
|
|||
|
|
|||
|
LTEXT "Isentropic Exponent",IDC_STATIC,348,53,67,8
|
|||
|
LTEXT "Mass Density",IDC_STATIC,348,113,43,8
|
|||
|
LTEXT "Molar Density",IDC_STATIC,348,98,44,8
|
|||
|
LTEXT "Specific Enthalpy",IDC_STATIC,348,68,56,8
|
|||
|
|
|||
|
LTEXT "Specific Entropy",IDC_STATIC,348,83,52,8
|
|||
|
|
|||
|
LTEXT "Enthalpy (ideal gas)",IDC_STATIC,348,280,62,8
|
|||
|
LTEXT "Cp (ideal gas)",IDC_STATIC,348,216,44,8
|
|||
|
LTEXT "Molar Mass",IDC_STATIC,348,201,37,8
|
|||
|
LTEXT "0",IDC_SOS,422,24,50,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "0",IDC_H,422,69,50,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "0",IDC_S,422,83,50,8,NOT WS_GROUP
|
|||
|
LTEXT "0",IDC_DF,422,99,60,8,NOT WS_GROUP
|
|||
|
LTEXT "0",IDC_RHOF,422,113,55,8,NOT WS_GROUP
|
|||
|
LTEXT "0",IDC_ZB,422,157,50,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "0",IDC_ZF,422,171,50,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "0",IDC_FPV,422,186,50,8,NOT WS_GROUP
|
|||
|
LTEXT "0",IDC_MRX,422,201,50,8,NOT WS_GROUP
|
|||
|
LTEXT "0",IDC_CPI,422,216,50,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "0",IDC_HO,422,280,50,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "0",IDC_CP,422,232,50,8,NOT WS_GROUP
|
|||
|
LTEXT "0",IDC_CV,422,248,50,8,NOT WS_GROUP
|
|||
|
LTEXT "0",IDC_K,422,264,50,8,NOT WS_GROUP
|
|||
|
LTEXT "0",IDC_KAPPA,422,53,50,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "moles/dm3",IDC_STATIC,483,98,32,8
|
|||
|
|
|||
|
LTEXT "kJ/kg-K",IDC_STATIC,483,216,26,8
|
|||
|
LTEXT "kJ/kg",IDC_STATIC,483,280,20,8
|
|||
|
LTEXT "RD (ideal gas)",IDC_STATIC,348,128,46,8
|
|||
|
LTEXT "RD (real gas)",IDC_STATIC,348,143,42,8
|
|||
|
|
|||
|
LTEXT "0",IDC_RD_IDEAL,422,128,50,8,NOT WS_GROUP
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
LTEXT "0",IDC_RD_REAL,422,143,50,8,NOT WS_GROUP
|
|||
|
|
|||
|
LTEXT "Press Initialize Button to Begin",IDC_LSTATUS,106,259,
|
|||
|
107,8
|
|||
|
LTEXT "kJ/kg-K",IDC_STATIC,483,232,26,8
|
|||
|
LTEXT "kJ/kg-K",IDC_STATIC,483,248,26,8
|
|||
|
|
|||
|
LTEXT "C*",IDC_STATIC,348,39,10,8
|
|||
|
|
|||
|
LTEXT "0",IDC_CSTAR,422,39,58,8
|
|||
|
COMBOBOX IDC_SOS_U,482,21,80,43,CBS_DROPDOWNLIST | CBS_SORT |
|
|||
|
WS_VSCROLL | WS_TABSTOP
|
|||
|
COMBOBOX IDC_RHOF_U,482,111,80,44,CBS_DROPDOWNLIST | CBS_SORT |
|
|||
|
|
|||
|
WS_VSCROLL | WS_TABSTOP
|
|||
|
|
|||
|
COMBOBOX IDC_ENTHALPY_U,482,66,80,40,CBS_DROPDOWNLIST | CBS_SORT |
|
|||
|
WS_VSCROLL | WS_TABSTOP
|
|||
|
COMBOBOX IDC_ENTROPY_U,482,82,80,37,CBS_DROPDOWNLIST | CBS_SORT |
|
|||
|
WS_VSCROLL | WS_TABSTOP
|
|||
|
|
|||
|
GROUPBOX "Current Status",IDC_STATIC,5,247,322,27
|
|||
|
|
|||
|
PUSHBUTTON "Normalize",IDC_NORMALIZE,118,149,60,20
|
|||
|
END
|
|||
|
|
|||
|
|
|||
|
#ifdef APSTUDIO_INVOKED
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
//
|
|||
|
// TEXTINCLUDE
|
|||
|
//
|
|||
|
|
|||
|
1 TEXTINCLUDE DISCARDABLE
|
|||
|
|
|||
|
BEGIN "resource.h\0"
|
|||
|
|
|||
|
END
|
|||
|
|
|||
|
2 TEXTINCLUDE DISCARDABLE
|
|||
|
|
|||
|
BEGIN
|
|||
|
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n" "#include ""windows.h""\r\n"
|
|||
|
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" "#include ""aga10win.h""\r\n"
|
|||
|
"\0"
|
|||
|
END
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
3 TEXTINCLUDE DISCARDABLE
|
|||
|
|
|||
|
BEGIN "\r\n" "\0"
|
|||
|
|
|||
|
END
|
|||
|
|
|||
|
#endif // APSTUDIO_INVOKED
|
|||
|
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
//
|
|||
|
|
|||
|
// DESIGNINFO
|
|||
|
//
|
|||
|
|
|||
|
#ifdef APSTUDIO_INVOKED
|
|||
|
|
|||
|
GUIDELINES DESIGNINFO DISCARDABLE
|
|||
|
|
|||
|
BEGIN
|
|||
|
"AGA10WIN", DIALOG
|
|||
|
BEGIN
|
|||
|
|
|||
|
LEFTMARGIN, 5 RIGHTMARGIN, 568 BOTTOMMARGIN, 309
|
|||
|
END
|
|||
|
END
|
|||
|
#endif // APSTUDIO_INVOKED
|
|||
|
|
|||
|
|
|||
|
#ifndef _MAC
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
//
|
|||
|
|
|||
|
// Version
|
|||
|
//
|
|||
|
|
|||
|
VS_VERSION_INFO VERSIONINFO FILEVERSION 1,7,0,0 PRODUCTVERSION 1,7,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG
|
|||
|
|
|||
|
FILEFLAGS 0x21L #else
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
FILEFLAGS 0x20L #endif
|
|||
|
|
|||
|
FILEOS 0x40004L
|
|||
|
FILETYPE 0x1L FILESUBTYPE 0x0L
|
|||
|
|
|||
|
BEGIN
|
|||
|
|
|||
|
BLOCK "StringFileInfo"
|
|||
|
BEGIN
|
|||
|
BLOCK "040904b0"
|
|||
|
BEGIN
|
|||
|
|
|||
|
VALUE "Comments", "Post Ballot Version\0"
|
|||
|
|
|||
|
VALUE "CompanyName", "American Gas Association\0" VALUE "FileDescription", "aga10win\0"
|
|||
|
VALUE "FileVersion", "1, 7, 0, 0\0"
|
|||
|
VALUE "InternalName", "aga10win\0"
|
|||
|
|
|||
|
VALUE "LegalCopyright", "Copyright © 2002 American Gas Association\0" VALUE "LegalTrademarks", "\0"
|
|||
|
|
|||
|
VALUE "OriginalFilename", "aga10win.exe\0" VALUE "PrivateBuild", "\0"
|
|||
|
|
|||
|
VALUE "ProductName", "aga10win\0" VALUE "ProductVersion", "1, 7, 0, 0\0"
|
|||
|
VALUE "SpecialBuild", "2002.11.17 Build\0"
|
|||
|
END
|
|||
|
END
|
|||
|
BLOCK "VarFileInfo"
|
|||
|
BEGIN
|
|||
|
|
|||
|
VALUE "Translation", 0x409, 1200
|
|||
|
END
|
|||
|
END
|
|||
|
|
|||
|
#endif // !_MAC
|
|||
|
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
//
|
|||
|
|
|||
|
// Menu
|
|||
|
//
|
|||
|
|
|||
|
IDR_MENU1 MENU DISCARDABLE
|
|||
|
|
|||
|
BEGIN
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
POPUP "&File"
|
|||
|
|
|||
|
BEGIN
|
|||
|
MENUITEM "&Open...", CM_FILEOPEN
|
|||
|
MENUITEM "&Save...", CM_FILESAVE
|
|||
|
MENUITEM "Save &As...", CM_FILESAVEAS
|
|||
|
|
|||
|
MENUITEM "E&xit", IDCANCEL
|
|||
|
|
|||
|
END
|
|||
|
POPUP "&Help"
|
|||
|
BEGIN
|
|||
|
MENUITEM "&About", CM_HELPABOUT
|
|||
|
|
|||
|
END
|
|||
|
|
|||
|
END
|
|||
|
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
//
|
|||
|
|
|||
|
// String Table
|
|||
|
//
|
|||
|
|
|||
|
STRINGTABLE DISCARDABLE
|
|||
|
|
|||
|
BEGIN
|
|||
|
|
|||
|
KILOPASCAL "kilopascals"
|
|||
|
MEGAPASCAL "megapascals"
|
|||
|
END
|
|||
|
|
|||
|
STRINGTABLE DISCARDABLE
|
|||
|
|
|||
|
BEGIN
|
|||
|
PSI "PSI"
|
|||
|
KELVIN "Kelvin"
|
|||
|
|
|||
|
CELSIUS "Celsius"
|
|||
|
|
|||
|
RANKINE "Rankine"
|
|||
|
FAHRENHEIT "Fahrenheit"
|
|||
|
KGPERCUBICMETRE "kg per cubic metre"
|
|||
|
LBMPERCUBICFOOT "lbm per cubic foot"
|
|||
|
|
|||
|
METREPERSECOND "metres per second"
|
|||
|
|
|||
|
FOOTPERSECOND "feet per second"
|
|||
|
KJPERKG "kJ per kg"
|
|||
|
BTUPERLBM "Btu per lbm"
|
|||
|
KJPERKGK "kJ per kg-K"
|
|||
|
|
|||
|
BTUPERLBMF "Btu per lbm-F"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
END
|
|||
|
|
|||
|
#endif // English (U.S.) resources
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#ifndef APSTUDIO_INVOKED
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
//
|
|||
|
|
|||
|
// Generated from the TEXTINCLUDE 3 resource.
|
|||
|
|
|||
|
//
|
|||
|
|
|||
|
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
#endif // not APSTUDIO_INVOKED
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|