Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hydraulicModel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘乐
hydraulicModel
Commits
7eeb415e
Commit
7eeb415e
authored
Jun 15, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1, 模型改进
parent
49d41dc4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
23 deletions
+32
-23
CivHydrCalc.cpp
pandaAnalysis/CivHydrCalc.cpp
+13
-15
CivDbConnection.cpp
pandaDbManager/CivDbConnection.cpp
+0
-0
CivDbConnection.h
pandaDbManager/CivDbConnection.h
+14
-5
CivTableTemp.cpp
pandaDbManager/CivTableTemp.cpp
+2
-0
CivTypes.h
pandaDbManager/CivTypes.h
+3
-3
~$水力模型.docx
建模文档/~$水力模型.docx
+0
-0
水力模型.docx
建模文档/水力模型.docx
+0
-0
No files found.
pandaAnalysis/CivHydrCalc.cpp
View file @
7eeb415e
...
...
@@ -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
);
}
pandaDbManager/CivDbConnection.cpp
View file @
7eeb415e
This diff is collapsed.
Click to expand it.
pandaDbManager/CivDbConnection.h
View file @
7eeb415e
...
...
@@ -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
;
...
...
pandaDbManager/CivTableTemp.cpp
View file @
7eeb415e
#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"
);
...
...
pandaDbManager/CivTypes.h
View file @
7eeb415e
...
...
@@ -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
=
"时间"
;
};
...
...
建模文档/~$水力模型.docx
View file @
7eeb415e
No preview for this file type
建模文档/水力模型.docx
View file @
7eeb415e
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment