?? 壓水堆熱工水力設(shè)計(jì)dlg.cpp
字號:
// 壓水堆熱工水力設(shè)計(jì)Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "壓水堆熱工水力設(shè)計(jì).h"
#include "壓水堆熱工水力設(shè)計(jì)Dlg.h"
#include "math.h"
#include "string.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg dialog
CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyDlg)
m_edit1 = 3.658;//堆芯高度初值設(shè)定。
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyDlg)
DDX_Control(pDX, IDC_EDIT2, m_edit2);
DDX_Control(pDX, IDC_COMBO4, m_combo4);
DDX_Control(pDX, IDC_COMBO3, m_combo3);
DDX_Control(pDX, IDC_COMBO1, m_combo1);
DDX_Control(pDX, IDC_LIST1, m_list);
DDX_Text(pDX, IDC_EDIT1, m_edit1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
//{{AFX_MSG_MAP(CMyDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg message handlers
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// 進(jìn)行列表控件及組合框的最初設(shè)計(jì)。
m_list.InsertColumn(1,"數(shù)值",LVCFMT_LEFT,175,0);
m_list.InsertColumn(0,"參數(shù)名",LVCFMT_LEFT,290,0);
m_list.SetExtendedStyle(LVS_EX_GRIDLINES);
m_combo1.SetCurSel(0);
m_combo3.SetCurSel(0);
m_combo4.SetCurSel(3);
return TRUE; // return TRUE unless you set the focus to a control
}
void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMyDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMyDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
//以下為程序的計(jì)算功能體現(xiàn)部分。
void CMyDlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_edit2.SetSel(0,-1);
m_edit2.ReplaceSel("程序開始運(yùn)行,請耐心等待結(jié)果的輸出··");//開始計(jì)算。
//取組合框中的工況選擇
int nCurSel1=m_combo1.GetCurSel(),
nCurSel3=m_combo3.GetCurSel(),
nCurSel4=m_combo4.GetCurSel();
//定義各參數(shù)變量
double L=m_edit1;//取堆芯高度
double Ne=9.25e+5,//電站的凈電功率。
y,//功率水平
g=0.3333,//凈效率
Nt,//堆芯額定功率
q0=600,//假定的熱流密度
Le=L+2*0.1,//堆芯的外推高度
dcs=9.5e-3,//元件的包殼外徑
Pi=3.1415926,//圓周率
Fu=0.974,//堆芯發(fā)熱份額
Tcl,//組件的邊長
Def,//堆芯當(dāng)量直徑
Acl,//組件內(nèi)冷卻劑的有效流通截面積
Wt=47682e+3,//堆冷卻劑的總流量
y1=0.09,//旁流系數(shù)
Gm,//平均管的平均質(zhì)量流量
detz;//步長
int gonglv,//功率標(biāo)記
pailie,//元件排列標(biāo)記
fenbu,//中子通量分布標(biāo)記
jiedian,//節(jié)點(diǎn)標(biāo)記
nu;//組件內(nèi)元件根數(shù)
//不同工況選擇
switch(nCurSel1){//功率水平的選擇,確定功率水平及功率水平標(biāo)記
case 0://100%時
y=1;
gonglv=0;
break;
case 1://118%時
y=1.18;
gonglv=1;
break;
}
switch(nCurSel3){//元件排列選擇并計(jì)算組件內(nèi)的元件個數(shù),組件邊長,確定元件排列標(biāo)記
case 0://15*15
nu=15*15-25;
Tcl=15*0.0126;
pailie=0;
break;
case 1://17*17
nu=17*17-25;
Tcl=17*0.0126;
pailie=1;
break;
case 2://18*18
nu=18*18-25;
Tcl=18*0.0126;
pailie=2;
break;
}
double shuzu[20],//步長中間中子通量分布
shuzu0[21],//節(jié)點(diǎn)處中子通量分布
weizhi[8];//隔架位置(距離入口的長度)
double shuzu1[20]={0.12,0.37,0.60,0.82,1.02,1.19,1.34,1.45,1.53,1.57,1.57,1.53,1.45,1.34,1.19,1.02,0.82,0.60,0.37,0.12};//結(jié)尾余弦通量分布
double shuzu2[20]={1.473,1.914,2.159,2.053,1.730,1.461,1.100,0.727,0.490,0.332,0.222,0.146,0.090,0.052,0,0,0,0,0,0};//壽期初通量分布
double shuzu3[20]={1.166,1.646,1.773,1.748,1.621,1.370,1.136,0.893,0.728,0.599,0.488,0.381,0.274,0.177,0,0,0,0,0,0};//壽期中通量分布
double shuzu4[20]={0.198,0.267,0.323,0.375,0.482,0.654,0.877,1.140,1.371,1.635,1.850,1.906,1.682,1.239,0,0,0,0,0,0};//壽期末通量分布
switch(nCurSel4){//對中子通量分布的選擇并根據(jù)此計(jì)算步長,確定分布標(biāo)記及節(jié)點(diǎn)個數(shù)。
case 0:
memcpy(shuzu,shuzu1,20*sizeof(shuzu[0]));
detz=L*0.05;
fenbu=0;
jiedian=21;
break;
case 1:
memcpy(shuzu,shuzu2,20*sizeof(shuzu[0]));
detz=L*10/140;
fenbu=1;
jiedian=15;
break;
case 2:
memcpy(shuzu,shuzu4,20*sizeof(shuzu[0]));
detz=L*10/140;
fenbu=2;
jiedian=15;
break;
case 3:
memcpy(shuzu,shuzu3,20*sizeof(shuzu[0]));
detz=L*10/140;
fenbu=3;
jiedian=15;
break;
}
int jihao[8],//隔架與哪個相近,數(shù)組元素為該節(jié)點(diǎn)號
gejia[20];//隔架在某步長內(nèi)標(biāo)記,步長內(nèi)有隔架數(shù)組元素為1,沒有為0
for(int i6=0;i6<8;i6++){ //計(jì)算隔架的位置
weizhi[i6]=L*((3851.4-7*536.3)/2+i6*536.3)/3851.4;
jihao[i6]=(int)(weizhi[i6]/detz);
}
for(int i7=0;i7<20;i7++){//確定隔架在那個步長內(nèi)
for(int i0=0;i0<8;i0++){
if(i7==jihao[i0]){
gejia[i7]=1;
break;}
else
gejia[i7]=0;
}
}
//堆芯基本參數(shù)計(jì)算
long Ncl,//初始組件個數(shù)
yushu,//初始組件個數(shù)除以4的余數(shù)
ncl,//最終組件個數(shù),滿足4n+1條件
N;//初始元件個數(shù)
Nt=Ne/g;//求堆芯額定功率
N=(long)(Nt*Fu/(Pi*dcs*L*q0))+1;//求初始元件個數(shù),不夠一根的,補(bǔ)上
Ncl=(int)(N/nu)+1;//求初始組件個數(shù),不夠一組的,補(bǔ)足一組。
yushu=Ncl%4;//求初始組件個數(shù)除以4的余數(shù)
if(yushu==0)//余數(shù)為0,組件個數(shù)為初始個數(shù)加1
ncl=Ncl+1+4*4;
else if(yushu==1)//為1,不加
ncl=Ncl+4*3;
else if(yushu==2)//為2,加3
ncl=Ncl+3+4*4;
else //為3,加2
ncl=Ncl+2+4*4;
Def=sqrt(ncl*Tcl*Tcl*4/Pi);//求堆芯當(dāng)量直徑
//驗(yàn)證堆芯高度與當(dāng)量直徑的比值在合理的范圍內(nèi)。
if(L/Def>1.5||L/Def<0.9){//不在比值范圍內(nèi),要重新設(shè)定
MessageBox("堆芯高度設(shè)置不合理,請重新設(shè)定。");
}
else{//在范圍內(nèi)往下計(jì)算
//平均管溫度場的計(jì)算
Acl=Tcl*Tcl-(nu+25)*Pi*dcs*dcs/4+0.00102*Tcl+(Tcl+0.00102)*0.00102;//求冷卻劑有效流通截面積
Gm=(1-y1)*Wt/(3600*ncl*Acl);//求平均質(zhì)量流量
double t=286,//冷卻劑的入口溫度
P=1.55e+4,//冷卻劑的定性壓力
q=Nt*Fu*y/(ncl*nu*Pi*dcs*L),//重新計(jì)算后的平均質(zhì)量流量
Ab=Acl/(nu+25);//每根元件所占的冷卻劑的截面積
double at1=(-1.595538e-4)*P+1.01,//焓溫轉(zhuǎn)換常數(shù)
at2=(-5.19677e-7)*P+0.239491,
at3=(1.20638e-9)*P+(5.96602e-6),
at4=-1.02*((5.48789e-13)*P+1.31469e-8);
double Hfm[21],//平均管各節(jié)點(diǎn)的焓值
tfm[21];//平均管的各節(jié)點(diǎn)溫度值
tfm[0]=t;//給定入口溫度
Hfm[0]=(-2.182662e+2)+5.190077*t-(2.384186e-7)*t*t-(5.601945e-10)*t*t*t-(9.684937e-13)*t*t*t*t;//入口焓值
for(int j=0;j<20;j++){//計(jì)算各節(jié)點(diǎn)的焓值并轉(zhuǎn)換為溫度值
Hfm[j+1]=Hfm[j]+detz*Pi*dcs*q*shuzu[j]/(Gm*Fu*Ab);
tfm[j+1]=at1+at2*Hfm[j+1]+at3*Hfm[j+1]*Hfm[j+1]+at4*Hfm[j+1]*Hfm[j+1]*Hfm[j+1];
}
//燃料元件溫度場
double tcsm1[21],//元件包殼表面溫度1
tcsm2[21],//元件表面溫度2
tcsm[21],//最終元件表面溫度
tzrm[21],//鋯表面內(nèi)側(cè)溫度
tcim[21],//元件內(nèi)表面溫度
tum[21],//燃料芯塊外表面溫度
tom[21];//芯塊中心溫度
double de=4*(0.0126*0.0126-Pi*dcs*dcs/4)/(Pi*dcs),//水力當(dāng)量直徑
dci=dcs-2*0.00057,//元件包殼內(nèi)徑
Ka=1.3975e-2,//計(jì)算鋯合金的系數(shù)
Kb=9.846e-6,
du=0.00819,//芯塊外徑
hg=5.678,//間隙等效傳熱系數(shù)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -