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
2dd32d84
Commit
2dd32d84
authored
Dec 29, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
阀门处理方式更改
parent
d6aa5e6c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
214 additions
and
265 deletions
+214
-265
CivHydrFuncInter.cpp
pandaAnalysis/CivHydrFuncInter.cpp
+3
-0
CivInpDbHelper.cpp
pandaDbManager/CivInpDbHelper.cpp
+208
-265
CivInpDbHelper.h
pandaDbManager/CivInpDbHelper.h
+3
-0
No files found.
pandaAnalysis/CivHydrFuncInter.cpp
View file @
2dd32d84
...
@@ -175,5 +175,7 @@ bool PANDANALYSIS_API residualChlorineAnalysis(char* uri, char* conditionMap,cha
...
@@ -175,5 +175,7 @@ bool PANDANALYSIS_API residualChlorineAnalysis(char* uri, char* conditionMap,cha
std
::
string
uriStr
=
uri
;
std
::
string
uriStr
=
uri
;
std
::
string
conditionMapStr
=
conditionMap
;
std
::
string
conditionMapStr
=
conditionMap
;
return
true
;
return
true
;
}
}
\ No newline at end of file
pandaDbManager/CivInpDbHelper.cpp
View file @
2dd32d84
...
@@ -149,36 +149,6 @@ bool CivInpDbHelper::getValve(CivValve& valves)
...
@@ -149,36 +149,6 @@ bool CivInpDbHelper::getValve(CivValve& valves)
{
{
valves
.
addItem
(
mValuvesVec
[
i
]);
valves
.
addItem
(
mValuvesVec
[
i
]);
}
}
/*ValveTable vaTable;
std::vector<std::string> fields;
fields.push_back(vaTable.sn);
fields.push_back(vaTable.startPoint);
fields.push_back(vaTable.endPoint);
fields.push_back(vaTable.length);
fields.push_back(vaTable.type);
fields.push_back(vaTable.setting);
fields.push_back(vaTable.lossCoeff);
std::vector<std::map<std::string, std::string>> resultVector;
mDbConn->query(VALVE, fields, resultVector, mCondtion);
size_t totals = resultVector.size();
for (int i = 0; i < totals; i++)
{
CivValve::ValveTable pump;
std::map<std::string, std::string> map = resultVector[i];
pump.ID = map.find(vaTable.sn)->second;
pump.Node1 = map.find(vaTable.startPoint)->second;
pump.Node2 = map.find(vaTable.endPoint)->second;
pump.Diameter =map.find(vaTable.length)->second;
pump.Type = map.find(vaTable.type)->second;
pump.Setting = map.find(vaTable.setting)->second;
pump.MinorLoss = map.find(vaTable.lossCoeff)->second;
valves.addItem(pump);
}*/
return
true
;
return
true
;
}
}
...
@@ -350,252 +320,224 @@ void CivInpDbHelper::handlePump()
...
@@ -350,252 +320,224 @@ void CivInpDbHelper::handlePump()
}
}
void
CivInpDbHelper
::
handleValve
()
bool
CivInpDbHelper
::
handleValves2
()
{
{
//阀门的下游管段
std
::
string
sql
=
"SELECT A.*,B.* FROM\
std
::
string
dwPipeSql
=
"select pipe.
\"
编号
\"
, ('UP' || pipe.
\"
起始节点
\"
) as
\"
起始节点
\"
, pipe.
\"
终止节点
\"
, pipe.
\"
管长
\"
, pipe.
\"
管径
\"
,\
(\
pipe.
\"
摩阻系数
\"
,pipe.
\"
局损系数
\"
from
\"
管段
\"
as pipe where pipe.
\"
from_layer
\"
= '阀门'"
;
SELECT\
node.
\"
本点号
\"
,\
if
(
!
mDbConn
->
execSql
(
dwPipeSql
))
node.
\"
横坐标
\"
AS 阀门横坐标,\
return
;
node.
\"
纵坐标
\"
AS 阀门纵坐标,\
node.
\"
固定状态
\"
AS 阀门固定状态,\
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
upPipes
;
node.
\"
类型
\"
AS 阀门类型,\
mDbConn
->
queryResult
(
upPipes
);
node.
\"
设置
\"
AS 阀门设置,\
node.
\"
水损系数
\"
AS 阀门水损系数,\
size_t
total
=
upPipes
.
size
();
pipe.编号 AS 上游管段编号,\
for
(
int
i
=
0
;
i
<
total
;
i
++
)
pipe.
\"
管长
\"
AS 上游管长,\
{
pipe.
\"
管径
\"
AS 上游管径,\
std
::
map
<
std
::
string
,
std
::
string
>
pipe
=
upPipes
[
i
];
pipe.
\"
摩阻系数
\"
AS 上游管段摩阻系数,\
junc.
\"
本点号
\"
AS 上游节点,\
CivPipe
::
Table
pipeStruct
;
junc.
\"
code
\"
AS 上游节点code,\
pipeStruct
.
ID
=
pipe
.
find
(
"编号"
)
->
second
;
junc.
\"
高程
\"
AS 上游节点高程,\
junc.
\"
需水量模式
\"
AS 上游节点蓄水量模式,\
if
(
pipe
.
find
(
"code"
)
!=
pipe
.
end
())
junc.
\"
基本需水量
\"
as 上游节点基本需水量,\
pipeStruct
.
code
=
pipe
.
find
(
"code"
)
->
second
;
junc.
\"
横坐标
\"
AS 上游节点横坐标,\
junc.
\"
纵坐标
\"
AS 上游节点纵坐标,\
pipeStruct
.
Node1
=
pipe
.
find
(
"起始节点"
)
->
second
;
junc.
\"
初始水质
\"
AS 上游节点初始水质\
pipeStruct
.
Node2
=
pipe
.
find
(
"终止节点"
)
->
second
;
FROM\
pipeStruct
.
Length
=
pipe
.
find
(
"管长"
)
->
second
;
阀门 AS node, 管段 AS pipe, 节点 as junc\
pipeStruct
.
Diameter
=
pipe
.
find
(
"管径"
)
->
second
;
WHERE\
pipeStruct
.
Roughness
=
pipe
.
find
(
"摩阻系数"
)
->
second
;
pipe.
\"
from_code
\"
= node.
\"
code
\"
AND pipe.
\"
to_code
\"
= junc.
\"
code
\"
\
pipeStruct
.
Status
=
"Open"
;
) A,\
pipeStruct
.
MinorLoss
=
pipe
.
find
(
"局损系数"
)
->
second
;
(\
SELECT\
mPipesVec
.
push_back
(
pipeStruct
);
pipe.编号 AS 下游管段编号,\
}
pipe.
\"
管长
\"
AS 下游管段管长,\
pipe.
\"
管径
\"
AS 下游管段管径,\
// 阀门的上游管段
pipe.
\"
摩阻系数
\"
AS 下游管段摩阻系数,\
std
::
string
upPipeSql
=
"select pipe.
\"
编号
\"
, pipe.
\"
起始节点
\"
, ('DW' || pipe.
\"
终止节点
\"
) as
\"
终止节点
\"
, pipe.
\"
管长
\"
, pipe.
\"
管径
\"
, \
node.
\"
本点号
\"
,\
pipe.
\"
摩阻系数
\"
,pipe.
\"
局损系数
\"
from
\"
管段
\"
as pipe where pipe.
\"
to_layer
\"
= '阀门'"
;
junc.
\"
本点号
\"
AS 下游节点,\
junc.
\"
code
\"
AS 上游节点code,\
if
(
!
mDbConn
->
execSql
(
upPipeSql
))
junc.
\"
高程
\"
AS 下游节点高程,\
return
;
junc.
\"
需水量模式
\"
AS 下游节点蓄水量模式,\
junc.
\"
基本需水量
\"
as 下游节点基本需水量,\
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
downPipes
;
junc.
\"
横坐标
\"
AS 下游节点横坐标,\
mDbConn
->
queryResult
(
downPipes
);
junc.
\"
纵坐标
\"
AS 下游节点纵坐标,\
junc.
\"
初始水质
\"
AS 下游节点初始水质\
size_t
dtotal
=
downPipes
.
size
();
FROM\
for
(
int
i
=
0
;
i
<
dtotal
;
i
++
)
阀门 AS node, 管段 AS pipe, 节点 as junc\
{
WHERE\
std
::
map
<
std
::
string
,
std
::
string
>
pipe
=
downPipes
[
i
];
pipe.
\"
to_code
\"
= node.
\"
code
\"
AND pipe.
\"
from_code
\"
= junc.
\"
code
\"
\
) B\
CivPipe
::
Table
pipeStruct
;
WHERE\
A.
\"
本点号
\"
= b.
\"
本点号
\"
"
;
auto
iterEnd
=
pipe
.
end
();
if
(
!
mDbConn
->
execSql
(
sql
))
if
(
pipe
.
find
(
"编号"
)
!=
iterEnd
)
pipeStruct
.
ID
=
pipe
.
find
(
"编号"
)
->
second
;
if
(
pipe
.
find
(
"code"
)
!=
iterEnd
)
pipeStruct
.
code
=
pipe
.
find
(
"code"
)
->
second
;
if
(
pipe
.
find
(
"起始节点"
)
!=
iterEnd
)
pipeStruct
.
Node1
=
pipe
.
find
(
"起始节点"
)
->
second
;
if
(
pipe
.
find
(
"终止节点"
)
!=
iterEnd
)
pipeStruct
.
Node2
=
pipe
.
find
(
"终止节点"
)
->
second
;
if
(
pipe
.
find
(
"管长"
)
!=
iterEnd
)
pipeStruct
.
Length
=
pipe
.
find
(
"管长"
)
->
second
;
if
(
pipe
.
find
(
"管径"
)
!=
iterEnd
)
pipeStruct
.
Diameter
=
pipe
.
find
(
"管径"
)
->
second
;
if
(
pipe
.
find
(
"摩阻系数"
)
!=
iterEnd
)
pipeStruct
.
Roughness
=
pipe
.
find
(
"摩阻系数"
)
->
second
;
pipeStruct
.
Status
=
"Open"
;
if
(
pipe
.
find
(
"局损系数"
)
!=
iterEnd
)
pipeStruct
.
MinorLoss
=
pipe
.
find
(
"局损系数"
)
->
second
;
mPipesVec
.
push_back
(
pipeStruct
);
}
//-- 阀门信息--
// 构造阀门起始节点
std
::
string
vaStartSql
=
"SELECT \
'UP' || va.
\"
本点号
\"
AS
\"
本点号
\"
, vnode.
\"
高程
\"
, vnode.
\"
基本需水量
\"
, vnode.
\"
需水量模式
\"
\
, (va.
\"
横坐标
\"
- 1) AS
\"
横坐标
\"
, (va.
\"
纵坐标
\"
- 1) AS
\"
纵坐标
\"
, va.
\"
本点号
\"
as
\"
阀门本点号
\"
,\
va.
\"
类型
\"
as
\"
阀门类型
\"
, ('UP' || va.
\"
本点号
\"
) as
\"
阀门起始节点
\"
, \
va.
\"
直径
\"
as
\"
阀门直径
\"
,va.
\"
固定状态
\"
as
\"
阀门状态
\"
,va.
\"
设置
\"
as
\"
阀门设置
\"
,va.
\"
水损系数
\"
\
FROM
\"
阀门
\"
va, ( \
SELECT node.
\"
本点号
\"
, node.
\"
高程
\"
, node.
\"
基本需水量
\"
, node.
\"
需水量模式
\"
, node.
\"
横坐标
\"
\
, node.
\"
纵坐标
\"
, va.
\"
终止节点
\"
\
FROM
\"
节点
\"
node, (\
SELECT pipe.
\"
编号
\"
, pipe.
\"
起始节点
\"
, pipe.
\"
终止节点
\"
, pipe.
\"
管长
\"
, pipe.
\"
管径
\"
\
, pipe.
\"
摩阻系数
\"
\
FROM
\"
管段
\"
pipe\
WHERE pipe.
\"
to_layer
\"
= '阀门'\
) va\
WHERE node.
\"
本点号
\"
= va.
\"
起始节点
\"
\
) vnode \
WHERE vnode.
\"
终止节点
\"
= va.
\"
本点号
\"
"
;
if
(
!
mDbConn
->
execSql
(
vaStartSql
))
return
;
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
valvesVec
;
mDbConn
->
queryResult
(
valvesVec
);
std
::
map
<
std
::
string
,
CivValve
::
ValveTable
>
valveTableMap
;
std
::
map
<
std
::
string
,
CivPipe
::
PipesTable
>
pipeTableMap
;
size_t
valvsSize
=
valvesVec
.
size
();
for
(
int
i
=
0
;
i
<
valvsSize
;
i
++
)
{
std
::
map
<
std
::
string
,
std
::
string
>
valveMap
=
valvesVec
[
i
];
// 构造节点
CivNode
::
NodeTable
nodeTable
;
std
::
string
szNo
=
valveMap
.
find
(
"本点号"
)
->
second
;
nodeTable
.
ID
=
szNo
;
nodeTable
.
Elev
=
valveMap
.
find
(
"高程"
)
->
second
;
std
::
string
patternID
=
valveMap
.
find
(
"需水量模式"
)
->
second
;
std
::
string
demand
=
valveMap
.
find
(
"基本需水量"
)
->
second
;
handleDelayPattern
(
demand
,
patternID
,
nodeTable
.
Demand
,
nodeTable
.
PatternId
);
mNodeVec
.
push_back
(
nodeTable
);
// 节点坐标
CivCoordinates
::
CoordTable
coordTable
;
coordTable
.
ID
=
szNo
;
coordTable
.
XCoord
=
valveMap
.
find
(
"横坐标"
)
->
second
;
coordTable
.
YCoord
=
valveMap
.
find
(
"纵坐标"
)
->
second
;
mCoords
.
push_back
(
coordTable
);
std
::
string
valveSn
=
valveMap
.
find
(
"阀门本点号"
)
->
second
;
std
::
string
valveType
=
valveMap
.
find
(
"阀门类型"
)
->
second
;
if
(
valveType
==
"BV"
)
// 止回阀,转成管段
{
CivPipe
::
Table
pipeStruct
;
pipeStruct
.
ID
=
valveSn
;
pipeStruct
.
Node1
=
szNo
;
pipeStruct
.
Length
=
"2"
;
pipeStruct
.
Diameter
=
valveMap
.
find
(
"阀门直径"
)
->
second
;
pipeStruct
.
Roughness
=
std
::
string
(
"130"
);
//valveMap.find("摩阻系数")->second;
pipeStruct
.
Status
=
(
valveMap
.
find
(
"阀门状态"
)
->
second
==
"Open"
)
?
"Open"
:
"CV"
;
pipeStruct
.
MinorLoss
=
"0"
;
auto
pter
=
std
::
make_pair
(
valveSn
,
pipeStruct
);
pipeTableMap
.
insert
(
pter
);
}
else
{
// 阀门
CivValve
::
ValveTable
valveTable
;
valveTable
.
ID
=
valveSn
;
valveTable
.
Node1
=
szNo
;
valveTable
.
Diameter
=
valveMap
.
find
(
"阀门直径"
)
->
second
;
valveTable
.
Type
=
valveType
;
valveTable
.
Setting
=
valveMap
.
find
(
"阀门设置"
)
->
second
;
valveTable
.
MinorLoss
=
valveMap
.
find
(
"水损系数"
)
->
second
;
valveTableMap
.
insert
(
std
::
make_pair
(
szNo
,
valveTable
));
// 阀门状态组件
CivStatus
::
StatusTable
statusTable
;
statusTable
.
ID
=
valveSn
;
statusTable
.
Setting
=
valveMap
.
find
(
"固定状态"
)
->
second
;
mStatusVec
.
push_back
(
statusTable
);
}
}
//--构造阀门终止节点
std
::
string
vaEndSql
=
"SELECT\
'DW' || va.
\"
本点号
\"
AS
\"
本点号
\"
, vnode.
\"
高程
\"
, vnode.
\"
基本需水量
\"
, vnode.
\"
需水量模式
\"
\
, (va.
\"
横坐标
\"
+ 1) AS
\"
横坐标
\"
, (va.
\"
纵坐标
\"
+ 1) AS
\"
纵坐标
\"
, va.
\"
本点号
\"
as
\"
阀门本点号
\"
,\
va.
\"
类型
\"
as
\"
阀门类型
\"
, ('DW' || va.
\"
本点号
\"
) as
\"
阀门终止节点
\"
\
FROM
\"
阀门
\"
va, (\
SELECT node.
\"
本点号
\"
, node.
\"
高程
\"
, node.
\"
基本需水量
\"
, node.
\"
需水量模式
\"
, node.
\"
横坐标
\"
\
, node.
\"
纵坐标
\"
, va.
\"
起始节点
\"
\
FROM
\"
节点
\"
node, (\
SELECT pipe.
\"
编号
\"
, pipe.
\"
起始节点
\"
, pipe.
\"
终止节点
\"
, pipe.
\"
管长
\"
, pipe.
\"
管径
\"
\
, pipe.
\"
摩阻系数
\"
\
FROM
\"
管段
\"
pipe\
WHERE pipe.
\"
from_layer
\"
= '阀门'\
) va\
WHERE node.
\"
本点号
\"
= va.
\"
终止节点
\"
\
) vnode\
WHERE vnode.
\"
起始节点
\"
= va.
\"
本点号
\"
"
;
if
(
!
mDbConn
->
execSql
(
vaEndSql
))
return
;
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
valvesEndVec
;
mDbConn
->
queryResult
(
valvesEndVec
);
size_t
endVecSize
=
valvesEndVec
.
size
();
for
(
int
i
=
0
;
i
<
endVecSize
;
i
++
)
{
{
std
::
map
<
std
::
string
,
std
::
string
>
valveMap
=
valvesEndVec
[
i
];
std
::
string
error
=
mDbConn
->
getLastError
();
return
false
;
// 构造节点
}
CivNode
::
NodeTable
nodeTable
;
std
::
string
szNo
=
valveMap
.
find
(
"本点号"
)
->
second
;
nodeTable
.
ID
=
szNo
;
nodeTable
.
Elev
=
valveMap
.
find
(
"高程"
)
->
second
;
std
::
string
patternID
=
valveMap
.
find
(
"需水量模式"
)
->
second
;
// 查询与阀门关联的管段,和节点
std
::
string
demand
=
valveMap
.
find
(
"基本需水量"
)
->
second
;
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
valvesPipes
;
handleDelayPattern
(
demand
,
patternID
,
nodeTable
.
Demand
,
nodeTable
.
PatternId
);
mDbConn
->
queryResult
(
valvesPipes
);
mNodeVec
.
push_back
(
nodeTable
);
// 总个数
size_t
total
=
valvesPipes
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
std
::
map
<
std
::
string
,
std
::
string
>
valvePipe
=
valvesPipes
[
i
];
std
::
string
vaSzNo
=
valvePipe
.
find
(
"本点号"
)
->
second
;
std
::
string
vaXcoord
=
valvePipe
.
find
(
"阀门横坐标"
)
->
second
;
std
::
string
vaYcoord
=
valvePipe
.
find
(
"阀门纵坐标"
)
->
second
;
std
::
string
vaStatus
=
valvePipe
.
find
(
"阀门固定状态"
)
->
second
;
std
::
string
vaType
=
valvePipe
.
find
(
"阀门类型"
)
->
second
;
std
::
string
vaSetting
=
valvePipe
.
find
(
"阀门设置"
)
->
second
;
std
::
string
vaLoss
=
valvePipe
.
find
(
"阀门水损系数"
)
->
second
;
std
::
string
upperPipeSzNo
=
valvePipe
.
find
(
"上游管段编号"
)
->
second
;
std
::
string
upperPipeCode
=
valvePipe
.
find
(
"上游管段code"
)
->
second
;
std
::
string
upperPipeLength
=
valvePipe
.
find
(
"上游管长"
)
->
second
;
std
::
string
upperPipeDiametor
=
valvePipe
.
find
(
"上游管径"
)
->
second
;
std
::
string
upperPipeFriction
=
valvePipe
.
find
(
"下游管段摩阻系数"
)
->
second
;
std
::
string
upperNodeSz
=
valvePipe
.
find
(
"上游节点"
)
->
second
;
std
::
string
upperNodeHeight
=
valvePipe
.
find
(
"上游节点高程"
)
->
second
;
std
::
string
upperNodePattern
=
valvePipe
.
find
(
"上游节点蓄水量模式"
)
->
second
;
std
::
string
upperNodeDemand
=
valvePipe
.
find
(
"上游节点基本需水量"
)
->
second
;
std
::
string
upperNodeXcoord
=
valvePipe
.
find
(
"上游节点横坐标"
)
->
second
;
std
::
string
upperNodeYcoord
=
valvePipe
.
find
(
"上游节点纵坐标"
)
->
second
;
std
::
string
upperNodeQuality
=
valvePipe
.
find
(
"上游节点初始水质"
)
->
second
;
std
::
string
donwPipeSz
=
valvePipe
.
find
(
"下游管段编号"
)
->
second
;
std
::
string
donwPipeCode
=
valvePipe
.
find
(
"下游管段code"
)
->
second
;
std
::
string
donwPipeLength
=
valvePipe
.
find
(
"下游管段管长"
)
->
second
;
std
::
string
donwPipeDiametor
=
valvePipe
.
find
(
"下游管段管径"
)
->
second
;
std
::
string
downPipeFraction
=
valvePipe
.
find
(
"下游管段摩阻系数"
)
->
second
;
std
::
string
donwNodeSz
=
valvePipe
.
find
(
"下游节点"
)
->
second
;
std
::
string
donwNodeHeight
=
valvePipe
.
find
(
"下游节点高程"
)
->
second
;
std
::
string
donwNodePattern
=
valvePipe
.
find
(
"下游节点蓄水量模式"
)
->
second
;
std
::
string
donwNodeDemand
=
valvePipe
.
find
(
"下游节点基本需水量"
)
->
second
;
std
::
string
donwNodeXcoord
=
valvePipe
.
find
(
"下游节点横坐标"
)
->
second
;
std
::
string
donwNodeYcoord
=
valvePipe
.
find
(
"下游节点纵坐标"
)
->
second
;
std
::
string
donwNodeQuality
=
valvePipe
.
find
(
"下游节点初始水质"
)
->
second
;
// 判断阀门类型
std
::
string
upperVaType
=
vaType
;
std
::
transform
(
vaType
.
begin
(),
vaType
.
begin
(),
vaType
.
end
(),
::
toupper
);
// 阀门需要构造两个虚拟节点,两个节点尽可能接近
CivNode
::
NodeTable
startNodeTable
;
CivCoordinates
::
CoordTable
startNodeCoord
;
// 节点坐标
// 节点信息
startNodeTable
.
ID
=
"VUP"
+
vaSzNo
;
startNodeTable
.
Elev
=
upperNodeHeight
;
startNodeTable
.
Demand
=
"0"
;
// 两点之间直线
double
vupperXcoord
=
(
atof
(
upperNodeXcoord
.
c_str
())
-
atof
(
vaXcoord
.
c_str
()))
/
5
+
atof
(
vaXcoord
.
c_str
());
double
vupperYcoord
=
(
atof
(
upperNodeYcoord
.
c_str
())
-
atof
(
vaYcoord
.
c_str
()))
/
5
+
atof
(
vaYcoord
.
c_str
());
// 节点坐标
// 节点坐标
CivCoordinates
::
CoordTable
coordTable
;
startNodeCoord
.
ID
=
"VUP"
+
vaSzNo
;
coordTable
.
ID
=
szNo
;
startNodeCoord
.
XCoord
=
std
::
to_string
(
vupperXcoord
);
coordTable
.
XCoord
=
valveMap
.
find
(
"横坐标"
)
->
second
;
startNodeCoord
.
YCoord
=
std
::
to_string
(
vupperYcoord
);
coordTable
.
YCoord
=
valveMap
.
find
(
"纵坐标"
)
->
second
;
// 终止节点构造
mCoords
.
push_back
(
coordTable
);
CivNode
::
NodeTable
endNodeTable
;
// 终止节点
CivCoordinates
::
CoordTable
endNodeCoord
;
// 终止节点坐标
std
::
string
valveSn
=
valveMap
.
find
(
"阀门本点号"
)
->
second
;
std
::
string
valveType
=
valveMap
.
find
(
"阀门类型"
)
->
second
;
// 终止节点信息
endNodeTable
.
ID
=
"VDW"
+
vaSzNo
;
if
(
valveType
==
"BV"
)
// 止回阀,转成管段
endNodeTable
.
Elev
=
upperNodeHeight
;
endNodeTable
.
Demand
=
"0"
;
mNodeVec
.
push_back
(
startNodeTable
);
mCoords
.
push_back
(
startNodeCoord
);
// 两点之间直线
double
vdownXcoord
=
(
atof
(
donwNodeXcoord
.
c_str
())
-
atof
(
vaXcoord
.
c_str
()))
/
5
+
atof
(
vaXcoord
.
c_str
());
double
vdownYcoord
=
(
atof
(
donwNodeYcoord
.
c_str
())
-
atof
(
vaYcoord
.
c_str
()))
/
5
+
atof
(
vaYcoord
.
c_str
());
// 终止节点坐标信息
endNodeCoord
.
ID
=
"VDW"
+
vaSzNo
;
endNodeCoord
.
XCoord
=
std
::
to_string
(
vdownXcoord
);
endNodeCoord
.
YCoord
=
std
::
to_string
(
vdownYcoord
);
mNodeVec
.
push_back
(
endNodeTable
);
mCoords
.
push_back
(
endNodeCoord
);
// 构造上游管段的
CivPipe
::
PipesTable
upperPipeTable
;
CivPipe
::
PipesTable
downPipeTable
;
// 上游管段属性
upperPipeTable
.
code
=
upperPipeCode
;
upperPipeTable
.
ID
=
upperPipeSzNo
;
upperPipeTable
.
Node1
=
upperNodeSz
;
upperPipeTable
.
Node2
=
startNodeTable
.
ID
;
upperPipeTable
.
Length
=
upperPipeLength
;
upperPipeTable
.
Diameter
=
upperPipeDiametor
;
upperPipeTable
.
Roughness
=
upperPipeFriction
;
upperPipeTable
.
Status
=
"Open"
;
upperPipeTable
.
MinorLoss
=
vaLoss
;
// 下游管段属性
downPipeTable
.
code
=
donwPipeCode
;
downPipeTable
.
ID
=
donwPipeSz
;
downPipeTable
.
Node1
=
endNodeTable
.
ID
;
downPipeTable
.
Node2
=
donwNodeSz
;
downPipeTable
.
Length
=
donwPipeLength
;
downPipeTable
.
Diameter
=
donwPipeDiametor
;
downPipeTable
.
Roughness
=
upperPipeFriction
;
downPipeTable
.
Status
=
"Open"
;
downPipeTable
.
MinorLoss
=
vaLoss
;
mPipesVec
.
push_back
(
downPipeTable
);
mPipesVec
.
push_back
(
upperPipeTable
);
// 普通阀门等效于管段
if
(
upperVaType
==
"BV"
)
{
{
auto
iter
=
pipeTableMap
.
find
(
valveSn
);
// 构造一条虚拟管段
if
(
iter
!=
pipeTableMap
.
end
())
CivPipe
::
PipesTable
vPipeTable
;
{
vPipeTable
.
ID
=
"VG"
+
vaSzNo
;
pipeTableMap
[
valveSn
].
Node2
=
szNo
;
vPipeTable
.
Node1
=
startNodeTable
.
ID
;
mPipesVec
.
push_back
(
iter
->
second
);
vPipeTable
.
Node2
=
endNodeTable
.
ID
;
}
vPipeTable
.
Length
=
donwPipeLength
;
vPipeTable
.
Diameter
=
donwPipeDiametor
;
vPipeTable
.
Roughness
=
upperPipeFriction
;
vPipeTable
.
Status
=
vaStatus
;
vPipeTable
.
MinorLoss
=
vaLoss
;
mPipesVec
.
push_back
(
vPipeTable
);
}
}
else
else
{
{
// 阀门
// 阀门
auto
iter
=
valveTableMap
.
find
(
valveSn
);
CivValve
::
ValveTable
valveTable
;
if
(
iter
!=
valveTableMap
.
end
())
valveTable
.
ID
=
vaSzNo
;
{
valveTable
.
Node1
=
startNodeTable
.
ID
;
valveTableMap
[
valveSn
].
Node2
=
szNo
;
valveTable
.
Node2
=
endNodeTable
.
ID
;
mValuvesVec
.
push_back
(
iter
->
second
);
valveTable
.
Diameter
=
upperPipeDiametor
;
}
valveTable
.
Type
=
vaType
;
valveTable
.
Setting
=
vaSetting
;
valveTable
.
MinorLoss
=
vaLoss
;
mValuvesVec
.
push_back
(
valveTable
);
// 阀门状态组件
CivStatus
::
StatusTable
statusTable
;
statusTable
.
ID
=
vaSzNo
;
statusTable
.
Setting
=
vaStatus
;
mStatusVec
.
push_back
(
statusTable
);
}
}
}
}
}
void
CivInpDbHelper
::
handleValve
()
{
handleValves2
();
return
;
}
}
\ No newline at end of file
pandaDbManager/CivInpDbHelper.h
View file @
2dd32d84
...
@@ -25,4 +25,7 @@ public:
...
@@ -25,4 +25,7 @@ public:
bool
getQuality
(
CivQuality
&
quality
)
override
;
bool
getQuality
(
CivQuality
&
quality
)
override
;
bool
getStatus
(
CivStatus
&
status
)
override
;
bool
getStatus
(
CivStatus
&
status
)
override
;
private
:
bool
handleValves2
();
};
};
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