1539 lines
54 KiB
C++
1539 lines
54 KiB
C++
// HydrantCalcDlg.cpp : implementation file
|
||
//
|
||
/********************************************************************
|
||
Copyright, 北京上华工程软件有限公司 All rights reserved.
|
||
created: 2005/01/31
|
||
filename: f:\tg_dev\telecdev\twtkernal\HydrantCalcDlg.cpp
|
||
author: 沈睿
|
||
当前版本: 6.5
|
||
purpose: 消火栓水力计算
|
||
*********************************************************************/
|
||
|
||
|
||
#include "stdafx.h"
|
||
#include "HydrantCalcDlg.h"
|
||
#include <MSWORD8.h>
|
||
#include "DbEquipment.h"
|
||
#include "algorithm"
|
||
#include "TWordFormulasTemplet.h"
|
||
#include "twtdef.h"
|
||
#include "HydrantCalcDataDlg.h"
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
extern SSearchPipeList *GetNextDimNode(SSearchPipeList *pListAll, SSearchPipeList *pDisadvantage);
|
||
extern int DoSerialNumber(SSearchPipeList *pListLast, int idx, BOOL IsMainNode);
|
||
//extern void DoDimPipeSerialNumber(SSearchPipeList *pListAll);
|
||
extern void CalcSprinkNum(SSearchPipeList *pListAll);
|
||
extern SSearchPipeList *GetNextCalcNode(SSearchPipeList *pListAll, SSearchPipeList *pDisadvantage);
|
||
extern double GetDangLenByElbow90(int iDn1, int iDn2); //90度弯头当量长度
|
||
extern double GetDangLenByTaiIn(int iDn1, int iDn2); //接头当量长度
|
||
extern double GetDangLenByCorner(int iDn); //3通4通当量长度
|
||
extern SSearchPipeList *GetNextExportNode(SSearchPipeList *pListAll, SSearchPipeList *pDisadvantage);
|
||
|
||
//***************************************************************************************************
|
||
// 消防计算
|
||
//***************************************************************************************************
|
||
// 根据计算内径(最大),得到标准3通90度转角流 当量
|
||
// 2003 <<给排水设计规范>> P106
|
||
double GetDangBy3Corner90(double nDn)
|
||
{
|
||
nDn = nDn - 0.0001;
|
||
if(nDn < 9.5)
|
||
return 0.5;
|
||
else if(nDn < 12.7)
|
||
return 0.9;
|
||
else if(nDn < 19.1)
|
||
return 1.2;
|
||
else if(nDn < 25.4)
|
||
return 1.5;
|
||
else if(nDn < 31.8)
|
||
return 1.8;
|
||
else if(nDn < 38.1)
|
||
return 2.1;
|
||
else if(nDn < 50.8)
|
||
return 3.0;
|
||
else if(nDn < 63.5)
|
||
return 3.6;
|
||
else if(nDn < 76.2)
|
||
return 4.6;
|
||
else if(nDn < 101.6)
|
||
return 6.4;
|
||
else if(nDn < 127)
|
||
return 7.6;
|
||
else
|
||
return 9.1;
|
||
}
|
||
|
||
// 根据计算内径(最大),得到3通直向流 当量
|
||
double GetDangBy3CornerLine(double nDn)
|
||
{
|
||
nDn = nDn - 0.0001;
|
||
if(nDn < 9.5)
|
||
return 0.1;
|
||
else if(nDn < 12.7)
|
||
return 0.2;
|
||
else if(nDn < 19.1)
|
||
return 0.2;
|
||
else if(nDn < 25.4)
|
||
return 0.3;
|
||
else if(nDn < 31.8)
|
||
return 0.4;
|
||
else if(nDn < 38.1)
|
||
return 0.5;
|
||
else if(nDn < 50.8)
|
||
return 0.6;
|
||
else if(nDn < 63.5)
|
||
return 0.8;
|
||
else if(nDn < 76.2)
|
||
return 0.9;
|
||
else if(nDn < 101.6)
|
||
return 1.2;
|
||
else if(nDn < 127)
|
||
return 1.5;
|
||
else
|
||
return 1.8;
|
||
}
|
||
|
||
|
||
//已知一根水管,得到它的计算内径
|
||
double GetPipeDjById(AcDbObjectId id1, int &iDn)
|
||
{
|
||
double nDn(0);
|
||
OPENOBJ_BEGIN(id1, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe){
|
||
iDn = (int)pPipe->GetDnDiameter(); //本段管线管径
|
||
int iMat = pPipe->GetMaterial();
|
||
CString csMat = GetPipeMaterialByIdx(iMat);
|
||
nDn = GetPipeDjByDn(csMat, iDn) * 1000;
|
||
}
|
||
OPENOBJ_END();
|
||
return nDn;
|
||
}
|
||
|
||
//已知两根水管,得到节点当量
|
||
double GetDangBy2Pipe(AcDbObjectId id1, AcDbObjectId id2)
|
||
{
|
||
if(id1 == NULL || id2 == NULL)
|
||
return 0;
|
||
double nDn1(0), nDn2(0), nDn3(0), nDang(0);
|
||
int iDn1(0), iDn2(0), iDn3(0);
|
||
nDn1 = GetPipeDjById(id1, iDn1);
|
||
nDn2 = GetPipeDjById(id2, iDn2);
|
||
if(Is2PipeParallel(id1, id2)) //前后管是否平行
|
||
nDang = GetDangLenByTaiIn(iDn1, iDn2); //根据接头查当量长度
|
||
else
|
||
nDang = GetDangLenByElbow90(iDn1, iDn2);//根据弯头查当量长度
|
||
|
||
return nDang;
|
||
}
|
||
|
||
//已知三根水管,得到节点当量
|
||
//BOOL bIsLine 是否仅直流,虽然是3通,但旁管不流水
|
||
double GetDangBy3Pipe(AcDbObjectId id1, AcDbObjectId id2, AcDbObjectId id3, BOOL bIsLine)
|
||
{
|
||
if(id1 == NULL || id2 == NULL || id3 == NULL)
|
||
return 0;
|
||
double nDn1(0), nDn2(0), nDn3(0), nDang(0), nBig(0);
|
||
int iDn1(0), iDn2(0), iDn3(0);
|
||
nDn1 = GetPipeDjById(id1, iDn1);
|
||
nDn2 = GetPipeDjById(id2, iDn2);
|
||
nDn3 = GetPipeDjById(id3, iDn3);
|
||
if(nDn1 > nDn2)
|
||
nBig = nDn1;
|
||
else
|
||
nBig = nDn2;
|
||
if(nBig < nDn3)
|
||
nBig = nDn3;
|
||
|
||
nDang = GetDangBy3CornerLine(nBig);
|
||
if(!bIsLine)
|
||
nDang += GetDangBy3Corner90(nBig);
|
||
|
||
return nDang;
|
||
}
|
||
|
||
//得到末端(非最不利点)消火栓喷头压力
|
||
//计算原理:
|
||
//1 得到交叉节点的压力 = 最不利点压力 + 高差 + 损失
|
||
//2 得到从本末端到交叉节点的损失
|
||
//3 为了保证交叉节点压力不变, 得到末端压力 = 交叉节点压力 - 本段损失 ( 1-2 )
|
||
double GetTerminalNodePress(SSearchPipeList *pListLast)
|
||
{
|
||
if(pListLast == NULL)
|
||
return 0;
|
||
double nRet(0);
|
||
AcDbObjectId id = NULL;
|
||
id = pListLast->m_ID;
|
||
BOOL bIsCornerNode = FALSE; //本变量记录该交叉节点计算条件不成熟
|
||
if(pListLast->m_iType == 0){
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe){
|
||
if(pListLast->m_lstNode.Length() == 1){
|
||
SSearchPipeList *pList = pListLast->m_lstNode[0]; //得到后节点
|
||
double nStartPress(0);
|
||
if(pListLast->m_pPrevious){
|
||
SSearchPipeList *pListFrontNode = pListLast->m_pPrevious; //得到前节点
|
||
int iNum = pListFrontNode->m_lstNode.Length();
|
||
if(iNum > 1){
|
||
int iNumTmp(0);
|
||
for(int i=0;i<iNum;i++){
|
||
SSearchPipeList *pListTmp = pListFrontNode->m_lstNode[i];
|
||
if(fabs(pListTmp->m_nStartPress) > 0.01){
|
||
iNumTmp++;
|
||
nStartPress = pListTmp->m_nStartPress + pListTmp->m_nLost;
|
||
}
|
||
else if(pListTmp == pListLast)
|
||
iNumTmp++;
|
||
}
|
||
if(iNumTmp > 1)
|
||
return nStartPress; //返回交叉计算节点的压力
|
||
}
|
||
}
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
if(pListLast->m_pPrevious){
|
||
nRet = GetTerminalNodePress(pListLast->m_pPrevious);
|
||
return nRet;
|
||
}
|
||
return nRet;
|
||
}
|
||
|
||
|
||
//计算函数
|
||
//传入参数:
|
||
//SSearchPipeList *pListLast 依次消火栓节点指针
|
||
// idx 已经计算到哪个节点了
|
||
// B 计算流量参数: 水枪水流特性系数 <<技术措施>>P165
|
||
// Ad 计算流量参数: 水带比阻
|
||
// Ld 计算流量参数: 水带长度
|
||
// 注意: 最不利点,后3个计算参数不需要输入,直接给流量
|
||
// 计算: 流量 当量长度 流速 局部损失
|
||
// 公式:
|
||
// Hxh = Hd + Hq + Hsk = Ad*Ld*Q*Q + Q*Q/B + Hsk
|
||
// Hsk -- 消火栓栓口水头损失 0.02MPa
|
||
double DoCalcHydrantNode(SSearchPipeList *pListLast, int &idx, double B, double Ad, double Ld, double nQ, const bool bPGraph)
|
||
{
|
||
double nRet(0);
|
||
AcDbObjectId id = NULL;
|
||
id = pListLast->m_ID;
|
||
if(pListLast->m_iType == 0){
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe){
|
||
XPoint ptStart, ptEnd;
|
||
ptStart = pPipe->StartPoint();
|
||
ptEnd = pPipe->EndPoint();
|
||
double nHeight(0);
|
||
// zxl 2013.04.28 modify
|
||
//if(fabs(ptStart.x - ptEnd.x) < 0.001)
|
||
if((fabs(ptStart.x - ptEnd.x) < 0.001 && !bPGraph) || (bPGraph && ptStart.Distance2d(ptEnd) < 0.001))
|
||
{
|
||
//nHeight = fabs(ptStart.y - ptEnd.y) / 1000; // cet 2010.7.8 del
|
||
// cet 2010.7.8 add
|
||
TPipeSys::FlowDirection sys = pPipe->GetFlowDir();
|
||
if (sys == TPipeSys::kFromStart)
|
||
{
|
||
// zxl 2013.04.28 modify
|
||
// nHeight = (ptEnd.y - ptStart.y) / 1000;
|
||
if (!bPGraph)
|
||
{
|
||
nHeight = (ptEnd.y - ptStart.y) / 1000;
|
||
}
|
||
else
|
||
{
|
||
nHeight = (ptEnd.z - ptStart.z) / 1000;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// zxl 2013.04.28 modify
|
||
// nHeight = (ptStart.y - ptEnd.y) / 1000;
|
||
if (!bPGraph)
|
||
{
|
||
nHeight = (ptStart.y - ptEnd.y) / 1000;
|
||
}
|
||
else
|
||
{
|
||
nHeight = (ptStart.z - ptEnd.z) / 1000;
|
||
}
|
||
}
|
||
}
|
||
int iDn = (int)pPipe->GetDnDiameter(); //本段管线管径
|
||
double nRadius = GetPipeCalcDiameter(id)/1000; //计算半径
|
||
|
||
if(pListLast->m_lstNode.Length() == 1){
|
||
double nPipeQ(0);
|
||
SSearchPipeList *pList = pListLast->m_lstNode[0]; //得到后节点
|
||
double nStartPress = pList->m_nStartPress;
|
||
nPipeQ = pList->m_nPipeQ; //得到后管的管段流量
|
||
if(nPipeQ < 0.00001){ //没有流量,需要计算
|
||
double nTmp = nStartPress - 2;
|
||
double n = Ad*Ld + 1/B;
|
||
nTmp = nTmp / n;
|
||
nPipeQ = sqrt(nTmp);
|
||
if(nPipeQ < nQ){
|
||
nPipeQ = nQ;
|
||
nStartPress = Ad * Ld * nQ * nQ + nQ * nQ / B + 2;
|
||
}
|
||
}
|
||
// int iNodeNum = pList->m_lstNode.Length();
|
||
// if(iNodeNum > 0){
|
||
// SSearchPipeList *pListBackPipe = pList->m_lstNode[0];
|
||
// if(iNodeNum == 1)
|
||
// nDang = GetDangBy2Pipe(id, pListBackPipe ->m_ID);
|
||
// else if(iNodeNum > 1){ //四通也按三通处理
|
||
// SSearchPipeList *pListBackPipe2 = pList->m_lstNode[1];
|
||
// BOOL bIsLine(FALSE);
|
||
// if(pListBackPipe->m_csName == _T("") || pListBackPipe2->m_csName == _T(""))
|
||
// bIsLine = TRUE; //如果后面所接的管子有一根是不流水(不计算)的, 则当量=直向流
|
||
// nDang = GetDangBy3Pipe(id, pListBackPipe->m_ID, pListBackPipe2->m_ID, bIsLine);
|
||
// }
|
||
// }
|
||
|
||
BOOL bIsCornerNode = FALSE;
|
||
BOOL bFlag = FALSE;
|
||
if(pListLast->m_pPrevious){//计算当量长度
|
||
SSearchPipeList *pFrontNode = pListLast->m_pPrevious; //得到前节点
|
||
int iNum = pFrontNode->m_lstNode.Length();
|
||
if(iNum > 1){
|
||
int iNumTmp(0);
|
||
for(int i=0;i<iNum;i++){
|
||
SSearchPipeList *pListTmp = pFrontNode->m_lstNode[i];
|
||
if(fabs(pListTmp->m_nStartPress) > 0.01)
|
||
iNumTmp++;
|
||
else if(pListTmp == pListLast)
|
||
iNumTmp++;
|
||
else if(fabs(pListTmp->m_nStartPress) < 0.01 && pListTmp->m_csName != _T(""))
|
||
bIsCornerNode = TRUE;//交叉点还有输入端没计算
|
||
|
||
}
|
||
if(iNumTmp > 1)
|
||
bFlag = TRUE; //此处为交叉计算节点
|
||
}
|
||
|
||
}
|
||
double nV = 4 * nPipeQ / (PI * nRadius * nRadius)/1000;//流速 4 × Q / (PI * DN * DN) m/s
|
||
double i = 0.00107 * nV * nV / (pow(nRadius, 1.3)); //水力陂降 /计算半径的1.3次方
|
||
// double nPipeLen = pPipe->Length()/1000;
|
||
double nPipeLen = pPipe->Length();
|
||
double nDang = pListLast->m_nDang;
|
||
pListLast->m_nLost = (nPipeLen + nDang) * i + nHeight; //损失
|
||
pListLast->m_nStartPress = nStartPress; //起点压力
|
||
pListLast->m_nPipeQ = nPipeQ;
|
||
// pListLast->m_nDang = nDang;
|
||
pListLast->m_iDn = iDn;
|
||
pListLast->m_nI = i;
|
||
pListLast->m_nV = nV;
|
||
// pListLast->m_nLength = pPipe->Length()/1000;
|
||
pListLast->m_nLength = pPipe->Length();
|
||
if(idx > 0){
|
||
pListLast->m_iNum = idx;
|
||
idx++;
|
||
}
|
||
|
||
if(pListLast->m_pPrevious){
|
||
pListLast->m_pPrevious->m_nStartPress = nStartPress + pListLast->m_nLost;
|
||
if(bFlag) //交叉计算节点
|
||
pListLast->m_pPrevious->m_nPipeQ += nPipeQ; //管段流量 = 多段管线流量之和
|
||
else
|
||
pListLast->m_pPrevious->m_nPipeQ = nPipeQ; //管段流量 L/s
|
||
}
|
||
if(bIsCornerNode)
|
||
return idx;
|
||
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
if(pListLast->m_pPrevious){
|
||
DoCalcHydrantNode(pListLast->m_pPrevious, idx, B, Ad, Ld, nQ, bPGraph);
|
||
nRet = idx;
|
||
}
|
||
return nRet;
|
||
}
|
||
|
||
//nQ, 最小流量
|
||
//试算末端压力
|
||
double DoTryCalcHydrantNode(SSearchPipeList *pListLast, double B, double Ad, double Ld, double nQ, const bool bPGraph)
|
||
{
|
||
double nRet(0);
|
||
AcDbObjectId id = NULL;
|
||
id = pListLast->m_ID;
|
||
if(pListLast->m_iType == 0){
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe){
|
||
XPoint ptStart, ptEnd;
|
||
ptStart = pPipe->StartPoint();
|
||
ptEnd = pPipe->EndPoint();
|
||
double nHeight(0);
|
||
// zxl 2013.04.28 modify
|
||
//if(fabs(ptStart.x - ptEnd.x) < 0.001)
|
||
if((fabs(ptStart.x - ptEnd.x) < 0.001 && !bPGraph) || (bPGraph && ptStart.Distance2d(ptEnd) < 0.001))
|
||
{
|
||
//nHeight = fabs(ptStart.y - ptEnd.y) / 1000; // cet 2010.7.8 del
|
||
// cet 2010.7.8 add
|
||
TPipeSys::FlowDirection sys = pPipe->GetFlowDir();
|
||
if (sys == TPipeSys::kFromStart)
|
||
{
|
||
// zxl 2013.04.28 modify
|
||
// nHeight = (ptEnd.y - ptStart.y) / 1000;
|
||
if (!bPGraph)
|
||
{
|
||
nHeight = (ptEnd.y - ptStart.y) / 1000;
|
||
}
|
||
else
|
||
{
|
||
nHeight = (ptEnd.z - ptStart.z) / 1000;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// zxl 2013.04.28 modify
|
||
// nHeight = (ptStart.y - ptEnd.y) / 1000;
|
||
if (!bPGraph)
|
||
{
|
||
nHeight = (ptStart.y - ptEnd.y) / 1000;
|
||
}
|
||
else
|
||
{
|
||
nHeight = (ptStart.z - ptEnd.z) / 1000;
|
||
}
|
||
}
|
||
}
|
||
int iDn = (int)pPipe->GetDnDiameter(); //本段管线管径
|
||
|
||
double nRadius = GetPipeCalcDiameter(id)/1000; //计算半径
|
||
if(pListLast->m_lstNode.Length() == 1){
|
||
double nPipeQ(0);
|
||
SSearchPipeList *pList = pListLast->m_lstNode[0]; //得到后节点
|
||
double nStartPress = pList->m_nStartPress;
|
||
nPipeQ = pList->m_nPipeQ; //得到后管的管段流量
|
||
if(nPipeQ < 0.00001){ //没有流量,需要计算
|
||
double nTmp = nStartPress - 2;
|
||
double n = Ad*Ld + 1/B;
|
||
nTmp = nTmp / n;
|
||
nPipeQ = sqrt(nTmp);
|
||
if(nPipeQ < nQ){
|
||
nPipeQ = nQ;
|
||
nStartPress = Ad * Ld * nQ * nQ + nQ * nQ / B + 2;
|
||
}
|
||
}
|
||
|
||
// int iNodeNum = pList->m_lstNode.Length();
|
||
// if(iNodeNum > 0){
|
||
// SSearchPipeList *pListBackPipe = pList->m_lstNode[0];
|
||
// if(iNodeNum == 1)
|
||
// nDang = GetDangBy2Pipe(id, pListBackPipe->m_ID);
|
||
// else if(iNodeNum > 1){ //四通也按三通处理
|
||
// SSearchPipeList *pListBackPipe2 = pList->m_lstNode[1];
|
||
// BOOL bIsLine(FALSE);
|
||
// if(pListBackPipe->m_csName == _T("") || pListBackPipe2->m_csName == _T(""))
|
||
// bIsLine = TRUE; //如果后面所接的管子有一根是不流水(不计算)的, 则当量=直向流
|
||
// nDang = GetDangBy3Pipe(id, pListBackPipe->m_ID, pListBackPipe2->m_ID, bIsLine);
|
||
// }
|
||
// }
|
||
BOOL bFlag = FALSE;
|
||
if(pListLast->m_pPrevious){
|
||
SSearchPipeList *pFrontNode = pListLast->m_pPrevious; //得到前节点
|
||
int iNum = pFrontNode->m_lstNode.Length();
|
||
if(iNum > 1){
|
||
int iNumTmp(0);
|
||
for(int i=0;i<iNum;i++){
|
||
SSearchPipeList *pListTmp = pFrontNode->m_lstNode[i];
|
||
if(fabs(pListTmp->m_nStartPress) > 0.01)
|
||
iNumTmp++;
|
||
else if(pListTmp == pListLast)
|
||
iNumTmp++;
|
||
}
|
||
if(iNumTmp > 1)
|
||
bFlag = TRUE; //此处为交叉计算节点
|
||
}
|
||
|
||
|
||
}
|
||
double nV = 4 * nPipeQ / (PI * nRadius * nRadius)/1000;//流速 4 × Q / (PI * DN * DN) m/s
|
||
double i = 0.00107 * nV * nV / (pow(nRadius, 1.3)); //水力陂降 /计算半径的1.3次方
|
||
if(i > 1)
|
||
return 0;
|
||
// double nPipeLen = pPipe->Length()/1000;
|
||
double nPipeLen = pPipe->Length();
|
||
double nDang = pListLast->m_nDang;
|
||
pListLast->m_nLost = (nPipeLen + nDang) * i + nHeight; //损失
|
||
if(bFlag)
|
||
return nStartPress + pListLast->m_nLost;
|
||
pListLast->m_nStartPress = nStartPress; //起点压力
|
||
pListLast->m_nPipeQ = nPipeQ;
|
||
// pListLast->m_nDang = nDang;
|
||
pListLast->m_iDn = iDn;
|
||
pListLast->m_nI = i;
|
||
pListLast->m_nV = nV;
|
||
// pListLast->m_nLength = pPipe->Length()/1000;
|
||
pListLast->m_nLength = pPipe->Length();
|
||
if(pListLast->m_pPrevious){
|
||
pListLast->m_pPrevious->m_nStartPress = nStartPress + pListLast->m_nLost;
|
||
pListLast->m_pPrevious->m_nPipeQ = nPipeQ; //管段流量 L/s
|
||
}
|
||
|
||
}
|
||
}
|
||
OPENOBJ_END();
|
||
}
|
||
if(pListLast->m_pPrevious){
|
||
return DoTryCalcHydrantNode(pListLast->m_pPrevious, B, Ad, Ld, nQ, bPGraph);
|
||
}
|
||
return nRet;
|
||
}
|
||
|
||
|
||
//输出计算书函数
|
||
void ImportHydrantWord(DList<SSearchPipeList> &lstNode, CHydrantCalcDlg &dlg)
|
||
{
|
||
int len = lstNode.Length();
|
||
if(len < 1)
|
||
return;
|
||
|
||
//初始化
|
||
COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR), vtTrue((short)TRUE), vtFalse((short)FALSE);
|
||
_Application wordApplication;
|
||
Documents wordDocuments;
|
||
_Document activeDocument;
|
||
Paragraphs wordParagraphs;
|
||
Selection wordSelection;
|
||
|
||
if (!wordApplication.CreateDispatch(_T("Word.Application")))
|
||
{
|
||
AfxMessageBox(_T("不能执行Microsoft Word 8.0!"));
|
||
return;
|
||
}
|
||
|
||
// cet 2010.7.9 add 打开公式模板
|
||
TWordFormulasTemplet wdFormula;
|
||
CString sPathName = g_csSysPath;
|
||
sPathName += _T("formula.doc");
|
||
if (!wdFormula.OpenWordFormulasTempletFile(sPathName))
|
||
{
|
||
return;
|
||
}
|
||
|
||
wordApplication.SetVisible(TRUE);
|
||
wordDocuments = wordApplication.GetDocuments();
|
||
activeDocument = wordDocuments.Add(vtOptional,vtOptional);
|
||
|
||
|
||
//写一行字
|
||
wordSelection = wordApplication.GetSelection();
|
||
wordParagraphs = wordSelection.GetParagraphs();
|
||
wordParagraphs.SetAlignment(0); // 0: 居左 1:居中 2:居右
|
||
|
||
// cet 2010.7.9 del
|
||
// wordSelection.TypeText(_T("计算原理参照《全国民用建筑工程设计技术措施2003》,《建筑给水排水工程》(中国建筑工业出版社) \n"));
|
||
// wordSelection.TypeText(_T("基本计算公式 \n"));
|
||
// wordSelection.TypeText(_T("1. 最不利点消火栓流量 \n"));
|
||
// wordSelection.TypeText(_T("Qxh = SQRT(B * Hq) \n"));
|
||
// wordSelection.TypeText(_T("式中:\n"));
|
||
// wordSelection.TypeText(_T("Qxh-水枪喷嘴射出流量(L/s) (依据规范需要与水枪的额定流量进行比较,取较大值)\n"));
|
||
// wordSelection.TypeText(_T("B-水枪水流特性系数\n"));
|
||
// wordSelection.TypeText(_T("Hq-水枪喷嘴造成一定长度的充实水柱所需水压 \n"));
|
||
// wordSelection.TypeText(_T("2. 最不利点消火栓压力 \n"));
|
||
// wordSelection.TypeText(_T("Hxh = Hd + Hq + Hsk = Ad * Ld * Qxh*Qxh + Qxh*Qxh/B + 2 \n"));
|
||
// wordSelection.TypeText(_T("式中:\n"));
|
||
// wordSelection.TypeText(_T("Hxh -消火栓栓口的最低水压(0.010MPa) \n"));
|
||
// wordSelection.TypeText(_T("Hd-消防水带的水头损失(0.01MPa)\n"));
|
||
// wordSelection.TypeText(_T("Hq-水枪喷嘴造成一定长度的充实水柱所需水压(0.01MPa) \n"));
|
||
// wordSelection.TypeText(_T("Hd-消防水带的水头损失(0.01MPa)\n"));
|
||
// wordSelection.TypeText(_T("Ad-水带的比阻 \n"));
|
||
// wordSelection.TypeText(_T("Ld-水带的长度(m) \n"));
|
||
// wordSelection.TypeText(_T("Qxh-水枪喷嘴射出流量(L/s)\n"));
|
||
// wordSelection.TypeText(_T("B-水枪水流特性系数\n"));
|
||
// wordSelection.TypeText(_T("Hsk-消火栓栓口水头损失,宜取0.02Mpa\n"));
|
||
// wordSelection.TypeText(_T("3. 次不利点消火栓压力 \n"));
|
||
// wordSelection.TypeText(_T("Hxh次 = Hxh最 + H层高 + Hfj \n"));
|
||
// wordSelection.TypeText(_T("式中:\n"));
|
||
// wordSelection.TypeText(_T("H层高-消火栓间隔的楼层高(m) \n"));
|
||
// wordSelection.TypeText(_T("Hfj-两个消火栓之间的沿程、局部水头损失(m)\n"));
|
||
// wordSelection.TypeText(_T("4. 次不利点消火栓流量 \n"));
|
||
// wordSelection.TypeText(_T("Qxh次 = sqrt((Hxh次 - 2) / (Ad*Ld + 1/B)) \n"));
|
||
// wordSelection.TypeText(_T("(依据规范需要与水枪的额定流量进行比较,取较大值)\n"));
|
||
// wordSelection.TypeText(_T("5. 流速V \n"));
|
||
// wordSelection.TypeText(_T("V = (4 * Q) / (π * Dj * Dj)\n"));
|
||
// wordSelection.TypeText(_T("式中:\n"));
|
||
// wordSelection.TypeText(_T("Q-管段流量L/s\n"));
|
||
// wordSelection.TypeText(_T("Dj-管道的计算内径(m)\n"));
|
||
// wordSelection.TypeText(_T("6. 水力坡降 \n"));
|
||
// wordSelection.TypeText(_T("i = 0.00107 * V * V / (pow(Dj, 1.3) \n"));
|
||
// wordSelection.TypeText(_T("式中:\n"));
|
||
// wordSelection.TypeText(_T("i-每米管道的水头损失(m H20/m)\n"));
|
||
// wordSelection.TypeText(_T("V-管道内水的平均流速(m/s)\n"));
|
||
// wordSelection.TypeText(_T("Dj-管道的计算内径(m)\n"));
|
||
// wordSelection.TypeText(_T("7. 沿程水头损失 \n"));
|
||
// wordSelection.TypeText(_T("h = i * L \n"));
|
||
// wordSelection.TypeText(_T("式中:\n"));
|
||
// wordSelection.TypeText(_T("L-管段长度m\n"));
|
||
// wordSelection.TypeText(_T("8. 局部损失(采用当量长度法) \n"));
|
||
// wordSelection.TypeText(_T("h = i * L(当量) \n"));
|
||
// wordSelection.TypeText(_T("式中:\n"));
|
||
// wordSelection.TypeText(_T("L(当量) 管段当量长度,单位m(《自动喷水灭火系统设计规范》附录C)\n\n"));
|
||
|
||
// cet 2010.7.9 add
|
||
_Font font;
|
||
font = wordSelection.GetFont();
|
||
wordSelection.TypeText(_T("计算原理参照《全国民用建筑工程设计技术措施2009》,《建筑给水排水工程》(中国建筑工业出版社) \n"));
|
||
wordSelection.TypeText(_T("基本计算公式 \n"));
|
||
wordSelection.TypeText(_T("1、最不利点消火栓流量:\n"));
|
||
wordSelection.TypeText(_T(" "));
|
||
wdFormula.InsertFormula(WORD_FORMULA10, wordSelection);
|
||
wordSelection.TypeText(_T("\n 式中:"));
|
||
wordSelection.TypeText(_T("q"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("xh"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 水枪喷嘴射出流量(L/s) (依据规范需要与水枪的额定流量进行比较,取较大值)\n"));
|
||
wordSelection.TypeText(_T(" B -- 水枪水流特性系数\n"));
|
||
wordSelection.TypeText(_T(" H"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("q"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 水枪喷嘴造成一定长度的充实水柱所需水压(mH"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("2"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" O)\n"));
|
||
wordSelection.TypeText(_T("2、最不利点消火栓压力: \n"));
|
||
wordSelection.TypeText(_T(" "));
|
||
wdFormula.InsertFormula(WORD_FORMULA11, wordSelection);
|
||
wordSelection.TypeText(_T("\n 式中:"));
|
||
wordSelection.TypeText(_T("H"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("xh"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 消火栓栓口的最低水压(0.010MPa) \n"));
|
||
wordSelection.TypeText(_T(" h"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("d"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" --消防水带的水头损失(0.01MPa)\n"));
|
||
wordSelection.TypeText(_T(" h"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("q"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 水枪喷嘴造成一定长度的充实水柱所需水压(0.01MPa) \n"));
|
||
wordSelection.TypeText(_T(" A"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("d"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 水带的比阻 \n"));
|
||
wordSelection.TypeText(_T(" L"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("d"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 水带的长度(m) \n"));
|
||
wordSelection.TypeText(_T(" q"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("xh"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 水枪喷嘴射出流量(L/s)\n"));
|
||
wordSelection.TypeText(_T(" B-水枪水流特性系数\n"));
|
||
wordSelection.TypeText(_T(" H"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("sk"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 消火栓栓口水头损失,宜取0.02Mpa\n"));
|
||
wordSelection.TypeText(_T("3、次不利点消火栓压力:\n"));
|
||
wordSelection.TypeText(_T(" "));
|
||
wdFormula.InsertFormula(WORD_FORMULA12, wordSelection);
|
||
wordSelection.TypeText(_T("\n 式中:"));
|
||
wordSelection.TypeText(_T("H"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("层高"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 消火栓间隔的楼层高(m) \n"));
|
||
wordSelection.TypeText(_T(" H"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("f+j"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 两个消火栓之间的沿程、局部水头损失(m)\n"));
|
||
wordSelection.TypeText(_T("4、次不利点消火栓流量: \n"));
|
||
wordSelection.TypeText(_T(" "));
|
||
wdFormula.InsertFormula(WORD_FORMULA13, wordSelection);
|
||
wordSelection.TypeText(_T("\n (依据规范需要与水枪的额定流量进行比较,取较大值)\n"));
|
||
wordSelection.TypeText(_T("5、流速V: \n"));
|
||
wordSelection.TypeText(_T(" "));
|
||
wdFormula.InsertFormula(WORD_FORMULA14, wordSelection);
|
||
wordSelection.TypeText(_T("\n 式中:"));
|
||
wordSelection.TypeText(_T("q"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("xh"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 管段流量L/s\n"));
|
||
wordSelection.TypeText(_T(" D"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("j"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 管道的计算内径(m)\n"));
|
||
wordSelection.TypeText(_T("6、水力坡降: \n"));
|
||
wordSelection.TypeText(_T(" "));
|
||
wdFormula.InsertFormula(WORD_FORMULA15, wordSelection);
|
||
wordSelection.TypeText(_T("\n 式中:"));
|
||
wordSelection.TypeText(_T("i -- 每米管道的水头损失(mH"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("2"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T("0/m)\n"));
|
||
wordSelection.TypeText(_T(" V -- 管道内水的平均流速(m/s)\n"));
|
||
wordSelection.TypeText(_T(" D"));
|
||
font.SetSubscript(2); //处理下标
|
||
wordSelection.TypeText(_T("j"));
|
||
font.SetSubscript(0);
|
||
wordSelection.TypeText(_T(" -- 管道的计算内径(m)\n"));
|
||
wordSelection.TypeText(_T("7、沿程水头损失: \n"));
|
||
wordSelection.TypeText(_T(" "));
|
||
wdFormula.InsertFormula(WORD_FORMULA16, wordSelection);
|
||
wordSelection.TypeText(_T("\n 式中:"));
|
||
wordSelection.TypeText(_T("L -- 管段长度m\n"));
|
||
wordSelection.TypeText(_T("8、局部损失(采用当量长度法): \n"));
|
||
wordSelection.TypeText(_T(" "));
|
||
wdFormula.InsertFormula(WORD_FORMULA17, wordSelection);
|
||
wordSelection.TypeText(_T("(当量) \n"));
|
||
wordSelection.TypeText(_T(" 式中:"));
|
||
wordSelection.TypeText(_T("L(当量) -- 管段当量长度,单位m(《自动喷水灭火系统设计规范》附录C)\n\n"));
|
||
wdFormula.CloseFile();
|
||
|
||
CString csTmp;
|
||
wordSelection.TypeText(_T("计算参数: \n"));
|
||
if(dlg.m_iMat == 0)
|
||
csTmp = _T("水龙带材料:衬胶\n");
|
||
else
|
||
csTmp = _T("水龙带材料:麻织\n");
|
||
wordSelection.TypeText((const TCHAR*)csTmp);
|
||
// cet 2012.12.18 modify
|
||
/*
|
||
if(dlg.m_iLen == 0)
|
||
csTmp = _T("水龙带长度:25m\n");
|
||
else
|
||
csTmp = _T("水龙带长度:20m\n");
|
||
*/
|
||
if(dlg.m_iLen == 0)
|
||
csTmp = _T("水龙带长度:15m\n");
|
||
else if (dlg.m_iLen == 1)
|
||
csTmp = _T("水龙带长度:20m\n");
|
||
else if (dlg.m_iLen == 2)
|
||
csTmp = _T("水龙带长度:25m\n");
|
||
else if (dlg.m_iLen == 3)
|
||
csTmp = _T("水龙带长度:30m\n");
|
||
wordSelection.TypeText((const TCHAR*)csTmp);
|
||
|
||
if(dlg.m_iRaius == 0)
|
||
csTmp = _T("水龙带直径:50mm\n");
|
||
else if (dlg.m_iRaius == 2) // cet 2012.12.18 add
|
||
csTmp = _T("水龙带直径:80mm\n");
|
||
else
|
||
csTmp = _T("水龙带直径:65mm\n");
|
||
wordSelection.TypeText((const TCHAR*)csTmp);
|
||
if(dlg.m_iGun == 0)
|
||
csTmp = _T("水枪喷嘴口径:13mm\n");
|
||
else if(dlg.m_iGun == 1)
|
||
csTmp = _T("水枪喷嘴口径:16mm\n");
|
||
else if(dlg.m_iGun == 2)
|
||
csTmp = _T("水枪喷嘴口径:19mm\n");
|
||
else if(dlg.m_iGun == 3) // cet 2012.12.18 add
|
||
csTmp = _T("水枪喷嘴口径:22mm\n");
|
||
else if(dlg.m_iGun == 4) // cet 2012.12.18 add
|
||
csTmp = _T("水枪喷嘴口径:25mm\n");
|
||
wordSelection.TypeText((const TCHAR*)csTmp);
|
||
wordSelection.TypeText(XString(_T("充实水柱长度:%s m\n\n"), dlg.m_csWaterLen));
|
||
|
||
|
||
Selection wSelection2 = wordApplication.GetSelection();
|
||
wSelection2.TypeParagraph();
|
||
|
||
//画表格
|
||
int rows(len+1), columns(10);
|
||
|
||
Selection wSelection = wordApplication.GetSelection();
|
||
Range oRange = wSelection.GetRange();
|
||
Tables oTables = activeDocument.GetTables();
|
||
_Table oTable = oTables.Add(oRange, rows, columns);
|
||
// cet 2010.3.25 add
|
||
Borders oBorders = oTable.GetBorders();
|
||
oBorders.SetInsideLineStyle(1); // 设置表格线型
|
||
oBorders.SetOutsideLineStyle(1);
|
||
|
||
Columns oColumns;
|
||
Column oColumn;
|
||
oColumns = oTable.GetColumns();
|
||
oColumn = oColumns.Item(1);
|
||
oColumn.SetWidth(40, 0); // 0 = wdAdjustNone
|
||
oColumn = oColumns.Item(2);
|
||
oColumn.SetWidth(55, 0);
|
||
oColumn = oColumns.Item(3);
|
||
oColumn.SetWidth(50, 0);
|
||
oColumn = oColumns.Item(4);
|
||
oColumn.SetWidth(40, 0);
|
||
oColumn = oColumns.Item(5);
|
||
oColumn.SetWidth(40, 0);
|
||
oColumn = oColumns.Item(6);
|
||
oColumn.SetWidth(40, 0);
|
||
oColumn = oColumns.Item(7);
|
||
oColumn.SetWidth(60, 0);
|
||
oColumn = oColumns.Item(8);
|
||
oColumn.SetWidth(40, 0);
|
||
oColumn = oColumns.Item(9);
|
||
oColumn.SetWidth(40, 0);
|
||
oColumn = oColumns.Item(10);
|
||
oColumn.SetWidth(55, 0);
|
||
|
||
|
||
|
||
Cell oCell;
|
||
oCell = oTable.Cell(1, 1);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("管段名称"));
|
||
|
||
oCell = oTable.Cell(1, 2);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("起点压力mH2O"));
|
||
|
||
oCell = oTable.Cell(1, 3);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("管道流量L/s"));
|
||
|
||
oCell = oTable.Cell(1, 4);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("管长m"));
|
||
|
||
oCell = oTable.Cell(1, 5);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("当量长度"));
|
||
|
||
oCell = oTable.Cell(1, 6);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("管径mm"));
|
||
|
||
oCell = oTable.Cell(1, 7);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("水力坡降mH2O/m"));
|
||
|
||
oCell = oTable.Cell(1, 8);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("流速m/s"));
|
||
|
||
oCell = oTable.Cell(1, 9);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("损失mH2O"));
|
||
|
||
oCell = oTable.Cell(1, 10);
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(_T("终点压力mH2O"));
|
||
|
||
|
||
|
||
for(int i=0; i<len; i++){
|
||
CString csTmp;
|
||
oCell = oTable.Cell(i+2, 1); //管段名称
|
||
oRange = oCell.GetRange();
|
||
|
||
csTmp = lstNode[i]->m_csName;
|
||
int idx = csTmp.Find(_T(" "));
|
||
if (idx != -2)
|
||
{
|
||
csTmp = csTmp.Left(idx);
|
||
}
|
||
oRange.InsertAfter(csTmp);
|
||
|
||
csTmp.Format(_T("%.2f"), lstNode[i]->m_nStartPress);
|
||
oCell = oTable.Cell(i+2, 2); //起点压力mH2O
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(csTmp);
|
||
|
||
csTmp.Format(_T("%.2f"), lstNode[i]->m_nPipeQ);
|
||
oCell = oTable.Cell(i+2, 3); //管道流量L/s
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(csTmp);
|
||
|
||
csTmp.Format(_T("%.2f"), lstNode[i]->m_nLength);
|
||
oCell = oTable.Cell(i+2, 4); //管长m
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(csTmp);
|
||
|
||
csTmp.Format(_T("%.2f"), lstNode[i]->m_nDang);
|
||
oCell = oTable.Cell(i+2, 5); //当量长度m
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(csTmp);
|
||
|
||
csTmp.Format(_T("%d"), lstNode[i]->m_iDn);
|
||
oCell = oTable.Cell(i+2, 6); //管径mm
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(csTmp);
|
||
|
||
csTmp.Format(_T("%.3f"), lstNode[i]->m_nI);
|
||
oCell = oTable.Cell(i+2, 7); //水力坡降mH2O/m
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(csTmp);
|
||
|
||
csTmp.Format(_T("%.2f"), lstNode[i]->m_nV);
|
||
oCell = oTable.Cell(i+2, 8); //流速m/s
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(csTmp);
|
||
|
||
csTmp.Format(_T("%.2f"), lstNode[i]->m_nLost);
|
||
oCell = oTable.Cell(i+2, 9); //损失mH2O
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(csTmp);
|
||
|
||
csTmp.Format(_T("%.2f"), lstNode[i]->m_nLost + lstNode[i]->m_nStartPress);
|
||
oCell = oTable.Cell(i+2, 10); //终点压力mH2O
|
||
oRange = oCell.GetRange();
|
||
oRange.InsertAfter(csTmp);
|
||
}
|
||
|
||
COleVariant vtOptional2((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
|
||
wordSelection = wordApplication.GetSelection();
|
||
wordSelection.GoTo(COleVariant((short)3), // 3 = wdGoToLine
|
||
COleVariant((short)-1),vtOptional2,vtOptional2); // -1 = wdGoToLast
|
||
|
||
wSelection = wordApplication.GetSelection();
|
||
wSelection.TypeParagraph();
|
||
|
||
wordSelection.TypeText(_T("计算结果:\n"));
|
||
CString csRet;
|
||
csRet.Format(_T("入口压力:%.2f 米水柱\n"), lstNode[len-1]->m_nLost + lstNode[len-1]->m_nStartPress);
|
||
wordSelection.TypeText(csRet);
|
||
|
||
}
|
||
|
||
extern double GetDangLenByElbow90(int iDn1); //90度弯头当量长度
|
||
BOOL IsNeedCalc(SSearchPipeList *pListAll)
|
||
{
|
||
BOOL bRet = FALSE;
|
||
long len = pListAll->m_lstNode.Length();
|
||
CString csName = pListAll->m_csName;
|
||
if(pListAll->m_bNeedCale)
|
||
return TRUE;
|
||
for(long i=0;i<len;i++){
|
||
SSearchPipeList *pList = pListAll->m_lstNode[i];
|
||
bRet = IsNeedCalc(pList);
|
||
if(bRet)
|
||
return TRUE;
|
||
}
|
||
return bRet;
|
||
}
|
||
|
||
//计算得到每段管线的当量
|
||
void DoCalcHydrantNg(SSearchPipeList *pListAll, BOOL bOnlyFlow = TRUE)
|
||
{
|
||
if(pListAll->m_iType == 0){
|
||
AcDbObjectId id = NULL;
|
||
id = pListAll->m_ID;
|
||
int iDn1(0), iDn2(0), iDn0(0);
|
||
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPipe, pPipe);
|
||
if(pPipe){
|
||
iDn1 = (int)pPipe->GetDnDiameter();
|
||
}
|
||
OPENOBJ_END();
|
||
double dNg(0);
|
||
DList<AcDbObjectId> lstPipe;
|
||
if(pListAll->m_lstNode.Length() == 1){
|
||
SSearchPipeList *pList = pListAll->m_lstNode[0]; //得到后节点
|
||
if(IsNeedCalc(pList)){
|
||
|
||
//第一步, 得到后节点管件的当量
|
||
int iLen = pList->m_lstNode.Length();
|
||
|
||
int iNoCalc(0);
|
||
if(bOnlyFlow){//当量统计仅考虑水流情况
|
||
for(int j=0;j<iLen;j++){
|
||
SSearchPipeList *pListTmp = pList->m_lstNode[j];
|
||
if(!IsNeedCalc(pListTmp))
|
||
iNoCalc++;
|
||
}
|
||
iLen-=iNoCalc;
|
||
}
|
||
|
||
iLen++;
|
||
if(iLen > 2){ //三通 四通
|
||
dNg = GetDangLenByCorner(iDn1);
|
||
}
|
||
else if(iLen == 2){
|
||
if(iNoCalc==0){//iNoCalc==0 表示不考虑水流情况下,实际情况就是2跟管。
|
||
SSearchPipeList *pListTmp = pList->m_lstNode[0];
|
||
OPENOBJ_BEGIN(pListTmp->m_ID, AcDb::kForRead, TDbPipe, pPipe2);
|
||
if(pPipe2){
|
||
iDn2 = (int)pPipe2->GetDnDiameter();
|
||
}
|
||
OPENOBJ_END();
|
||
if(Is2PipeParallel(pListTmp->m_ID, id)) //前后管是否平行
|
||
dNg = GetDangLenByTaiIn(iDn1, iDn2); //根据接头查当量长度
|
||
else
|
||
dNg = GetDangLenByElbow90(iDn1); //根据弯头查当量长度
|
||
}
|
||
}
|
||
//第二步, 看看和前节点是否存在变径
|
||
if(pListAll->m_pPrevious != NULL){
|
||
SSearchPipeList *pList2 = pListAll->m_pPrevious;
|
||
int iLen2 = pList2->m_lstNode.Length();
|
||
if(iLen2 > 1 || pList2->m_iType == 2){//肯定是个三通
|
||
if(pList2->m_pPrevious != NULL){
|
||
SSearchPipeList *pList3 = pList2->m_pPrevious;//得到前管
|
||
OPENOBJ_BEGIN(pList3->m_ID, AcDb::kForRead, TDbPipe, pPipe2);
|
||
if(pPipe2){
|
||
iDn0 = (int)pPipe2->GetDnDiameter();
|
||
}
|
||
OPENOBJ_END();
|
||
double dNg2 = GetDangLenByTaiIn(iDn0, iDn1); //异径接头
|
||
dNg += dNg2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
pListAll->m_nDang = dNg;
|
||
}
|
||
long len = pListAll->m_lstNode.Length();
|
||
for(long i=0;i<len;i++){
|
||
SSearchPipeList *pList = pListAll->m_lstNode[i];
|
||
DoCalcHydrantNg(pList, bOnlyFlow);
|
||
}
|
||
}
|
||
|
||
// cet 2010.7.9 add
|
||
void GetCalcNode(SSearchPipeList *pListAll, PickSet &ss, std::vector<SSearchPipeList*> &vec)
|
||
{
|
||
if (pListAll->m_iType == 2)
|
||
{
|
||
ads_name sname;
|
||
acdbGetAdsName(sname, pListAll->m_ID);
|
||
Entity ent = sname;
|
||
if (ent.In(&ss))
|
||
{
|
||
vec.push_back(pListAll);
|
||
}
|
||
}
|
||
|
||
int nLen = pListAll->m_lstNode.Length();
|
||
for(int i = 0; i < nLen; i++)
|
||
{
|
||
SSearchPipeList *pLst = pListAll->m_lstNode[i];
|
||
GetCalcNode(pLst, ss, vec);
|
||
}
|
||
}
|
||
|
||
// cet 2010.7.9 add
|
||
void SetPipeDir(SSearchPipeList *pListAll, XPoint ptLoc, std::vector<SSearchPipeList*> &vec)
|
||
{
|
||
if (pListAll == NULL)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(pListAll->m_iType == 0)
|
||
{
|
||
std::vector<SSearchPipeList*>::iterator it;
|
||
it = std::find(vec.begin(), vec.end(), pListAll);
|
||
|
||
TDbPipe *pPipe = NULL;
|
||
acdbOpenObject(pPipe, pListAll->m_ID, AcDb::kForWrite);
|
||
if(pPipe != NULL)
|
||
{
|
||
TPipeSys::FlowDirection sys = pPipe->GetFlowDir();
|
||
|
||
if (it == vec.end())
|
||
{
|
||
vec.push_back(pListAll);
|
||
XPoint p1 = ptLoc;
|
||
//p1.z = 0; // zxl 2013.04.28 del
|
||
XPoint p2 = pPipe->StartPoint();
|
||
//p2.z = 0; // zxl 2013.04.28 del
|
||
if(p1 == p2)
|
||
{
|
||
pPipe->SetFlowDir(TPipeSys::kFromEnd);
|
||
ptLoc = pPipe->EndPoint();
|
||
}
|
||
else
|
||
{
|
||
pPipe->SetFlowDir(TPipeSys::kFromStart);
|
||
ptLoc = pPipe->StartPoint();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (sys == TPipeSys::kFromStart)
|
||
{
|
||
ptLoc = pPipe->StartPoint();
|
||
}
|
||
else
|
||
{
|
||
ptLoc = pPipe->EndPoint();
|
||
}
|
||
}
|
||
|
||
pPipe->close();
|
||
}
|
||
}
|
||
|
||
SetPipeDir(pListAll->m_pPrevious, ptLoc, vec);
|
||
}
|
||
|
||
// cet 2010.7.9 add 更改管道流向
|
||
void ModifyPipeSysFlow(SSearchPipeList *pListAll, PickSet &ss)
|
||
{
|
||
std::vector<SSearchPipeList*> vec, vec2;
|
||
GetCalcNode(pListAll, ss, vec);
|
||
std::vector<SSearchPipeList*>::iterator it;
|
||
for(it = vec.begin(); it != vec.end(); it++)
|
||
{
|
||
SSearchPipeList *pLst = *it;
|
||
XPoint ptLoc;
|
||
TDbEquipment *pEqup = NULL;
|
||
acdbOpenObject(pEqup, pLst->m_ID, AcDb::kForRead);
|
||
if (pEqup != NULL)
|
||
{
|
||
ptLoc = pEqup->GetLocation();
|
||
pEqup->close();
|
||
|
||
SetPipeDir(pLst, ptLoc, vec2);
|
||
}
|
||
}
|
||
}
|
||
|
||
// cet 2012.12.10 modify 将计算结果显示在对话框中
|
||
//主函数
|
||
// void HydrantCalc()
|
||
// {
|
||
// Entity entMainPipe;
|
||
// RBList rbMask(RTDXF0, _T("ATS_EQUIPMENT"), 8, _T("*"), NULL);
|
||
//
|
||
// RBList rbMaskPipe = ads_buildlist( -4, _T("<or"),
|
||
// -4, _T("<and"), RTDXF0, _T("ATS_PIPE"), 8, LAY_PIPE_FIRE, -4, _T("and>"),
|
||
// -4, _T("<and"), RTDXF0, _T("ATS_PIPE"), 8, LAY_PIPE_FIRE2, -4, _T("and>"),
|
||
// -4, _T("<and"), RTDXF0, _T("ATS_PIPE"), 8, LAY_PIPE_FIRE3, -4, _T("and>"),
|
||
// -4, _T("or>"), NULL);
|
||
//
|
||
//
|
||
// if(SelectEntity(_T("\n请选择消火栓干管<退出>"), entMainPipe, rbMaskPipe) != RTNORM) {
|
||
// return;
|
||
// }
|
||
//
|
||
// SSearchPipeList *pListAll = new SSearchPipeList();
|
||
// PickSet ssAll(SS_FREE);
|
||
// ssAll += entMainPipe;
|
||
// if(!SearchSprinkPipeSys(entMainPipe, NULL, pListAll, ssAll)){
|
||
// AfxMessageBox(_T("消防系统有回路!"));
|
||
// delete pListAll;
|
||
// return;
|
||
// }
|
||
//
|
||
// if(!CalcLstPipeLength(pListAll, NULL, ssAll)){
|
||
// AfxMessageBox(_T("消防系统没有标注管径,请先执行命令[管径标注]"));
|
||
// delete pListAll;
|
||
// return;
|
||
// }
|
||
//
|
||
// CTemporaryResourceOverride vTemp;
|
||
// CHydrantCalcDlg dlg;
|
||
// if(dlg.DoModal() != IDOK){
|
||
// delete pListAll;
|
||
// return;
|
||
// }
|
||
// double nPress = _tstof(dlg.m_csRetPress);
|
||
// double nQ = _tstof(dlg.m_csRet);
|
||
// if(nQ < _tstof(dlg.m_csQ)){//小于水枪最小流量
|
||
// nQ = _tstof(dlg.m_csQ);
|
||
// nPress = dlg.m_nAd * dlg.m_nLd * nQ * nQ + nQ * nQ / dlg.m_nB + 2;
|
||
// }
|
||
// InitLayer(LAY_TEXT);
|
||
//
|
||
// PickSet ssCalc(SS_FREE);
|
||
// if(SelectEntities(_T("\n请选择作用消火栓<退出>:"), ssCalc, rbMask) != RTNORM){
|
||
// delete pListAll;
|
||
// return;
|
||
// }
|
||
// //作用消火栓必须都在消火系统里。
|
||
// long len2 = ssCalc.Length();
|
||
// for(long jj=0;jj<len2;jj++){
|
||
// Entity enttmp = ssCalc[jj];
|
||
// if(!enttmp.In(&ssAll)){
|
||
// delete pListAll;
|
||
// return;
|
||
// }
|
||
// }
|
||
// CalcLstPipeLength(pListAll, NULL, ssCalc);
|
||
// if(pListAll->m_lstNode.Length() == 2){
|
||
// ssAll.Free();
|
||
// //计算源头应为节点,而不是管线. 以下计算管线2节点哪个是源头
|
||
// CalcSprinkNum(pListAll); //所连喷头多的节点是源头
|
||
// SSearchPipeList *p1 = pListAll->m_lstNode[0];
|
||
// SSearchPipeList *p2 = pListAll->m_lstNode[1];
|
||
// SSearchPipeList *p3 = p1->m_iNum > p2->m_iNum ? p2 : p1;
|
||
//
|
||
// ads_name ent;
|
||
// acdbGetAdsName(ent, p3->m_ID);
|
||
// delete pListAll;
|
||
// pListAll = new SSearchPipeList();
|
||
// //重新搜索系统
|
||
// if(!SearchSprinkPipeSys(ent, NULL, pListAll, ssAll)){
|
||
// AfxMessageBox(_T("喷淋系统有回路!"));
|
||
// delete pListAll;
|
||
// return;
|
||
// }
|
||
// pListAll->m_iType = 1;
|
||
// CalcLstPipeLength(pListAll, NULL, ssCalc);
|
||
// }
|
||
//
|
||
// ModifyPipeSysFlow(pListAll, ssCalc); // cet 2010.7.8 add 更改管道流向
|
||
// //////////////////////////////////////////////////////////////////////////////////////////
|
||
// DoCalcHydrantNg(pListAll, dlg.m_bNeedFlow);
|
||
//
|
||
// int idx = 1;
|
||
// SSearchPipeList *pNode = GetNextDimNode(pListAll, NULL);
|
||
// while(pNode){
|
||
// BOOL IsMainNode = FALSE;
|
||
// if(idx == 1)
|
||
// IsMainNode = TRUE;
|
||
// idx = DoSerialNumber(pNode, idx, IsMainNode); //标注节点编号
|
||
// pNode = GetNextDimNode(pListAll, NULL); //得到下一支路起点节点
|
||
// }
|
||
// DoDimPipeSerialNumber(pListAll); //标注管段编号
|
||
// pNode = GetNextCalcNode(pListAll, NULL); //得到下一支路起点节点
|
||
// pNode->m_nPipeQ = nQ;
|
||
// idx = 1;
|
||
// while(pNode){
|
||
// pNode->m_nStartPress = nPress;
|
||
// idx = (int)DoCalcHydrantNode(pNode, idx, dlg.m_nB, dlg.m_nAd, dlg.m_nLd, _tstof(dlg.m_csQ));
|
||
// idx ++;
|
||
// pNode = GetNextCalcNode(pListAll, NULL); //得到下一支路起点节点
|
||
// if(pNode){
|
||
// nPress = GetTerminalNodePress(pNode);
|
||
// pNode->m_nStartPress = nPress;
|
||
// double nCalcPress = DoTryCalcHydrantNode(pNode, dlg.m_nB, dlg.m_nAd, dlg.m_nLd, _tstof(dlg.m_csQ));
|
||
// double nPlus(0.1), nVal(0), nTmp(1);
|
||
// int n(0);
|
||
// //利用交叉节点的压力作为末端消火栓的默认压力(肯定大),然后不断减少,直至从末端计算到交叉节点的压力等于最不利点计算到交叉节点的压力
|
||
// while(fabs(nPress - nCalcPress) > 0.01){
|
||
// n++;
|
||
// if((nPress - nCalcPress) < 0)
|
||
// pNode->m_nStartPress -= nPlus;
|
||
// else
|
||
// pNode->m_nStartPress += nPlus;
|
||
// nCalcPress = DoTryCalcHydrantNode(pNode, dlg.m_nB, dlg.m_nAd, dlg.m_nLd, _tstof(dlg.m_csQ));
|
||
// nVal = nPress - nCalcPress;
|
||
// if(fabs(nPress - nCalcPress) > 10)
|
||
// nPlus = 2;
|
||
// else if(fabs(nPress - nCalcPress) > 1)
|
||
// nPlus = 0.5;
|
||
// else if(fabs(nPress - nCalcPress) > 0.1)
|
||
// nPlus = 0.1;
|
||
// else
|
||
// nPlus = 0.01;
|
||
// if(n > 60) //死循环, 主动退出
|
||
// break;
|
||
// }
|
||
// nPress = pNode->m_nStartPress;
|
||
// }
|
||
// }
|
||
//
|
||
// if(dlg.m_bWord){
|
||
// DList<SSearchPipeList> lstNode;
|
||
// SSearchPipeList *pNode = GetNextExportNode(pListAll, NULL);
|
||
// while(pNode){
|
||
// SSearchPipeList *pNodeNew = new SSearchPipeList();
|
||
// pNodeNew->m_iDn = pNode->m_iDn;
|
||
// pNodeNew->m_csName = pNode->m_csName;
|
||
// pNodeNew->m_nLength = pNode->m_nLength;
|
||
// pNodeNew->m_nPipeQ = pNode->m_nPipeQ;
|
||
// pNodeNew->m_nDang = pNode->m_nDang;
|
||
// pNodeNew->m_nStartPress = pNode->m_nStartPress;
|
||
// pNodeNew->m_nI = pNode->m_nI;
|
||
// pNodeNew->m_nV = pNode->m_nV;
|
||
// pNodeNew->m_nLost = pNode->m_nLost;
|
||
//
|
||
// lstNode.Append(pNodeNew);
|
||
// pNode->m_iNum = 0;
|
||
// pNode = GetNextExportNode(pListAll, NULL);
|
||
// }
|
||
// if(dlg.m_bWord)
|
||
// ImportHydrantWord(lstNode, dlg);
|
||
// }
|
||
// delete pListAll;
|
||
//
|
||
// }
|
||
|
||
extern BOOL CalcLstPipeLength2(SSearchPipeList *pListAll, SSearchPipeList *pListFront, PickSet &ss, bool &bPGraph);
|
||
void HydrantCalc()
|
||
{
|
||
Entity entMainPipe;
|
||
RBList rbMask(RTDXF0, _T("ATS_EQUIPMENT"), 8, _T("*"), NULL);
|
||
|
||
RBList rbMaskPipe = ads_buildlist( -4, _T("<or"),
|
||
-4, _T("<and"), RTDXF0, _T("ATS_PIPE"), 8, LAY_PIPE_FIRE, -4, _T("and>"),
|
||
-4, _T("<and"), RTDXF0, _T("ATS_PIPE"), 8, LAY_PIPE_FIRE2, -4, _T("and>"),
|
||
-4, _T("<and"), RTDXF0, _T("ATS_PIPE"), 8, LAY_PIPE_FIRE3, -4, _T("and>"),
|
||
-4, _T("<and"), RTDXF0, _T("ATS_PIPE"), 8, LAY_VPIPE_FIRE, -4, _T("and>"),
|
||
-4, _T("<and"), RTDXF0, _T("ATS_PIPE"), 8, LAY_VPIPE_FIRE2, -4, _T("and>"),
|
||
-4, _T("<and"), RTDXF0, _T("ATS_PIPE"), 8, LAY_VPIPE_FIRE3, -4, _T("and>"),
|
||
-4, _T("or>"), NULL);
|
||
|
||
|
||
if(SelectEntity(_T("\n请选择消火栓干管<退出>"), entMainPipe, rbMaskPipe) != RTNORM)
|
||
{
|
||
return;
|
||
}
|
||
|
||
SSearchPipeList *pListAll = new SSearchPipeList();
|
||
PickSet ssAll(SS_FREE);
|
||
ssAll += entMainPipe;
|
||
if(!SearchSprinkPipeSys(entMainPipe, NULL, pListAll, ssAll))
|
||
{
|
||
AfxMessageBox(_T("消防系统有回路!"));
|
||
delete pListAll;
|
||
return;
|
||
}
|
||
|
||
bool bPGraph = false;
|
||
if(!CalcLstPipeLength2(pListAll, NULL, ssAll, bPGraph))
|
||
{
|
||
AfxMessageBox(_T("消防系统没有标注管径,请先执行命令[管径标注]"));
|
||
delete pListAll;
|
||
return;
|
||
}
|
||
|
||
CTemporaryResourceOverride vTemp;
|
||
CHydrantCalcDlg dlg;
|
||
if(dlg.DoModal() != IDOK)
|
||
{
|
||
return;
|
||
}
|
||
|
||
PickSet ssCalc(SS_FREE);
|
||
if(SelectEntities(_T("\n请选择作用消火栓<退出>:"), ssCalc, rbMask) != RTNORM)
|
||
{
|
||
delete pListAll;
|
||
return;
|
||
}
|
||
//作用消火栓必须都在消火系统里。
|
||
long len2 = ssCalc.Length();
|
||
for(long jj=0;jj<len2;jj++)
|
||
{
|
||
Entity enttmp = ssCalc[jj];
|
||
if(!enttmp.In(&ssAll))
|
||
{
|
||
delete pListAll;
|
||
return;
|
||
}
|
||
}
|
||
|
||
CHydrantCalcDataDlg dlg2;
|
||
dlg2.SetListAll(pListAll);
|
||
dlg2.SetSSAll(ssAll);
|
||
dlg2.SetSSCalc(ssCalc);
|
||
dlg2.SetHydrantCalcDlg(&dlg);
|
||
dlg2.DoModal();
|
||
}
|
||
|
||
|
||
CHydrantCalcDlg::CHydrantCalcDlg(CWnd* pParent /*=NULL*/)
|
||
: CDialog(CHydrantCalcDlg::IDD, pParent)
|
||
{
|
||
//{{AFX_DATA_INIT(CHydrantCalcDlg)
|
||
m_iGun = 2;
|
||
m_iRaius = 1;
|
||
m_iLen = 1;
|
||
m_iMat = 1;
|
||
m_csWaterLen = _T("10");
|
||
m_csRetPress = _T("");
|
||
m_csRet = _T("");
|
||
m_csQ = _T("5.0");
|
||
//}}AFX_DATA_INIT
|
||
m_nB = 0;
|
||
m_nAd = 0;
|
||
m_nLd = 0;
|
||
}
|
||
|
||
|
||
void CHydrantCalcDlg::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialog::DoDataExchange(pDX);
|
||
//{{AFX_DATA_MAP(CHydrantCalcDlg)
|
||
DDX_Control(pDX, IDC_COMBO_WATER_LEN, m_comboWaterLen);
|
||
DDX_CBIndex(pDX, IDC_COMBO_GUN, m_iGun);
|
||
DDX_CBIndex(pDX, IDC_COMBO_RADIUS, m_iRaius);
|
||
DDX_CBIndex(pDX, IDC_COMBO_LEN, m_iLen);
|
||
DDX_CBIndex(pDX, IDC_COMBO_MAT, m_iMat);
|
||
DDX_CBString(pDX, IDC_COMBO_WATER_LEN, m_csWaterLen);
|
||
DDX_Text(pDX, IDC_EDIT_RET_PRESS, m_csRetPress);
|
||
DDX_Text(pDX, IDC_EDIT_RET, m_csRet);
|
||
DDX_CBString(pDX, IDC_COMBO_Q, m_csQ);
|
||
//}}AFX_DATA_MAP
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(CHydrantCalcDlg, CDialog)
|
||
//{{AFX_MSG_MAP(CHydrantCalcDlg)
|
||
ON_CBN_KILLFOCUS(IDC_COMBO_WATER_LEN, OnKillfocusComboWaterLen)
|
||
ON_CBN_SELCHANGE(IDC_COMBO_WATER_LEN, OnSelchangeComboWaterLen)
|
||
ON_CBN_SELCHANGE(IDC_COMBO_RADIUS, OnSelchangeComboRadius)
|
||
ON_CBN_SELCHANGE(IDC_COMBO_MAT, OnSelchangeComboMat)
|
||
ON_CBN_SELCHANGE(IDC_COMBO_LEN, OnSelchangeComboLen)
|
||
ON_CBN_SELCHANGE(IDC_COMBO_GUN, OnSelchangeComboGun)
|
||
//}}AFX_MSG_MAP
|
||
END_MESSAGE_MAP()
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CHydrantCalcDlg message handlers
|
||
|
||
void CHydrantCalcDlg::Calc()
|
||
{
|
||
UpdateData(TRUE);
|
||
|
||
double nHq(0), nOutQ(0), nHd(0), nFactor(0), nAf(0), nHm(0);
|
||
if(m_iGun == 0){ //水枪喷嘴13
|
||
m_nB = 0.346;
|
||
nFactor = 0.0165;
|
||
}
|
||
else if(m_iGun == 1){ //水枪喷嘴16
|
||
m_nB = 0.793;
|
||
nFactor = 0.0124;
|
||
}
|
||
else if(m_iGun == 2){ //水枪喷嘴19
|
||
m_nB = 1.577;
|
||
nFactor = 0.0097;
|
||
}
|
||
else if (m_iGun == 3)//水枪喷嘴22
|
||
{
|
||
m_nB = 2.834;
|
||
nFactor = 0.00766;
|
||
}
|
||
else if (m_iGun == 4)//水枪喷嘴25
|
||
{
|
||
m_nB = 4.727;
|
||
nFactor = 0.00615;
|
||
}
|
||
|
||
|
||
if(m_iMat == 0){ //衬胶
|
||
if(m_iRaius == 0) // 水龙带直径50
|
||
m_nAd = 0.00677;
|
||
else if (m_iRaius == 2) // 水龙带直径80 cet 2012.12.17 add
|
||
m_nAd = 0.00075;
|
||
else
|
||
m_nAd = 0.00172;// 水龙带直径65
|
||
}
|
||
else{ //麻织
|
||
if(m_iRaius == 0) // 水龙带直径50
|
||
m_nAd = 0.01501;
|
||
else if (m_iRaius == 2) // 水龙带直径80 cet 2012.12.17 add
|
||
m_nAd = 0.0015;
|
||
else
|
||
m_nAd = 0.0043; // 水龙带直径65
|
||
}
|
||
// cet 2012.12.17 modify
|
||
// if(m_iLen == 0)
|
||
// m_nLd = 25;
|
||
// else
|
||
// m_nLd = 20;
|
||
|
||
if (m_iLen == 0)
|
||
{
|
||
m_nLd = 15;
|
||
}
|
||
else if (m_iLen == 1)
|
||
{
|
||
m_nLd = 20;
|
||
}
|
||
else if (m_iLen == 2)
|
||
{
|
||
m_nLd = 25;
|
||
}
|
||
else if (m_iLen == 3)
|
||
{
|
||
m_nLd = 30;
|
||
}
|
||
|
||
nHm = _tstof(m_csWaterLen);
|
||
nAf = 1.19 + 80*(0.01*nHm)*(0.01*nHm)*(0.01*nHm)*(0.01*nHm);
|
||
nHq = nAf*nHm*10/(1- nFactor*nAf*nHm);
|
||
nHq = nHq / 10; // kPa -> m
|
||
nOutQ = sqrt(m_nB * nHq);
|
||
m_csRet.Format(_T("%.2f"), nOutQ);
|
||
|
||
nHd = m_nAd * m_nLd * nOutQ * nOutQ;
|
||
nHd += nHq;
|
||
nHd += 2;//<<技术措施>> P165 消火栓栓口水头损失 0.02MPa
|
||
//nHd = nHd/10;
|
||
m_csRetPress.Format(_T("%.2f"), nHd);
|
||
UpdateData(FALSE);
|
||
}
|
||
|
||
|
||
void CHydrantCalcDlg::OnOK()
|
||
{
|
||
CDialog::OnOK();
|
||
}
|
||
|
||
BOOL CHydrantCalcDlg::OnInitDialog()
|
||
{
|
||
CDialog::OnInitDialog();
|
||
|
||
Calc();
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// EXCEPTION: OCX Property Pages should return FALSE
|
||
}
|
||
|
||
void CHydrantCalcDlg::OnKillfocusComboWaterLen()
|
||
{
|
||
Calc();
|
||
}
|
||
|
||
void CHydrantCalcDlg::OnSelchangeComboWaterLen()
|
||
{
|
||
UpdateData(TRUE);
|
||
if(m_comboWaterLen.GetCurSel() > -1)
|
||
m_comboWaterLen.GetLBText(m_comboWaterLen.GetCurSel(), m_csWaterLen);
|
||
UpdateData(FALSE);
|
||
Calc();
|
||
}
|
||
|
||
void CHydrantCalcDlg::OnSelchangeComboRadius()
|
||
{
|
||
Calc();
|
||
}
|
||
|
||
void CHydrantCalcDlg::OnSelchangeComboMat()
|
||
{
|
||
Calc();
|
||
}
|
||
|
||
void CHydrantCalcDlg::OnSelchangeComboLen()
|
||
{
|
||
Calc();
|
||
}
|
||
|
||
void CHydrantCalcDlg::OnSelchangeComboGun()
|
||
{
|
||
int nGun = m_iGun; // 前一选择值 cet 2012.11.30 add
|
||
UpdateData();
|
||
if(m_iGun == 0) //水枪喷嘴13
|
||
m_iRaius = 0;
|
||
else if(m_iGun == 2) //水枪喷嘴16
|
||
m_iRaius = 1;
|
||
else if (m_iGun == 3 || m_iGun == 4) //水枪喷嘴22\25 cet 2012.11.30 add
|
||
{
|
||
m_iRaius = 2;
|
||
}
|
||
else if (m_iGun == 1) //水枪喷嘴16 cet 2012.11.30 add
|
||
{
|
||
if (m_iRaius == 2)
|
||
{
|
||
m_iRaius = 0;
|
||
}
|
||
}
|
||
UpdateData(FALSE);
|
||
Calc();
|
||
}
|