📄 压水堆热工水力设计dlg.cpp
字号:
// 压水堆热工水力设计Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "压水堆热工水力设计.h"
#include "压水堆热工水力设计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;//堆芯高度初值设定。
//}}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
// 进行列表控件及组合框的最初设计。
m_list.InsertColumn(1,"数值",LVCFMT_LEFT,175,0);
m_list.InsertColumn(0,"参数名",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;
}
//以下为程序的计算功能体现部分。
void CMyDlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_edit2.SetSel(0,-1);
m_edit2.ReplaceSel("程序开始运行,请耐心等待结果的输出··");//开始计算。
//取组合框中的工况选择
int nCurSel1=m_combo1.GetCurSel(),
nCurSel3=m_combo3.GetCurSel(),
nCurSel4=m_combo4.GetCurSel();
//定义各参数变量
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,//堆芯发热份额
Tcl,//组件的边长
Def,//堆芯当量直径
Acl,//组件内冷却剂的有效流通截面积
Wt=47682e+3,//堆冷却剂的总流量
y1=0.09,//旁流系数
Gm,//平均管的平均质量流量
detz;//步长
int gonglv,//功率标记
pailie,//元件排列标记
fenbu,//中子通量分布标记
jiedian,//节点标记
nu;//组件内元件根数
//不同工况选择
switch(nCurSel1){//功率水平的选择,确定功率水平及功率水平标记
case 0://100%时
y=1;
gonglv=0;
break;
case 1://118%时
y=1.18;
gonglv=1;
break;
}
switch(nCurSel3){//元件排列选择并计算组件内的元件个数,组件边长,确定元件排列标记
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],//节点处中子通量分布
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};//结尾余弦通量分布
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){//对中子通量分布的选择并根据此计算步长,确定分布标记及节点个数。
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],//隔架与哪个相近,数组元素为该节点号
gejia[20];//隔架在某步长内标记,步长内有隔架数组元素为1,没有为0
for(int i6=0;i6<8;i6++){ //计算隔架的位置
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++){//确定隔架在那个步长内
for(int i0=0;i0<8;i0++){
if(i7==jihao[i0]){
gejia[i7]=1;
break;}
else
gejia[i7]=0;
}
}
//堆芯基本参数计算
long Ncl,//初始组件个数
yushu,//初始组件个数除以4的余数
ncl,//最终组件个数,满足4n+1条件
N;//初始元件个数
Nt=Ne/g;//求堆芯额定功率
N=(long)(Nt*Fu/(Pi*dcs*L*q0))+1;//求初始元件个数,不够一根的,补上
Ncl=(int)(N/nu)+1;//求初始组件个数,不够一组的,补足一组。
yushu=Ncl%4;//求初始组件个数除以4的余数
if(yushu==0)//余数为0,组件个数为初始个数加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);//求堆芯当量直径
//验证堆芯高度与当量直径的比值在合理的范围内。
if(L/Def>1.5||L/Def<0.9){//不在比值范围内,要重新设定
MessageBox("堆芯高度设置不合理,请重新设定。");
}
else{//在范围内往下计算
//平均管温度场的计算
Acl=Tcl*Tcl-(nu+25)*Pi*dcs*dcs/4+0.00102*Tcl+(Tcl+0.00102)*0.00102;//求冷却剂有效流通截面积
Gm=(1-y1)*Wt/(3600*ncl*Acl);//求平均质量流量
double t=286,//冷却剂的入口温度
P=1.55e+4,//冷却剂的定性压力
q=Nt*Fu*y/(ncl*nu*Pi*dcs*L),//重新计算后的平均质量流量
Ab=Acl/(nu+25);//每根元件所占的冷却剂的截面积
double at1=(-1.595538e-4)*P+1.01,//焓温转换常数
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],//平均管各节点的焓值
tfm[21];//平均管的各节点温度值
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++){//计算各节点的焓值并转换为温度值
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],//锆表面内侧温度
tcim[21],//元件内表面温度
tum[21],//燃料芯块外表面温度
tom[21];//芯块中心温度
double de=4*(0.0126*0.0126-Pi*dcs*dcs/4)/(Pi*dcs),//水力当量直径
dci=dcs-2*0.00057,//元件包壳内径
Ka=1.3975e-2,//计算锆合金的系数
Kb=9.846e-6,
du=0.00819,//芯块外径
hg=5.678,//间隙等效传热系数
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -