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

1, 模型改进

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