Commit 7eeb415e authored by 刘乐's avatar 刘乐

1, 模型改进

parent 49d41dc4
......@@ -48,18 +48,20 @@ bool CivHydrCalc::hydrSimulation(char* fileName, char* rptFile, char* binOutFile
return false;
}
float dHStep;
ENGetVal(4, &dHStep);
// 计算
do
{
int nLinkCount;
ENgetcount(EN_LINKCOUNT, &nLinkCount);
for (int i = 1; i <= nLinkCount; i++)
/*for (int i = 1; i <= nLinkCount; i++)
{
int linkType;
char id[128] = "";
ENgetlinktype(i, &linkType);
ENgetlinkid(i, id);
}
}*/
if (ENrunH(&t) > 100) // errcode > 100 是错误
{
......@@ -67,15 +69,13 @@ bool CivHydrCalc::hydrSimulation(char* fileName, char* rptFile, char* binOutFile
return false;
}
ENnextH(&tstep);
iTime++;
// 获取当前节点和管段数据
getNodeResult(t);
getLinkResult(t);
getNodeResult(iTime);
getLinkResult(iTime);
iTime++;
} while (tstep > 0);
// 获取计算结果
return true;
}
......@@ -141,9 +141,7 @@ bool CivHydrCalc::exportInp(char* fileName)
}
void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
{
{
// 根据组建类型解析字段
if (PIPELINE == table)
{
......@@ -307,7 +305,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
// 水池数据
CivItem tankNode;
tankNode.push_back("P"+id);
tankNode.push_back(id);
tankNode.push_back(node1);
tankNode.push_back(node2);
......@@ -391,7 +389,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
// 阀门数据
CivItem vavleNode;
vavleNode.push_back("V"+id);
vavleNode.push_back(id);
vavleNode.push_back(node1);
vavleNode.push_back(node2);
vavleNode.push_back(diametor);
......@@ -436,7 +434,7 @@ void CivHydrCalc::getNodeResult(short time)
nodeItems.push_back(nodeItem);
}
mDbConn->updateNode(nodeItems);
mDbConn->updateNode(nodeItems);
}
void CivHydrCalc::getLinkResult(short time)
......@@ -489,5 +487,5 @@ void CivHydrCalc::getLinkResult(short time)
linkItems.push_back(linkItem);
}
mDbConn->updateLink(linkItems);
mDbConn->updateLink(linkItems);
}
This diff is collapsed.
......@@ -30,13 +30,13 @@ public:
*@brief 获取管网的所有表
*@netName: 管网名
*/
Tables getTables(StrQuote netName, StrQuote schema = "public") const;
Tables getTables(StrQuote netName, StrQuote schema = "public");
/**
*@brief 获取管网组件数据:管线,节点,水源等(必须组件)
*@tableName: 组件表
*/
Componets getComponets(StrQuote tableName) const;
Componets getComponets(StrQuote tableName);
/**
*@brief 水泵,阀门 (节点转换为管线)
......@@ -81,19 +81,28 @@ private:
*@table: 线表
*@code:
*/
Componets getLineByCode(StrQuote table, StrQuote code) const;
Componets getLineByCode(StrQuote table, StrQuote code);
Componets getNodeByCode(StrQuote table, StrQuote code) const;
Componets getNodeByCode(StrQuote table, StrQuote code);
/**
*@brief 执行sql语句
*@sql: 需要执行的sql语句
*/
bool execSql(std::string sql);
void clearResult();
/**
*@brief 从查询集取出数据
*@result: 查询结果集
*@comp: 数据容器
*/
void getData(PGresult* result, Componets& comp) const;
void getData(PGresult* result, Componets& comp);
private:
PGconn* mConn;
PGresult* mResult;
bool mIsOpen = false;
char* mUri;
......
#include "CivTableTemp.h"
#include <fstream>
CivTableTemp::CivTableTemp(std::string tableName)
:mTableName(tableName)
......@@ -32,6 +33,7 @@ std::string CivTableTemp::createSql()
if (mPropertys.size() <= 0)
return "";
char sql[512] = "create table ";
strcat_s(sql, mTableName.c_str());
strcat_s(sql, "(id serial primary key");
......
......@@ -179,11 +179,11 @@ struct LinkFiledName
Str nFlowDirect = "流向";
Str dVelocity="流速";
Str dHeadloss="水头损失";
Str dUnitHeadloss="单位水头损";
Str dUnitHeadloss="单位水头损";
Str dFromNodHeadloss="上点水头";
Str dToNodHeadloss="本点水头";
Str dLocalHeadloss="局部水头损";
Str dFrictionHeadloss="摩擦水头损";
Str dLocalHeadloss="局部水头损";
Str dFrictionHeadloss="摩擦水头损";
Str szStatus="状态";
Str lTime = "时间";
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment