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
e70c7e93
Commit
e70c7e93
authored
Aug 09, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1, 类拆分
parent
2b546d06
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
1151 additions
and
2467 deletions
+1151
-2467
CivHydrTest.cpp
funcDemo/CivHydrTest.cpp
+0
-15
CivHydrTest.h
funcDemo/CivHydrTest.h
+0
-8
main.cpp
funcDemo/main.cpp
+4
-12
CivBaseInpBuilder.cpp
pandaAnalysis/CivBaseInpBuilder.cpp
+252
-0
CivBaseInpBuilder.h
pandaAnalysis/CivBaseInpBuilder.h
+35
-0
CivHydrCompute.cpp
pandaAnalysis/CivHydrCompute.cpp
+284
-4
CivHydrCompute.h
pandaAnalysis/CivHydrCompute.h
+19
-6
CivHydrFuncInter.cpp
pandaAnalysis/CivHydrFuncInter.cpp
+0
-24
CivHydrFuncInter.h
pandaAnalysis/CivHydrFuncInter.h
+0
-9
CivHydrSimulation.cpp
pandaAnalysis/CivHydrSimulation.cpp
+4
-604
CivHydrSimulation.h
pandaAnalysis/CivHydrSimulation.h
+9
-84
CivInpBuilder.cpp
pandaAnalysis/CivInpBuilder.cpp
+4
-32
CivInpBuilder.h
pandaAnalysis/CivInpBuilder.h
+7
-52
CivInpConvertor.cpp
pandaAnalysis/CivInpConvertor.cpp
+6
-0
CivInpConvertor.h
pandaAnalysis/CivInpConvertor.h
+4
-16
CivProjInpBuilder.cpp
pandaAnalysis/CivProjInpBuilder.cpp
+0
-17
CivProjInpBuilder.h
pandaAnalysis/CivProjInpBuilder.h
+2
-5
pandaAnalysis.vcxproj
pandaAnalysis/pandaAnalysis.vcxproj
+4
-2
pandaAnalysis.vcxproj.filters
pandaAnalysis/pandaAnalysis.vcxproj.filters
+13
-6
CivAssembly.h
pandaDbManager/CivAssembly.h
+5
-13
CivDbConn.h
pandaDbManager/CivDbConn.h
+0
-6
CivDbUtils.cpp
pandaDbManager/CivDbUtils.cpp
+0
-8
CivDbUtils.h
pandaDbManager/CivDbUtils.h
+0
-12
CivInpDbHelper.cpp
pandaDbManager/CivInpDbHelper.cpp
+56
-50
CivInpHelperAbs.cpp
pandaDbManager/CivInpHelperAbs.cpp
+1
-292
CivInpHelperAbs.h
pandaDbManager/CivInpHelperAbs.h
+1
-2
CivPgConn.cpp
pandaDbManager/CivPgConn.cpp
+5
-90
CivPgConn.h
pandaDbManager/CivPgConn.h
+0
-10
CivTableTemp.cpp
pandaDbManager/CivTableTemp.cpp
+0
-527
CivTableTemp.h
pandaDbManager/CivTableTemp.h
+311
-509
CivTrackingResultCache.cpp
pandaDbManager/CivTrackingResultCache.cpp
+8
-8
CivTrackingResultCache.h
pandaDbManager/CivTrackingResultCache.h
+4
-4
pandaDbManager.vcxproj
pandaDbManager/pandaDbManager.vcxproj
+0
-11
pandaDbManager.vcxproj.filters
pandaDbManager/pandaDbManager.vcxproj.filters
+0
-28
CivCsvReader.cpp
pandaLog/CivCsvReader.cpp
+70
-0
CivCsvReader.h
pandaLog/CivCsvReader.h
+32
-0
pandaLog.vcxproj
pandaLog/pandaLog.vcxproj
+4
-1
pandaLog.vcxproj.filters
pandaLog/pandaLog.vcxproj.filters
+7
-0
No files found.
funcDemo/CivHydrTest.cpp
View file @
e70c7e93
...
...
@@ -38,21 +38,6 @@ void CivConTrackTest::test(char* uri)
std
::
cout
<<
"测试结果:"
<<
succ
<<
std
::
endl
;
}
/**
获取时段数据
*/
void
CivConGetDataTest
::
test
(
char
*
uri
)
{
const
char
*
date
=
"2020-07-17"
;
char
*
dates
=
const_cast
<
char
*>
(
date
);
const
char
*
interval
=
"4"
;
char
*
intervals
=
const_cast
<
char
*>
(
interval
);
bool
isSucces
=
getDataByInterval
(
uri
,
dates
,
intervals
);
std
::
cout
<<
"测试结果:"
<<
isSucces
<<
std
::
endl
;
};
void
CivConGetRptTest
::
test
(
char
*
uri
)
{
...
...
funcDemo/CivHydrTest.h
View file @
e70c7e93
...
...
@@ -35,14 +35,6 @@ public:
virtual
void
test
(
char
*
uri
);
};
/**
获取时段数据
*/
class
CivConGetDataTest
:
public
CivHydrTest
{
public
:
virtual
void
test
(
char
*
uri
);
};
/**
获取水力分析报告测试
...
...
funcDemo/main.cpp
View file @
e70c7e93
...
...
@@ -14,12 +14,12 @@ using namespace std;
int
main
(
int
argc
,
char
*
argv
[])
{
const
char
*
uri
=
"host=192.168.1
9.100 port=5432 dbname=JinXian
user=postgres password=admin"
;
const
char
*
uri
=
"host=192.168.1
2.7 port=5432 dbname=tese1111
user=postgres password=admin"
;
char
*
findUri
=
const_cast
<
char
*>
(
uri
);
// 测试水力
/*
CivTestContext context(new CivConHydrTest());
context.contextTest(findUri);
*/
CivTestContext
context
(
new
CivConHydrTest
());
context
.
contextTest
(
findUri
);
// 测试水质
/*CivTestContext context(new CivConQuaTest());
...
...
@@ -57,15 +57,7 @@ int main(int argc, char* argv[])
/* CivTestContext context(new CivWaterSupplyScopeTest());
context.contextTest(findUri);*/
int
base
=
10000001
;
std
::
vector
<
std
::
string
>
vec
;
for
(
int
i
=
base
;
i
<
base
+
730
;
i
++
)
{
std
::
string
res
=
std
::
to_string
(
i
);
res
=
"JD"
+
res
.
substr
(
1
,
res
.
length
());
vec
.
push_back
(
res
);
std
::
cout
<<
res
<<
std
::
endl
;
}
getchar
();
return
0
;
...
...
pandaAnalysis/CivBaseInpBuilder.cpp
0 → 100644
View file @
e70c7e93
#include "CivBaseInpBuilder.h"
#include "CivInpBuilder.h"
#include "CivTypes.h"
#include "CivAssembly.h"
#define ASSERT(A,B) if ((A) == nullptr || (B) == nullptr) return;
CivBaseInpBuilder
::
CivBaseInpBuilder
()
:
CivInpBuilder
()
mNewInp
(
new
CivNewInp
())
{
}
CivBaseInpBuilder
::~
CivBaseInpBuilder
()
{
delete
mNewInp
;
}
CivNewInp
*
CivBaseInpBuilder
::
getNewInp
()
{
return
mNewInp
;
}
CivBaseInpBuilder
::
CivBaseInpBuilder
()
{
}
void
CivBaseInpBuilder
::
buildNode
()
{
CivNode
node
;
if
(
!
mDbConn
->
getNode
(
node
))
return
;
mNewInp
->
setNode
(
node
);
}
void
CivBaseInpBuilder
::
buildPipe
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivPipe
pipe
;
if
(
!
mDbConn
->
getPipe
(
pipe
))
return
;
mNewInp
->
setPipes
(
pipe
);
}
void
CivBaseInpBuilder
::
buildTank
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivTank
tank
;
if
(
!
mDbConn
->
getTank
(
tank
))
return
;
mNewInp
->
setTank
(
tank
);
}
void
CivBaseInpBuilder
::
buildVavle
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivValve
valve
;
if
(
!
mDbConn
->
getValve
(
valve
))
return
;
mNewInp
->
setValves
(
valve
);
}
void
CivBaseInpBuilder
::
buildPump
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivPumps
valve
;
if
(
!
mDbConn
->
getPumps
(
valve
))
return
;
mNewInp
->
setPumps
(
valve
);
}
void
CivBaseInpBuilder
::
buildReservoir
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivReservoirs
res
;
if
(
!
mDbConn
->
getReservoirs
(
res
))
return
;
mNewInp
->
setReservoirs
(
res
);
}
void
CivBaseInpBuilder
::
buildEmitter
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivEmitters
emmiters
;
if
(
!
mDbConn
->
getEmitters
(
emmiters
))
return
;
mNewInp
->
setEmitters
(
emmiters
);
}
void
CivBaseInpBuilder
::
buildPatterns
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivPatterns
pattern
;
if
(
!
mDbConn
->
getPatterns
(
pattern
))
return
;
mNewInp
->
setPatterns
(
pattern
);
}
void
CivBaseInpBuilder
::
buildParamter
()
{
ASSERT
(
mDbConn
,
mNewInp
)
std
::
vector
<
CivParameter
>
parameters
;
if
(
!
mDbConn
->
getParameter
(
parameters
))
return
;
size_t
total
=
parameters
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
CivParameter
param
=
parameters
[
i
];
mNewInp
->
setParamter
(
param
,
param
.
mType
);
}
}
void
CivBaseInpBuilder
::
buildCoordnates
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivCoordinates
coords
;
if
(
!
mDbConn
->
getCoordinates
(
coords
))
return
;
mNewInp
->
setCoordnates
(
coords
);
}
void
CivBaseInpBuilder
::
buildVertices
()
{
return
;
}
void
CivBaseInpBuilder
::
buildLabels
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivLabels
labels
;
if
(
!
mDbConn
->
getLabels
(
labels
))
return
;
mNewInp
->
setLabels
(
labels
);
}
void
CivBaseInpBuilder
::
buildTags
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivTags
tag
;
if
(
!
mDbConn
->
getTags
(
tag
))
return
;
mNewInp
->
setTags
(
tag
);
}
void
CivBaseInpBuilder
::
buildBackDrop
()
{
return
;
}
void
CivBaseInpBuilder
::
buildQuality
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivQuality
quality
;
if
(
!
mDbConn
->
getQuality
(
quality
))
return
;
mNewInp
->
setQuality
(
quality
);
}
void
CivBaseInpBuilder
::
buildSources
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivSources
sources
;
if
(
!
mDbConn
->
getSources
(
sources
))
return
;
mNewInp
->
setSources
(
sources
);
}
void
CivBaseInpBuilder
::
buildMixing
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivMixing
mixing
;
if
(
!
mDbConn
->
getMixing
(
mixing
))
return
;
mNewInp
->
setMixing
(
mixing
);
}
void
CivBaseInpBuilder
::
buildCurves
()
{
ASSERT
(
mDbConn
,
mNewInp
)
/*CivCurves curves;
if (!mDbConn->getCurves(curves))
return;
mNewInp->setCurves(curves);*/
}
void
CivBaseInpBuilder
::
buildStatus
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivStatus
status
;
if
(
!
mDbConn
->
getStatus
(
status
))
return
;
mNewInp
->
setStatus
(
status
);
}
void
CivBaseInpBuilder
::
buildControls
()
{
}
void
CivBaseInpBuilder
::
buildRules
()
{
}
void
CivBaseInpBuilder
::
buildDemands
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivDemands
mand
;
if
(
!
mDbConn
->
getDemands
(
mand
))
return
;
mNewInp
->
setDemands
(
mand
);
}
\ No newline at end of file
pandaAnalysis/CivBaseInpBuilder.h
0 → 100644
View file @
e70c7e93
#pragma once
#include "CivInpBuilder.h"
/**
* inpļ
*/
class
CivBaseInpBuilder
:
public
CivInpBuilder
{
public
:
explicit
CivBaseInpBuilder
();
~
CivBaseInpBuilder
();
virtual
void
buildNode
();
virtual
void
buildPipe
();
virtual
void
buildTank
();
virtual
void
buildVavle
();
virtual
void
buildPump
();
virtual
void
buildReservoir
();
virtual
void
buildEmitter
();
virtual
void
buildPatterns
();
virtual
void
buildParamter
();
virtual
void
buildCoordnates
();
virtual
void
buildVertices
();
virtual
void
buildLabels
();
virtual
void
buildTags
();
virtual
void
buildBackDrop
();
virtual
void
buildQuality
();
virtual
void
buildSources
();
virtual
void
buildMixing
();
virtual
void
buildCurves
();
virtual
void
buildStatus
();
virtual
void
buildControls
();
virtual
void
buildRules
();
virtual
void
buildDemands
();
};
pandaAnalysis/CivHydrCompute.cpp
View file @
e70c7e93
#include "CivHydrCompute.h"
#include "CivTypes.h"
CivHydrCompute
::
CivHydrCompute
()
CivHydrCompute
::
CivHydrCompute
(
char
*
inp
,
char
*
rptFile
,
char
*
binFile
)
:
mInpFile
(
inp
),
mRptFile
(
rptFile
),
mBinFile
(
binFile
)
{
}
bool
CivHydrCompute
::
qualityCompute
(
char
*
fileName
)
bool
CivHydrCompute
::
qualityCompute
()
{
// 运行水质运算需要先进行水力运算,没有直接采用ENSolveH 是为了考虑减压阀的压力曲线设置
long
t
(
0
),
tstep
(
0
);
int
iTime
(
0
);
int
errcode
=
0
;
errcode
=
ENopen
(
mInpFile
,
mRptFile
,
mBinFile
);
if
(
errcode
>
0
)
{
ENclose
();
return
false
;
}
if
(
ENopenH
()
>
0
)
{
ENclose
();
return
false
;
}
if
(
ENinitH
(
EN_SAVE
)
>
0
)
{
ENclose
();
return
false
;
}
do
{
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
/*for (int i = 1; i <= nLinkCount; i++)
{
int linkType;
char id[128] = "";
ENgetlinktype(i, &linkType);
ENgetlinkid(i, id);
}*/
errcode
=
ENrunH
(
&
t
);
// errcode > 100 是错误
if
(
errcode
>
100
)
{
ENcloseH
();
ENclose
();
return
false
;
}
ENnextH
(
&
tstep
);
iTime
++
;
// 获取当前节点和管段数据
getNodeResult
(
iTime
);
getLinkResult
(
iTime
);
}
while
(
tstep
>
0
);
ENcloseH
();
// 进行水质分析
ENopenQ
();
ENinitQ
(
1
);
t
=
0
;
tstep
=
0
;
iTime
=
0
;
do
{
errcode
=
ENrunQ
(
&
t
);
// errcode > 100 是错误
if
(
errcode
>
100
)
{
ENcloseQ
();
ENclose
();
return
false
;
}
// 获取水质模拟结果
getNodeQuality
(
iTime
);
getLinkQuality
(
iTime
);
ENstepQ
(
&
tstep
);
iTime
++
;
}
while
(
tstep
>
0
);
ENcloseQ
();
ENclose
();
return
true
;
}
bool
CivHydrCompute
::
hdyrCompute
(
char
*
inpFile
)
bool
CivHydrCompute
::
hdyrCompute
()
{
return
true
;
short
hydCode
=
1
;
long
t
(
0
),
tstep
(
0
);
int
iTime
(
0
);
int
errcode
=
0
;
errcode
=
ENopen
(
mInpFile
,
mRptFile
,
mBinFile
);
if
(
errcode
>
0
)
{
ENclose
();
return
false
;
}
if
(
ENopenH
()
>
0
)
{
ENclose
();
return
false
;
}
if
(
ENinitH
(
0
)
>
0
)
{
ENclose
();
return
false
;
}
float
dHStep
;
ENGetVal
(
4
,
&
dHStep
);
do
{
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
/*for (int i = 1; i <= nLinkCount; i++)
{
int linkType;
char id[128] = "";
ENgetlinktype(i, &linkType);
ENgetlinkid(i, id);
}*/
if
(
ENrunH
(
&
t
)
>
100
)
// errcode > 100 是错误
{
ENclose
();
return
false
;
}
ENnextH
(
&
tstep
);
// 获取当前节点和管段数据
getNodeResult
(
iTime
);
getLinkResult
(
iTime
);
iTime
++
;
}
while
(
tstep
>
0
);
ENcloseH
();
ENclose
();
return
true
;
}
void
CivHydrCompute
::
getNodeResult
(
short
time
)
{
// 计算节点
int
nNodeCount
;
ENgetcount
(
EN_NODECOUNT
,
&
nNodeCount
);
int
*
typeCode
=
(
int
*
)
malloc
(
sizeof
(
int
));
for
(
int
i
=
1
;
i
<=
nNodeCount
;
i
++
)
{
ENgetlinktype
(
i
,
typeCode
);
if
(
*
typeCode
==
EN_TANK
||
*
typeCode
==
EN_RESERVOIR
)
{
continue
;
}
NodeResultItem
nodeItem
;
// 编号
ENgetnodeid
(
i
,
nodeItem
.
szNo
);
// 水头
ENgetnodevalue
(
i
,
EN_HEAD
,
&
nodeItem
.
dHead
);
// 压力
ENgetnodevalue
(
i
,
EN_PRESSURE
,
&
nodeItem
.
dPressure
);
// 标高
ENgetnodevalue
(
i
,
EN_ELEVATION
,
&
nodeItem
.
dElevation
);
// 实际需水量
ENgetnodevalue
(
i
,
EN_DEMAND
,
&
nodeItem
.
dDemand
);
// 水池容量
ENgetnodevalue
(
i
,
EN_TANKVOLUME
,
&
nodeItem
.
dTankVolume
);
// 水池最大容量
ENgetnodevalue
(
i
,
EN_MAXVOLUME
,
&
nodeItem
.
dTankMaxVolume
);
// 液位高度
ENgetnodevalue
(
i
,
EN_TANKLEVEL
,
&
nodeItem
.
dTankLevel
);
nodeItem
.
dInterval
=
time
;
// 放到缓存类中
//mResultCache.addNodeItems(nodeItem);
}
free
(
typeCode
);
// 计算的水池
int
tankCount
;
}
void
CivHydrCompute
::
getLinkResult
(
short
time
)
{
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
for
(
int
i
=
1
;
i
<=
nLinkCount
;
i
++
)
{
LinkResultItem
linkItem
;
int
*
typeCode
=
(
int
*
)
malloc
(
sizeof
(
int
));
ENgetlinktype
(
i
,
typeCode
);
if
(
*
typeCode
!=
EN_PIPE
)
{
free
(
typeCode
);
continue
;
}
free
(
typeCode
);
// 编号
ENgetlinkid
(
i
,
linkItem
.
szNo
);
// 流量
ENgetlinkvalue
(
i
,
EN_FLOW
,
&
linkItem
.
dFlow
);
// 流向
linkItem
.
nFlowDirect
=
(
linkItem
.
dFlow
>=
0
)
?
0
:
1
;
// 流速
ENgetlinkvalue
(
i
,
EN_VELOCITY
,
&
linkItem
.
dVelocity
);
// 水头损失
ENgetlinkvalue
(
i
,
EN_HEADLOSS
,
&
linkItem
.
dHeadloss
);
// 状态
float
fState
=
0
;
ENgetlinkvalue
(
i
,
EN_STATUS
,
&
fState
);
if
((
int
)
fState
==
0
)
strcpy_s
(
linkItem
.
szStatus
,
"关闭"
);
else
strcpy_s
(
linkItem
.
szStatus
,
"开启"
);
linkItem
.
dInterval
=
time
;
// 放到缓存类中
// mResultCache.addLinkItems(linkItem);
}
}
void
CivHydrCompute
::
getNodeQuality
(
short
time
)
{
int
nNodeCount
;
ENgetcount
(
EN_NODECOUNT
,
&
nNodeCount
);
float
*
quality
=
(
float
*
)
malloc
(
sizeof
(
float
));
for
(
int
i
=
1
;
i
<=
nNodeCount
;
i
++
)
{
char
No
[
35
];
// 编号
ENgetnodeid
(
i
,
No
);
// 水质
ENgetnodevalue
(
i
,
EN_QUALITY
,
quality
);
// mResultCache.addNodeQuality(*quality, time, No);
}
free
(
quality
);
}
void
CivHydrCompute
::
getLinkQuality
(
short
time
)
{
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
int
*
typeCode
=
(
int
*
)
malloc
(
sizeof
(
int
));
for
(
int
i
=
1
;
i
<=
nLinkCount
;
i
++
)
{
if
(
*
typeCode
!=
EN_PIPE
)
continue
;
ENgetlinktype
(
i
,
typeCode
);
char
lnkNo
[
35
];
// 编号
ENgetlinkid
(
i
,
lnkNo
);
float
quality
;
// 水质
ENgetlinkvalue
(
i
,
EN_LINKQUAL
,
&
quality
);
}
free
(
typeCode
);
}
\ No newline at end of file
pandaAnalysis/CivHydrCompute.h
View file @
e70c7e93
#pragma once
#include "epanet2.h"
/**
彊제셕炬잚
...
...
@@ -6,13 +7,25 @@
class
CivHydrCompute
{
public
:
CivHydrCompute
(
);
explicit
CivHydrCompute
(
char
*
inp
,
char
*
rptFile
,
char
*
binFile
);
/**
*@brief 水质计算
*@param fileName 计算的inp文件名
*/
bool
qualityCompute
(
char
*
fileName
);
*@brief 彊醴셕炬
*/
bool
qualityCompute
();
bool
hdyrCompute
(
char
*
inpFile
);
/**
*@brief 彊제셕炬
*/
bool
hdyrCompute
();
private
:
void
getNodeResult
(
short
time
);
void
getLinkResult
(
short
time
);
void
getNodeQuality
(
short
time
);
void
getLinkQuality
(
short
time
);
char
*
mInpFile
;
char
*
mRptFile
;
char
*
mBinFile
;
};
pandaAnalysis/CivHydrFuncInter.cpp
View file @
e70c7e93
...
...
@@ -6,30 +6,6 @@
#include "CivHydrSimulation.h"
#include "CivTrackingAnalysis.h"
bool
FUNEXPORT
getDataByInterval
(
char
*
uri
,
char
*
date
,
char
*
interval
)
{
CivDbConn
*
dbConn
=
new
CivPgConn
(
uri
);
if
(
!
dbConn
->
open
())
{
delete
dbConn
;
return
false
;
}
if
(
!
dbConn
->
updateNodeByInterval
(
date
,
interval
))
{
delete
dbConn
;
return
false
;
}
if
(
!
dbConn
->
updateLinkByInterval
(
date
,
interval
))
{
delete
dbConn
;
return
false
;
}
delete
dbConn
;
return
true
;
}
bool
FUNEXPORT
modelMatation
(
char
*
uri
)
{
...
...
pandaAnalysis/CivHydrFuncInter.h
View file @
e70c7e93
...
...
@@ -67,15 +67,6 @@ extern "C" {
*/
bool
FUNEXPORT
trackingSimulation
(
char
*
uri
,
char
*
sN
,
int
hours
,
char
*
result
);
/**
*@brief 获取管网计算特定时段的结果
*@param uri: 管网数据库连接uri
*@param date: 日期
*@param interval: 时段,整数
*@return 成功,失败
*/
bool
FUNEXPORT
getDataByInterval
(
char
*
uri
,
char
*
date
,
char
*
interval
);
#if defined(__cplusplus)
}
#endif
...
...
pandaAnalysis/CivHydrSimulation.cpp
View file @
e70c7e93
...
...
@@ -5,302 +5,22 @@
#include "CivInpDirector.h"
#include "CivSysLog.h"
#include "epanet2.h"
#include "../pandaDbManager/CivCommonUtils.h"
#include "CivTrackingResultCache.h"
CivHydrSimulation
::
CivHydrSimulation
()
:
mDbConn
(
nullptr
),
mInpFile
(
"test.inp"
),
mRptFile
(
"test.rpt"
),
mBinFile
(
"test.bin"
)
{
}
CivHydrSimulation
::
CivHydrSimulation
(
CivDbConn
*
dbConn
)
:
mDbConn
(
dbConn
),
mInpFile
(
"test.inp"
),
mRptFile
(
"test.rpt"
),
mBinFile
(
"test.bin"
)
{
if
(
dbConn
)
dbConn
->
checkHyDrNetTable
();
}
CivHydrSimulation
::~
CivHydrSimulation
()
{
}
char
*
CivHydrSimulation
::
getInpFile
()
{
return
const_cast
<
char
*>
(
mInpFile
.
c_str
());
}
void
CivHydrSimulation
::
setInpFile
(
const
std
::
string
&
inpFile
)
{
mInpFile
=
inpFile
;
}
char
*
CivHydrSimulation
::
getRptFile
()
{
return
const_cast
<
char
*>
(
mRptFile
.
c_str
());
}
void
CivHydrSimulation
::
setRptFile
(
const
std
::
string
&
rptFile
)
{
mRptFile
=
rptFile
;
}
char
*
CivHydrSimulation
::
getBinFile
()
{
return
const_cast
<
char
*>
(
mBinFile
.
c_str
());
}
std
::
string
CivHydrSimulation
::
getAnalysisResults
()
{
std
::
string
result
;
std
::
ifstream
myfile
(
getRptFile
());
if
(
myfile
.
is_open
())
{
return
result
;
}
while
(
!
myfile
.
eof
())
{
myfile
>>
result
;
}
myfile
.
close
();
return
result
;
}
void
CivHydrSimulation
::
setBinFile
(
const
std
::
string
&
binFile
)
{
mBinFile
=
binFile
;
}
void
CivHydrSimulation
::
registDb
(
CivDbConn
*
dbConn
)
{
mDbConn
=
dbConn
;
if
(
mDbConn
)
mDbConn
->
checkHyDrNetTable
();
}
bool
CivHydrSimulation
::
convertInp
(
const
QualityAnalyType
analyType
,
const
std
::
string
&
qulityName
)
{
CivBuilder
*
builder
=
new
CivInpBuilder
();
builder
->
setQualityType
(
analyType
,
qulityName
);
builder
->
registDb
(
mDbConn
);
CivInpDirector
director
;
director
.
setBuilder
(
builder
);
director
.
create
();
CivNewInp
*
newInp
=
builder
->
getNewInp
();
char
*
inpFileName
=
getInpFile
();
if
(
inpFileName
&&
(
*
inpFileName
!=
'\0'
)
&&
!
newInp
->
writeToFile
(
inpFileName
))
{
delete
builder
;
return
false
;
}
delete
builder
;
return
true
;
}
bool
CivHydrSimulation
::
hdyrCompute
()
{
short
hydCode
=
1
;
long
t
(
0
),
tstep
(
0
);
int
iTime
(
0
);
int
errcode
=
0
;
char
*
fileName
=
getInpFile
();
char
*
rptFile
=
getRptFile
();
char
*
binOutFile
=
getBinFile
();
errcode
=
ENopen
(
fileName
,
rptFile
,
binOutFile
);
if
(
errcode
>
0
)
{
ENclose
();
CivSysLog
::
getInstance
()
->
error
(
"ENopen inp 失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
CivSysLog
::
getInstance
()
->
info
(
"ENopen inp 成功"
,
"CivHydrCalc"
,
__FUNCTION__
);
if
(
ENopenH
()
>
0
)
{
ENclose
();
CivSysLog
::
getInstance
()
->
error
(
"ENopenH inp 失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
if
(
ENinitH
(
0
)
>
0
)
{
ENclose
();
CivSysLog
::
getInstance
()
->
error
(
"ENinitH inp 失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
CivSysLog
::
getInstance
()
->
info
(
"ENinitH inp 成功"
,
"CivHydrCalc"
,
__FUNCTION__
);
float
dHStep
;
ENGetVal
(
4
,
&
dHStep
);
// 计算
do
{
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
/*for (int i = 1; i <= nLinkCount; i++)
{
int linkType;
char id[128] = "";
ENgetlinktype(i, &linkType);
ENgetlinkid(i, id);
}*/
if
(
ENrunH
(
&
t
)
>
100
)
// errcode > 100 是错误
{
ENclose
();
return
false
;
}
ENnextH
(
&
tstep
);
// 获取当前节点和管段数据
getNodeResult
(
iTime
);
getLinkResult
(
iTime
);
iTime
++
;
}
while
(
tstep
>
0
);
ENcloseH
();
ENclose
();
return
true
;
}
void
CivHydrSimulation
::
getDataByTime
(
int
time
,
NodeResultItems
&
nodeItems
,
LinkResultItems
&
linkItems
)
{
mResultCache
.
getResultByTime
(
time
,
nodeItems
,
linkItems
);
}
bool
CivHydrSimulation
::
hdyrInstantSimulation
()
{
CivBuilder
*
builder
=
new
CivInpBuilder
();
builder
->
setDuration
(
0
);
builder
->
setQualityType
(
ANALYSIS_RESERVE
,
""
);
builder
->
registDb
(
mDbConn
);
CivInpDirector
director
;
director
.
setBuilder
(
builder
);
director
.
create
();
CivNewInp
*
newInp
=
builder
->
getNewInp
();
char
*
inpFileName
=
getInpFile
();
if
(
inpFileName
&&
(
*
inpFileName
!=
'\0'
)
&&
!
newInp
->
writeToFile
(
inpFileName
))
{
delete
builder
;
return
false
;
}
delete
builder
;
// 水力计算
if
(
!
hdyrCompute
())
{
CivSysLog
::
getInstance
()
->
error
(
"水力分析结果存储失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
return
true
;
}
bool
CivHydrSimulation
::
hdyrSimulation
()
{
CivBuilder
*
builder
=
new
CivInpBuilder
();
builder
->
setQualityType
(
ANALYSIS_RESERVE
,
""
);
builder
->
registDb
(
mDbConn
);
CivInpDirector
director
;
director
.
setBuilder
(
builder
);
director
.
create
();
CivNewInp
*
newInp
=
builder
->
getNewInp
();
char
*
inpFileName
=
getInpFile
();
if
(
inpFileName
&&
(
*
inpFileName
!=
'\0'
)
&&
!
newInp
->
writeToFile
(
inpFileName
))
{
delete
builder
;
return
false
;
}
delete
builder
;
// 水力计算
if
(
!
hdyrCompute
())
{
CivSysLog
::
getInstance
()
->
error
(
"水力分析结果存储失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
//模拟数据刷新
if
(
!
brushingResult
())
{
CivSysLog
::
getInstance
()
->
error
(
"水力分析结果存储失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
return
true
;
}
bool
CivHydrSimulation
::
brushingResult
()
{
clearSamePeriodValue
(
mDbConn
,
CurrentDate
);
// 更新数据
if
(
!
mResultCache
.
updateToDb
(
mDbConn
))
{
CivSysLog
::
getInstance
()
->
error
(
"水力分析结果存储失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
// 更新管网数据库数据
// updateLastestDataToGisNet(mDbConn, "0");
return
true
;
}
bool
CivHydrSimulation
::
clearSamePeriodValue
(
CivDbConn
*
dbConn
,
const
std
::
string
&
date
)
{
if
(
dbConn
==
nullptr
)
return
false
;
dbConn
->
deleteByField
(
NODERESULTTABLE
,
"日期"
,
date
);
dbConn
->
deleteByField
(
PIPERESULTTABLE
,
"日期"
,
date
);
return
true
;
}
bool
CivHydrSimulation
::
updateLastestDataToGisNet
(
CivDbConn
*
dbConn
,
const
std
::
string
&
time
)
{
if
(
dbConn
==
nullptr
)
return
false
;
dbConn
->
updateLinkByInterval
(
CurrentDate
,
time
);
dbConn
->
updateNodeByInterval
(
CurrentDate
,
time
);
return
true
;
}
...
...
@@ -331,130 +51,8 @@ bool CivHydrSimulation::qualitySimulation()
return
true
;
}
bool
CivHydrSimulation
::
trackingSimulation
(
char
*
snNode
,
int
hour
)
{
CivSysLog
::
getInstance
()
->
error
(
"开始水质分析计算"
,
"qualitySimulation"
,
__FUNCTION__
);
setQualityAnalyType
(
ANALYSIS_TRACE
);
if
(
!
convertInp
(
ANALYSIS_TRACE
,
snNode
))
{
CivSysLog
::
getInstance
()
->
error
(
"写入inp文件失败"
,
"qualitySimulation"
,
__FUNCTION__
);
return
false
;
}
CivSysLog
::
getInstance
()
->
info
(
"写入inp成功"
,
"qualitySimulation"
,
__FUNCTION__
);
// 水质计算
if
(
!
qualityCompute
())
{
CivSysLog
::
getInstance
()
->
error
(
"追踪分析计算失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
return
true
;
}
bool
CivHydrSimulation
::
qualityCompute
()
{
// 运行水质运算需要先进行水力运算,没有直接采用ENSolveH 是为了考虑减压阀的压力曲线设置
long
t
(
0
),
tstep
(
0
);
int
iTime
(
0
);
int
errcode
=
0
;
char
*
fileName
=
getInpFile
();
char
*
rptFile
=
getRptFile
();
char
*
binOutFile
=
getBinFile
();
errcode
=
ENopen
(
fileName
,
rptFile
,
binOutFile
);
if
(
errcode
>
0
)
{
ENclose
();
CivSysLog
::
getInstance
()
->
error
(
"ENopen inp 失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
CivSysLog
::
getInstance
()
->
info
(
"ENopen inp 成功"
,
"CivHydrCalc"
,
__FUNCTION__
);
if
(
ENopenH
()
>
0
)
{
ENclose
();
CivSysLog
::
getInstance
()
->
error
(
"ENopenH inp 失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
if
(
ENinitH
(
EN_SAVE
)
>
0
)
{
ENclose
();
CivSysLog
::
getInstance
()
->
error
(
"ENinitH inp 失败"
,
"CivHydrCalc"
,
__FUNCTION__
);
return
false
;
}
CivSysLog
::
getInstance
()
->
info
(
"ENinitH inp 成功"
,
"CivHydrCalc"
,
__FUNCTION__
);
do
{
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
/*for (int i = 1; i <= nLinkCount; i++)
{
int linkType;
char id[128] = "";
ENgetlinktype(i, &linkType);
ENgetlinkid(i, id);
}*/
errcode
=
ENrunH
(
&
t
);
// errcode > 100 是错误
if
(
errcode
>
100
)
{
ENcloseH
();
ENclose
();
return
false
;
}
ENnextH
(
&
tstep
);
iTime
++
;
if
(
mQuaLityType
==
ANALYSIS_TRACE
)
continue
;
// 获取当前节点和管段数据
getNodeResult
(
iTime
);
getLinkResult
(
iTime
);
}
while
(
tstep
>
0
);
ENcloseH
();
// 进行水质分析
ENopenQ
();
ENinitQ
(
1
);
t
=
0
;
tstep
=
0
;
iTime
=
0
;
do
{
errcode
=
ENrunQ
(
&
t
);
// errcode > 100 是错误
if
(
errcode
>
100
)
{
ENcloseQ
();
ENclose
();
return
false
;
}
// 获取水质模拟结果
getNodeQuality
(
iTime
);
getLinkQuality
(
iTime
);
ENstepQ
(
&
tstep
);
iTime
++
;
}
while
(
tstep
>
0
);
ENcloseQ
();
ENclose
();
CivSysLog
::
getInstance
()
->
info
(
"结束水质分析计算"
,
"CivHydrCalc"
,
__FUNCTION__
);
bool
CivHydrSimulation
::
trackingSimulation
(
char
*
snNode
,
int
hours
,
std
::
string
&
jsonResult
)
{
return
true
;
}
...
...
@@ -463,7 +61,7 @@ void CivHydrSimulation::getTrackingResult(int hours, std::string& jsonResult)
// 缓存节点和管段空间信息
CivTrackingResultCache
trackingCache
;
trackingCache
.
cacheInfoFromDb
(
mDbConn
);
//
trackingCache.cacheInfoFromDb(mDbConn);
jsonResult
.
append
(
"["
);
for
(
int
i
=
0
;
i
<
hours
;
i
++
)
...
...
@@ -494,208 +92,10 @@ void CivHydrSimulation::getTrackingResult(int hours, std::string& jsonResult)
jsonResult
=
jsonResult
.
substr
(
0
,
jsonResult
.
length
()
-
1
);
jsonResult
.
append
(
"],"
);
}
//std::stringstream stream;
//for (int i = 0; i < hours; i++)
//{
// NodeResultItems nodeItemsMap;
// LinkResultItems linkItemsMap;
// mResultCache.getResultByTime(i, nodeItemsMap, linkItemsMap);
//
// // 追踪管段编号
// auto linkIter = linkItemsMap.begin();
// size_t total = linkItemsMap.size();
// int index = 1;
// jsonResult.append("[");
// while (linkIter != linkItemsMap.end())
// {
// if (linkIter->second.dQuality > 0)
// {
// std::string sn = linkIter->first;
//
// Pipes pipe;
// trackingCache.getPipeInfoBySn(sn, pipe);
// jsonResult.append("[[");
// jsonResult.append(pipe.startX);
// jsonResult.append(",");
// jsonResult.append(pipe.startY);
// jsonResult.append("],[");
// jsonResult.append(pipe.endX);
// jsonResult.append(",");
// jsonResult.append(pipe.endY);
// jsonResult.append("]],");
// }
// linkIter++;
// }
// jsonResult = jsonResult.substr(0, jsonResult.length() - 1);
// jsonResult.append("],");
//}
jsonResult
=
jsonResult
.
substr
(
0
,
jsonResult
.
length
()
-
1
);
jsonResult
.
append
(
"]"
);
}
void
CivHydrSimulation
::
getNodeResult
(
short
time
)
{
int
nNodeCount
;
ENgetcount
(
EN_NODECOUNT
,
&
nNodeCount
);
for
(
int
i
=
1
;
i
<=
nNodeCount
;
i
++
)
{
NodeResultItem
nodeItem
;
// 编号
ENgetnodeid
(
i
,
nodeItem
.
szNo
);
// 流量
ENgetnodevalue
(
i
,
EN_DEMAND
,
&
nodeItem
.
dFlow
);
// 水头
ENgetnodevalue
(
i
,
EN_HEAD
,
&
nodeItem
.
dHead
);
// 压力
ENgetnodevalue
(
i
,
EN_PRESSURE
,
&
nodeItem
.
dPressure
);
// 标高
ENgetnodevalue
(
i
,
EN_ELEVATION
,
&
nodeItem
.
dElevation
);
// 实际需水量
ENgetnodevalue
(
i
,
EN_DEMAND
,
&
nodeItem
.
dDemand
);
// 水池容量
ENgetnodevalue
(
i
,
EN_TANKVOLUME
,
&
nodeItem
.
dTankVolume
);
// 水池最大容量
ENgetnodevalue
(
i
,
EN_MAXVOLUME
,
&
nodeItem
.
dTankMaxVolume
);
// 液位高度
ENgetnodevalue
(
i
,
EN_TANKLEVEL
,
&
nodeItem
.
dTankLevel
);
nodeItem
.
dInterval
=
time
;
// 放到缓存类中
mResultCache
.
addNodeItems
(
nodeItem
);
}
}
void
CivHydrSimulation
::
getLinkResult
(
short
time
)
{
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
for
(
int
i
=
1
;
i
<=
nLinkCount
;
i
++
)
{
LinkResultItem
linkItem
;
int
*
typeCode
=
(
int
*
)
malloc
(
sizeof
(
int
));
ENgetlinktype
(
i
,
typeCode
);
if
(
*
typeCode
!=
EN_PIPE
)
{
free
(
typeCode
);
continue
;
}
free
(
typeCode
);
// 编号
ENgetlinkid
(
i
,
linkItem
.
szNo
);
// 流量
ENgetlinkvalue
(
i
,
EN_FLOW
,
&
linkItem
.
dFlow
);
// 流向
linkItem
.
nFlowDirect
=
(
linkItem
.
dFlow
>=
0
)
?
0
:
1
;
// 流速
ENgetlinkvalue
(
i
,
EN_VELOCITY
,
&
linkItem
.
dVelocity
);
// 水头损失
ENgetlinkvalue
(
i
,
EN_HEADLOSS
,
&
linkItem
.
dHeadloss
);
// 单位水头损失
float
dPipeLen
=
0.0
f
;;
ENgetlinkvalue
(
i
,
EN_LENGTH
,
&
dPipeLen
);
linkItem
.
dUnitHeadloss
=
(
linkItem
.
dHeadloss
/
dPipeLen
)
*
1000
;
// 获取上点和本点
int
node1
=
0
;
int
node2
=
0
;
ENgetlinknodes
(
i
,
&
node1
,
&
node2
);
// 上点水头
ENgetnodevalue
(
node1
,
EN_HEAD
,
&
linkItem
.
dFromNodHeadloss
);
// 本点水头
ENgetnodevalue
(
node2
,
EN_HEAD
,
&
linkItem
.
dToNodHeadloss
);
// 局部水头损失
float
fCoeff
;
ENgetlinkvalue
(
i
,
EN_MINORLOSS
,
&
fCoeff
);
double
dMinorloss
=
fCoeff
*
linkItem
.
dHeadloss
;
linkItem
.
dLocalHeadloss
=
dMinorloss
;
// 局部水头损失
// 摩擦水头损失
linkItem
.
dFrictionHeadloss
=
linkItem
.
dHeadloss
-
linkItem
.
dLocalHeadloss
;
// 局部水头损失
// 状态
float
fState
=
0
;
ENgetlinkvalue
(
i
,
EN_STATUS
,
&
fState
);
if
((
int
)
fState
==
0
)
strcpy_s
(
linkItem
.
szStatus
,
"关闭"
);
else
strcpy_s
(
linkItem
.
szStatus
,
"开启"
);
linkItem
.
dInterval
=
time
;
// 放到缓存类中
mResultCache
.
addLinkItems
(
linkItem
);
}
}
void
CivHydrSimulation
::
getNodeQuality
(
short
time
)
{
if
(
mQuaLityType
==
ANALYSIS_TRACE
)
{
return
;
}
int
nNodeCount
;
ENgetcount
(
EN_NODECOUNT
,
&
nNodeCount
);
float
*
quality
=
(
float
*
)
malloc
(
sizeof
(
float
));
for
(
int
i
=
1
;
i
<=
nNodeCount
;
i
++
)
{
char
No
[
35
];
// 编号
ENgetnodeid
(
i
,
No
);
// 水质
ENgetnodevalue
(
i
,
EN_QUALITY
,
quality
);
mResultCache
.
addNodeQuality
(
*
quality
,
time
,
No
);
}
free
(
quality
);
}
void
CivHydrSimulation
::
getLinkQuality
(
short
time
)
{
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
int
*
typeCode
=
(
int
*
)
malloc
(
sizeof
(
int
));
float
*
quality
=
(
float
*
)
malloc
(
sizeof
(
float
));
for
(
int
i
=
1
;
i
<=
nLinkCount
;
i
++
)
{
ENgetlinktype
(
i
,
typeCode
);
if
(
*
typeCode
!=
EN_PIPE
)
{
continue
;
}
char
lnkNo
[
35
];
// 编号
ENgetlinkid
(
i
,
lnkNo
);
// 水质
ENgetlinkvalue
(
i
,
EN_LINKQUAL
,
quality
);
if
(
mQuaLityType
!=
ANALYSIS_TRACE
)
{
mResultCache
.
addLinkQuality
(
*
quality
,
time
,
lnkNo
);
continue
;
}
if
(
*
quality
>
0
)
{
mTrackLinkSns
[
time
].
push_back
(
lnkNo
);
}
}
free
(
typeCode
);
free
(
quality
);
}
pandaAnalysis/CivHydrSimulation.h
View file @
e70c7e93
...
...
@@ -3,115 +3,40 @@
#include "CivNewInp.h"
class
CivDbConn
;
/**
水力模拟计算类
水力模拟计算类
*/
class
CivHydrSimulation
{
public
:
explicit
CivHydrSimulation
();
explicit
CivHydrSimulation
(
CivDbConn
*
dbConn
);
~
CivHydrSimulation
();
/**
*@brief 注册数据库
*@param dbConn 连接数据库指针
*@brief 水力模拟
*/
void
registDb
(
CivDbConn
*
dbConn
);
/**
*@brief 水力模拟
*/
bool
hdyrSimulation
();
/**
*@brief 瞬时计算
*/
bool
hdyrInstantSimulation
();
bool
hdyrCompute
();
/**
*@brief 水质模拟,水龄,化学物质
*/
*@brief 水质模拟,水龄,化学物质
*/
bool
qualitySimulation
();
/**
*@brief 获取分析结果
*@return 分析结果字符串
*/
std
::
string
getAnalysisResults
();
/**
*@brief 追踪分析,本质仍然式水质分析
*@param snNode:追踪的节点号
*@param hours: 小时数
*/
bool
trackingSimulation
(
char
*
snNode
,
int
hours
);
void
getDataByTime
(
int
time
,
NodeResultItems
&
nodeItems
,
LinkResultItems
&
linkItems
);
bool
trackingSimulation
(
char
*
snNode
,
int
hours
,
std
::
string
&
jsonResult
);
/**
*@brief 导出inp文件
*@param analyType: 水质分析类型:水龄,追踪,化合物,none
*@param qulityName: 追踪节点值,或者化合物质
*/
bool
convertInp
(
const
QualityAnalyType
analyType
,
const
std
::
string
&
qulityName
);
/**
*@brief 获取追踪结果值
*@param hours:追踪的小时数
*/
*@brief 获取追踪结果值
*@param hours:追踪的小时数
*/
void
getTrackingResult
(
int
hours
,
std
::
string
&
result
);
/**
*@brief 同一天只保留最后一次模拟的结果值,须清除当前之前模拟的结果值
*@param dbConn: 数据库连接对象指针
*@param date: 日期
*/
bool
clearSamePeriodValue
(
CivDbConn
*
dbConn
,
const
std
::
string
&
date
);
/**
*@brief 及时更新最新模拟的数据到gis管网模型中,默认更新零时刻
*@param dbConn: 数据库连接对象指针
*@param time: 时段
*/
bool
updateLastestDataToGisNet
(
CivDbConn
*
dbConn
,
const
std
::
string
&
time
);
/**
*@brief 刷新最新的模拟的数据
*/
bool
brushingResult
();
void
setQualityAnalyType
(
QualityAnalyType
analyType
)
{
mQuaLityType
=
analyType
;
}
/*
inp文件名,输出文件名,二进制文件名设置和获取
*/
inline
void
setInpFile
(
const
std
::
string
&
inpFile
);
inline
void
setRptFile
(
const
std
::
string
&
rptFile
);
inline
void
setBinFile
(
const
std
::
string
&
binFile
);
private
:
inline
char
*
getRptFile
();
inline
char
*
getInpFile
();
inline
char
*
getBinFile
();
/**
*@brief 水质计算服务
*/
bool
qualityCompute
();
void
getNodeResult
(
short
time
);
void
getLinkResult
(
short
time
);
void
getNodeQuality
(
short
time
);
void
getLinkQuality
(
short
time
);
private
:
CivDbConn
*
mDbConn
;
CivSimulResultCache
mResultCache
;
// 存储模拟结果缓存类
QualityAnalyType
mQuaLityType
=
ANALYSIS_RESERVE
;
std
::
map
<
int
,
std
::
vector
<
std
::
string
>>
mTrackLinkSns
;
std
::
string
mInpFile
;
// inp文件名
std
::
string
mRptFile
;
// 报告文件名
std
::
string
mBinFile
;
// 二进制文件名
};
pandaAnalysis/CivBuilder.cpp
→
pandaAnalysis/Civ
Inp
Builder.cpp
View file @
e70c7e93
#include "CivBuilder.h"
#include "Civ
Inp
Builder.h"
#include "CivTypes.h"
#include "CivAssembly.h"
#define ASSERT(A,B) if ((A) == nullptr || (B) == nullptr) return;
Civ
Builder
::
Civ
Builder
()
:
mNewInp
(
new
CivNewInp
())
Civ
InpBuilder
::
CivInp
Builder
()
:
mNewInp
(
new
CivNewInp
())
{
}
Civ
Builder
::~
Civ
Builder
()
Civ
InpBuilder
::~
CivInp
Builder
()
{
delete
mNewInp
;
}
CivNewInp
*
CivBuilder
::
getNewInp
()
CivNewInp
*
Civ
Inp
Builder
::
getNewInp
()
{
return
mNewInp
;
}
CivInpBuilder
::
CivInpBuilder
()
:
mDbConn
(
nullptr
)
{
}
CivInpBuilder
::
CivInpBuilder
(
CivDbConn
*
dbConn
)
:
mDbConn
(
dbConn
)
{
}
CivInpBuilder
::~
CivInpBuilder
()
{
}
void
CivInpBuilder
::
setQualityType
(
const
QualityAnalyType
analyType
,
const
std
::
string
&
qulityName
)
{
mNewInp
->
setQualityType
(
analyType
,
qulityName
);
}
void
CivInpBuilder
::
setDuration
(
int
duration
)
{
mNewInp
->
setDuration
(
duration
);
}
void
CivInpBuilder
::
registDb
(
CivDbConn
*
dbConn
)
{
mDbConn
=
dbConn
;
}
void
CivInpBuilder
::
buildNode
()
{
ASSERT
(
mDbConn
,
mNewInp
)
CivNode
node
;
if
(
!
mDbConn
->
getNode
(
node
))
return
;
...
...
pandaAnalysis/CivBuilder.h
→
pandaAnalysis/Civ
Inp
Builder.h
View file @
e70c7e93
#ifndef _CIVINPEXPOTER_H
#define _CIVINPEXPOTER_H
#include "CivPgConn.h"
#include "CivNewInp.h"
/**
*
*/
class
CivBuilder
class
Civ
Inp
Builder
{
public
:
CivBuilder
();
virtual
~
CivBuilder
();
virtual
void
setQualityType
(
const
QualityAnalyType
analyType
,
const
std
::
string
&
qulityName
)
=
0
;
virtual
void
setDuration
(
int
duration
)
=
0
;
virtual
void
registDb
(
CivDbConn
*
dbConn
)
=
0
;
virtual
void
buildNode
()
=
0
;
virtual
void
buildPipe
()
=
0
;
virtual
void
buildTank
()
=
0
;
virtual
void
buildVavle
()
=
0
;
virtual
void
buildPump
()
=
0
;
virtual
void
buildReservoir
()
=
0
;
virtual
void
buildEmitter
()
=
0
;
virtual
void
buildPatterns
()
=
0
;
virtual
void
buildParamter
()
=
0
;
virtual
void
buildCoordnates
()
=
0
;
virtual
void
buildVertices
()
=
0
;
virtual
void
buildLabels
()
=
0
;
virtual
void
buildTags
()
=
0
;
virtual
void
buildBackDrop
()
=
0
;
virtual
void
buildQuality
()
=
0
;
virtual
void
buildSources
()
=
0
;
virtual
void
buildMixing
()
=
0
;
virtual
void
buildCurves
()
=
0
;
virtual
void
buildStatus
()
=
0
;
virtual
void
buildControls
()
=
0
;
virtual
void
buildRules
()
=
0
;
virtual
void
buildDemands
()
=
0
;
CivNewInp
*
getNewInp
();
protected
:
CivNewInp
*
mNewInp
;
};
/**
* 导出inp文件类
*/
class
CivInpBuilder
:
public
CivBuilder
{
public
:
explicit
CivInpBuilder
();
explicit
CivInpBuilder
(
CivDbConn
*
dbConn
);
~
CivInpBuilder
();
virtual
~
CivInpBuilder
();
virtual
void
setQualityType
(
const
QualityAnalyType
analyType
,
const
std
::
string
&
qulityName
);
virtual
void
setDuration
(
int
duration
);
// 注册数据库连接
virtual
void
registDb
(
CivDbConn
*
dbConn
);
virtual
void
buildNode
();
virtual
void
buildPipe
();
virtual
void
buildTank
();
...
...
@@ -83,9 +35,12 @@ public:
virtual
void
buildRules
();
virtual
void
buildDemands
();
private
:
CivDbConn
*
mDbConn
;
CivNewInp
*
getNewInp
();
protected
:
CivNewInp
*
mNewInp
;
};
#endif // !_CIVINPEXPOTER_H
...
...
pandaAnalysis/CivInpConvertor.cpp
View file @
e70c7e93
...
...
@@ -8,4 +8,9 @@ CivInpConvertor::CivInpConvertor(const std::string& uri)
CivInpConvertor
::~
CivInpConvertor
()
{
}
char
*
CivInpConvertor
::
getInp
()
{
}
\ No newline at end of file
pandaAnalysis/CivInpConvertor.h
View file @
e70c7e93
...
...
@@ -7,23 +7,10 @@
class
CivInpConvertor
{
public
:
CivInpConvertor
(
const
std
::
string
&
uri
);
explicit
CivInpConvertor
(
const
std
::
string
&
uri
);
~
CivInpConvertor
();
/*
inp文件名,输出文件名,二进制文件名设置和获取
*/
void
setInpFile
(
const
std
::
string
&
inpFile
)
{
mInpFile
=
inpFile
;
}
void
setRptFile
(
const
std
::
string
&
rptFile
)
{
mRptFile
=
rptFile
;
}
void
setBinFile
(
const
std
::
string
&
binFile
)
{
mBinFile
=
binFile
;
}
char
*
getRptFile
()
{
return
const_cast
<
char
*>
(
mInpFile
.
c_str
());
}
char
*
getInpFile
(){
return
const_cast
<
char
*>
(
mRptFile
.
c_str
());
}
char
*
getBinFile
(){
return
const_cast
<
char
*>
(
mBinFile
.
c_str
());
}
char
*
getInp
();
private
:
std
::
string
mInpFile
;
// inp文件名
std
::
string
mRptFile
;
// 报告文件名
std
::
string
mBinFile
;
// 二进制文件名
};
\ No newline at end of file
pandaAnalysis/CivProjInpBuilder.cpp
View file @
e70c7e93
#include "CivProjInpBuilder.h"
void
CivProjInpBuilder
::
setQualityType
(
const
QualityAnalyType
analyType
,
const
std
::
string
&
qulityName
)
{
}
void
CivProjInpBuilder
::
setDuration
(
int
duration
)
{
mNewInp
->
setDuration
(
10
);
}
void
CivProjInpBuilder
::
registDb
(
CivDbConn
*
dbConn
)
{
}
void
CivProjInpBuilder
::
buildNode
()
{
...
...
pandaAnalysis/CivProjInpBuilder.h
View file @
e70c7e93
#pragma once
#include "CivBuilder.h"
#include "Civ
Inp
Builder.h"
/**
ģתinpļ
*/
class
CivProjInpBuilder
:
public
CivBuilder
class
CivProjInpBuilder
:
public
Civ
Inp
Builder
{
public
:
virtual
void
setQualityType
(
const
QualityAnalyType
analyType
,
const
std
::
string
&
qulityName
);
virtual
void
setDuration
(
int
duration
);
virtual
void
registDb
(
CivDbConn
*
dbConn
);
virtual
void
buildNode
();
virtual
void
buildPipe
();
virtual
void
buildTank
();
...
...
pandaAnalysis/pandaAnalysis.vcxproj
View file @
e70c7e93
...
...
@@ -153,12 +153,13 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile
Include=
"..\pandaDbManager\CivCommonUtils.cpp"
/>
<ClCompile
Include=
"CivBaseInpBuilder.cpp"
/>
<ClCompile
Include=
"CivGraphFactory.cpp"
/>
<ClCompile
Include=
"CivHydDataType.cpp"
/>
<ClCompile
Include=
"CivHydrCompute.cpp"
/>
<ClCompile
Include=
"CivHydrFuncInter.cpp"
/>
<ClCompile
Include=
"CivHydrSimulation.cpp"
/>
<ClCompile
Include=
"CivBuilder.cpp"
/>
<ClCompile
Include=
"Civ
Inp
Builder.cpp"
/>
<ClCompile
Include=
"CivInpConvertor.cpp"
/>
<ClCompile
Include=
"CivInpDirector.cpp"
/>
<ClCompile
Include=
"CivNewInp.cpp"
/>
...
...
@@ -171,13 +172,14 @@
<ClCompile
Include=
"CivTrackingAnalysis.cpp"
/>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"CivBaseInpBuilder.h"
/>
<ClInclude
Include=
"CivGraphFactory.h"
/>
<ClInclude
Include=
"CivGraphList.h"
/>
<ClInclude
Include=
"CivHydDataType.h"
/>
<ClInclude
Include=
"CivHydrCompute.h"
/>
<ClInclude
Include=
"CivHydrFuncInter.h"
/>
<ClInclude
Include=
"CivHydrSimulation.h"
/>
<ClInclude
Include=
"CivBuilder.h"
/>
<ClInclude
Include=
"Civ
Inp
Builder.h"
/>
<ClInclude
Include=
"CivInpConvertor.h"
/>
<ClInclude
Include=
"CivInpDirector.h"
/>
<ClInclude
Include=
"CivNewInp.h"
/>
...
...
pandaAnalysis/pandaAnalysis.vcxproj.filters
View file @
e70c7e93
...
...
@@ -21,9 +21,6 @@
<ClCompile
Include=
"..\pandaDbManager\CivCommonUtils.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivBuilder.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivInpDirector.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
...
...
@@ -66,6 +63,12 @@
<ClCompile
Include=
"CivOptSchedSimulation.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivBaseInpBuilder.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivInpBuilder.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"CivHydrFuncInter.h"
>
...
...
@@ -74,9 +77,6 @@
<ClInclude
Include=
"CivNewInp.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivBuilder.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivInpDirector.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
...
...
@@ -119,5 +119,11 @@
<ClInclude
Include=
"CivOptSchedSimulation.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivInpBuilder.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivBaseInpBuilder.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
pandaDbManager/CivAssembly.h
View file @
e70c7e93
...
...
@@ -3,6 +3,7 @@
#include "CivTypes.h"
#include <list>
#pragma warning(disable:4251)
#define DBEXPORT __declspec(dllexport)
class
CivAssembly
;
...
...
@@ -68,7 +69,7 @@ public:
/*
水池类型
水池类型
*/
class
DBEXPORT
CivTank
:
public
CivAssembly
{
...
...
@@ -98,15 +99,6 @@ class DBEXPORT CivValve :public CivAssembly
public
:
typedef
struct
Table
{
/*
阀门的ID标签
起始节点ID
终止节点ID
直径,mm(英寸)
阀门类型
阀门设置
局部损失系数
*/
Str
ID
;
Str
Node1
;
Str
Node2
;
...
...
@@ -117,6 +109,7 @@ public:
}
ValveTable
;
void
addItem
(
const
ValveTable
&
table
);
std
::
list
<
ValveTable
>
mTables
;
};
...
...
@@ -190,7 +183,6 @@ class DBEXPORT CivCoordinates :public CivAssembly
public
:
typedef
struct
Table
{
// ; ;Node X-Coord Y-Coord
Str
ID
;
Str
XCoord
;
Str
YCoord
;
...
...
@@ -372,8 +364,8 @@ public:
/*
X坐标
Y坐标
双引号中的标签文本
锚定节点的ID标签(可选)
双引号中的标签文本
锚定节点的ID标签(可选)
*/
Str
XCoord
;
Str
YCoord
;
...
...
pandaDbManager/CivDbConn.h
View file @
e70c7e93
...
...
@@ -51,11 +51,6 @@ public:
*/
virtual
bool
tableExist
(
StrQuote
tableName
)
=
0
;
/**
*@brief 创建表格
*/
virtual
bool
createTable
(
CivTableTemp
&
temp
)
=
0
;
/**
*@brief 根据字段值条件删除数据
*@param table:表
...
...
@@ -104,7 +99,6 @@ public:
const
std
::
vector
<
std
::
string
>&
fileds
,
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>&
result
)
=
0
;
virtual
void
checkHyDrNetTable
()
=
0
;
// 获取当前执行错误信息
Str
getLastError
()
const
;
...
...
pandaDbManager/CivDbUtils.cpp
deleted
100644 → 0
View file @
2b546d06
#include "CivDbUtils.h"
#include "CivConnection.h"
CivConnection
*
CivDbUtils
::
getConnection
()
{
return
nullptr
;
}
\ No newline at end of file
pandaDbManager/CivDbUtils.h
deleted
100644 → 0
View file @
2b546d06
#pragma once
class
CivConnection
;
/**
ݿ
*/
class
CivDbUtils
{
public
:
static
CivConnection
*
getConnection
();
};
pandaDbManager/CivInpDbHelper.cpp
View file @
e70c7e93
...
...
@@ -16,9 +16,15 @@ CivInpDbHelper::~CivInpDbHelper()
bool
CivInpDbHelper
::
getNode
(
CivNode
&
node
)
{
CivJunctionTableTemp
::
JunctionTable
nodeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTable
.
thePoint
,
nodeTable
.
elev
,
nodeTable
.
demand
,
nodeTable
.
pattern
};
JunctionTable
nodeTableFields
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTableFields
.
sn
,
nodeTableFields
.
elev
,
nodeTableFields
.
demand
,
nodeTableFields
.
demandPattern
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PUMP
,
fields
,
resultVector
);
...
...
@@ -29,10 +35,10 @@ bool CivInpDbHelper::getNode(CivNode& node)
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
CivNode
::
NodeTable
nodeTable
;
nodeTable
.
ID
=
map
.
find
(
nodeTable
.
ID
)
->
second
;
nodeTable
.
Elev
=
map
.
find
(
nodeTable
.
E
lev
)
->
second
;
nodeTable
.
Demand
=
map
.
find
(
nodeTable
.
Demand
)
->
second
;
nodeTable
.
PatternId
=
map
.
find
(
nodeTable
.
PatternId
)
->
second
;
nodeTable
.
ID
=
map
.
find
(
nodeTable
Fields
.
sn
)
->
second
;
nodeTable
.
Elev
=
map
.
find
(
nodeTable
Fields
.
e
lev
)
->
second
;
nodeTable
.
Demand
=
map
.
find
(
nodeTable
Fields
.
base
Demand
)
->
second
;
nodeTable
.
PatternId
=
map
.
find
(
nodeTable
Fields
.
demandPattern
)
->
second
;
node
.
addItem
(
nodeTable
);
}
...
...
@@ -41,16 +47,16 @@ bool CivInpDbHelper::getNode(CivNode& node)
bool
CivInpDbHelper
::
getPipe
(
CivPipe
&
pipes
)
{
CivPipeTableTemp
::
PipeTable
pipeTable
;
PipeTable
pipeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
pipeTable
.
snNo
,
pipeTable
.
las
tPoint
,
pipeTable
.
the
Point
,
pipeTable
.
star
tPoint
,
pipeTable
.
end
Point
,
pipeTable
.
length
,
pipeTable
.
diameter
,
pipeTable
.
friction
,
pipeTable
.
local
Head
Loss
,
pipeTable
.
localLoss
,
pipeTable
.
status
};
...
...
@@ -65,12 +71,12 @@ bool CivInpDbHelper::getPipe(CivPipe& pipes)
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
pipe
.
ID
=
map
.
find
(
pipeTable
.
snNo
)
->
second
;
pipe
.
Node1
=
map
.
find
(
pipeTable
.
las
tPoint
)
->
second
;
pipe
.
Node2
=
map
.
find
(
pipeTable
.
the
Point
)
->
second
;
pipe
.
Node1
=
map
.
find
(
pipeTable
.
star
tPoint
)
->
second
;
pipe
.
Node2
=
map
.
find
(
pipeTable
.
end
Point
)
->
second
;
pipe
.
Length
=
map
.
find
(
pipeTable
.
length
)
->
second
;
pipe
.
Diameter
=
map
.
find
(
pipeTable
.
diameter
)
->
second
;
pipe
.
Roughness
=
map
.
find
(
pipeTable
.
friction
)
->
second
;
pipe
.
MinorLoss
=
map
.
find
(
pipeTable
.
local
Head
Loss
)
->
second
;
pipe
.
MinorLoss
=
map
.
find
(
pipeTable
.
localLoss
)
->
second
;
pipe
.
Status
=
map
.
find
(
pipeTable
.
status
)
->
second
;
pipes
.
addItem
(
pipe
);
...
...
@@ -80,17 +86,17 @@ bool CivInpDbHelper::getPipe(CivPipe& pipes)
bool
CivInpDbHelper
::
getTank
(
CivTank
&
tanks
)
{
CivTankTableTemp
::
TankTable
tankTable
;
TankTable
tankTable
;
std
::
vector
<
std
::
string
>
fields
=
{
tankTable
.
thePoint
,
tankTable
.
sn
,
tankTable
.
elev
,
tankTable
.
initLevel
,
tankTable
.
low
Level
,
tankTable
.
high
Level
,
tankTable
.
min
Level
,
tankTable
.
max
Level
,
tankTable
.
diametor
,
tankTable
.
capacity
,
tankTable
.
volCurve
tankTable
.
minVolume
,
tankTable
.
vol
ume
Curve
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
...
...
@@ -102,14 +108,14 @@ bool CivInpDbHelper::getTank(CivTank& tanks)
CivTank
::
TankTable
tank
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
tank
.
ID
=
map
.
find
(
tankTable
.
thePoint
)
->
second
;
tank
.
ID
=
map
.
find
(
tankTable
.
sn
)
->
second
;
tank
.
Elev
=
map
.
find
(
tankTable
.
elev
)
->
second
;
tank
.
InitLevel
=
map
.
find
(
tankTable
.
initLevel
)
->
second
;
tank
.
MinLevel
=
map
.
find
(
tankTable
.
low
Level
)
->
second
;
tank
.
MaxLevel
=
map
.
find
(
tankTable
.
high
Level
)
->
second
;
tank
.
MinLevel
=
map
.
find
(
tankTable
.
min
Level
)
->
second
;
tank
.
MaxLevel
=
map
.
find
(
tankTable
.
max
Level
)
->
second
;
tank
.
Diameter
=
map
.
find
(
tankTable
.
diametor
)
->
second
;
tank
.
MinVol
=
map
.
find
(
tankTable
.
capacity
)
->
second
;
tank
.
VolCurve
=
map
.
find
(
tankTable
.
volCurve
)
->
second
;
tank
.
MinVol
=
map
.
find
(
tankTable
.
minVolume
)
->
second
;
tank
.
VolCurve
=
map
.
find
(
tankTable
.
vol
ume
Curve
)
->
second
;
tanks
.
addItem
(
tank
);
}
...
...
@@ -118,15 +124,15 @@ bool CivInpDbHelper::getTank(CivTank& tanks)
bool
CivInpDbHelper
::
getValve
(
CivValve
&
valves
)
{
CivValveTableTemp
::
ValveTable
vaveTable
;
ValveTable
vaveTable
;
std
::
vector
<
std
::
string
>
fields
=
{
vaveTable
.
id
,
vaveTable
.
sn
,
vaveTable
.
startPoint
,
vaveTable
.
endPoint
,
vaveTable
.
diameter
,
vaveTable
.
length
,
vaveTable
.
type
,
vaveTable
.
setting
,
vaveTable
.
loss
vaveTable
.
loss
Coeff
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
...
...
@@ -138,13 +144,13 @@ bool CivInpDbHelper::getValve(CivValve& valves)
CivValve
::
ValveTable
vave
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
vave
.
ID
=
map
.
find
(
vaveTable
.
id
)
->
second
;
vave
.
ID
=
map
.
find
(
vaveTable
.
sn
)
->
second
;
vave
.
Node1
=
map
.
find
(
vaveTable
.
startPoint
)
->
second
;
vave
.
Node2
=
map
.
find
(
vaveTable
.
endPoint
)
->
second
;
vave
.
Diameter
=
map
.
find
(
vaveTable
.
diameter
)
->
second
;
vave
.
Diameter
=
map
.
find
(
vaveTable
.
length
)
->
second
;
vave
.
Type
=
map
.
find
(
vaveTable
.
type
)
->
second
;
vave
.
Setting
=
map
.
find
(
vaveTable
.
setting
)
->
second
;
vave
.
MinorLoss
=
map
.
find
(
vaveTable
.
loss
)
->
second
;
vave
.
MinorLoss
=
map
.
find
(
vaveTable
.
loss
Coeff
)
->
second
;
valves
.
addItem
(
vave
);
}
...
...
@@ -153,9 +159,9 @@ bool CivInpDbHelper::getValve(CivValve& valves)
bool
CivInpDbHelper
::
getPumps
(
CivPumps
&
pumps
)
{
CivPumpTableTemp
::
PumpTable
pmTable
;
PumpTable
pmTable
;
std
::
vector
<
std
::
string
>
fields
=
{
pmTable
.
thePoint
,
pmTable
.
sn
,
pmTable
.
startPoint
,
pmTable
.
endPoint
,
pmTable
.
headCurve
...
...
@@ -170,7 +176,7 @@ bool CivInpDbHelper::getPumps(CivPumps& pumps)
CivPumps
::
PumpTable
pump
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
pump
.
ID
=
map
.
find
(
pmTable
.
thePoint
)
->
second
;
pump
.
ID
=
map
.
find
(
pmTable
.
sn
)
->
second
;
pump
.
Node1
=
map
.
find
(
pmTable
.
startPoint
)
->
second
;
pump
.
Node2
=
map
.
find
(
pmTable
.
endPoint
)
->
second
;
pump
.
Parameters
=
map
.
find
(
pmTable
.
headCurve
)
->
second
;
...
...
@@ -182,11 +188,11 @@ bool CivInpDbHelper::getPumps(CivPumps& pumps)
bool
CivInpDbHelper
::
getReservoirs
(
CivReservoirs
&
reservoirs
)
{
CivResourcesTableTemp
::
ResourcesTable
restemTable
;
ResourcesTable
restemTable
;
std
::
vector
<
std
::
string
>
fields
=
{
restemTable
.
thePoint
,
restemTable
.
h
ead
,
restemTable
.
sn
,
restemTable
.
totalH
ead
,
restemTable
.
headPattern
};
...
...
@@ -199,8 +205,8 @@ bool CivInpDbHelper::getReservoirs(CivReservoirs& reservoirs)
CivReservoirs
::
ReservoirsTable
resTable
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
resTable
.
ID
=
map
.
find
(
restemTable
.
thePoint
)
->
second
;
resTable
.
Head
=
map
.
find
(
restemTable
.
h
ead
)
->
second
;
resTable
.
ID
=
map
.
find
(
restemTable
.
sn
)
->
second
;
resTable
.
Head
=
map
.
find
(
restemTable
.
totalH
ead
)
->
second
;
resTable
.
Pattern
=
map
.
find
(
restemTable
.
headPattern
)
->
second
;
reservoirs
.
addItem
(
resTable
);
...
...
@@ -215,10 +221,10 @@ bool CivInpDbHelper::getEmitters(CivEmitters& emitter)
bool
CivInpDbHelper
::
getCoordinates
(
CivCoordinates
&
coord
)
{
CivJunctionTableTemp
::
JunctionTable
nodeTable
;
JunctionTable
nodeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTable
.
thePoint
,
nodeTable
.
sn
,
nodeTable
.
xCoord
,
nodeTable
.
yCoord
};
...
...
@@ -251,7 +257,7 @@ bool CivInpDbHelper::getMixing(CivMixing& mixing)
bool
CivInpDbHelper
::
getParameter
(
std
::
vector
<
CivParameter
>&
params
)
{
CivParametorTableTemp
::
ParametorTable
restemTable
;
ParametorTable
restemTable
;
std
::
vector
<
std
::
string
>
fields
=
{
restemTable
.
name
,
...
...
@@ -295,7 +301,7 @@ bool CivInpDbHelper::getParameter(std::vector<CivParameter>& params)
bool
CivInpDbHelper
::
getPatterns
(
CivPatterns
&
patterns
)
{
CivPatternTableTemp
::
PatternTable
patternTable
;
PatternTable
patternTable
;
std
::
vector
<
std
::
string
>
fields
=
{
patternTable
.
modelName
,
...
...
@@ -323,12 +329,12 @@ bool CivInpDbHelper::getPatterns(CivPatterns& patterns)
bool
CivInpDbHelper
::
getCurves
(
CivCurves
&
curves
)
{
C
ivCurveTableTemp
::
C
urveTable
curveTable
;
CurveTable
curveTable
;
std
::
vector
<
std
::
string
>
fields
=
{
curveTable
.
CurveName
,
curveTable
.
CurveType
,
curveTable
.
CurveData
curveTable
.
CurveName
,
curveTable
.
CurveType
,
curveTable
.
CurveData
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
...
...
@@ -367,9 +373,9 @@ bool CivInpDbHelper::getStatus(CivStatus& status)
bool
CivInpDbHelper
::
getQuality
(
CivQuality
&
quality
)
{
CivJunctionTableTemp
::
JunctionTable
nodeTable
;
JunctionTable
nodeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTable
.
thePoint
,
nodeTable
.
initQuality
};
std
::
vector
<
std
::
string
>
fields
=
{
nodeTable
.
sn
,
nodeTable
.
initQuality
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PIPENODE
,
fields
,
resultVector
);
...
...
pandaDbManager/CivInpHelperAbs.cpp
View file @
e70c7e93
...
...
@@ -15,195 +15,31 @@ CivInpHelperAbs::~CivInpHelperAbs()
bool
CivInpHelperAbs
::
getNode
(
CivNode
&
node
)
{
CivJunctionTableTemp
::
JunctionTable
nodeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTable
.
thePoint
,
nodeTable
.
elev
,
nodeTable
.
demand
,
nodeTable
.
pattern
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PUMP
,
fields
,
resultVector
);
// 编辑包装结果
size_t
total
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
CivNode
::
NodeTable
nodeTable
;
nodeTable
.
ID
=
map
.
find
(
nodeTable
.
ID
)
->
second
;
nodeTable
.
Elev
=
map
.
find
(
nodeTable
.
Elev
)
->
second
;
nodeTable
.
Demand
=
map
.
find
(
nodeTable
.
Demand
)
->
second
;
nodeTable
.
PatternId
=
map
.
find
(
nodeTable
.
PatternId
)
->
second
;
node
.
addItem
(
nodeTable
);
}
return
true
;
}
bool
CivInpHelperAbs
::
getPipe
(
CivPipe
&
pipes
)
{
CivPipeTableTemp
::
PipeTable
pipeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
pipeTable
.
snNo
,
pipeTable
.
lastPoint
,
pipeTable
.
thePoint
,
pipeTable
.
length
,
pipeTable
.
diameter
,
pipeTable
.
friction
,
pipeTable
.
localHeadLoss
,
pipeTable
.
status
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PUMP
,
fields
,
resultVector
);
size_t
total
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
CivPipe
::
PipesTable
pipe
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
pipe
.
ID
=
map
.
find
(
pipeTable
.
snNo
)
->
second
;
pipe
.
Node1
=
map
.
find
(
pipeTable
.
lastPoint
)
->
second
;
pipe
.
Node2
=
map
.
find
(
pipeTable
.
thePoint
)
->
second
;
pipe
.
Length
=
map
.
find
(
pipeTable
.
length
)
->
second
;
pipe
.
Diameter
=
map
.
find
(
pipeTable
.
diameter
)
->
second
;
pipe
.
Roughness
=
map
.
find
(
pipeTable
.
friction
)
->
second
;
pipe
.
MinorLoss
=
map
.
find
(
pipeTable
.
localHeadLoss
)
->
second
;
pipe
.
Status
=
map
.
find
(
pipeTable
.
status
)
->
second
;
pipes
.
addItem
(
pipe
);
}
return
true
;
}
bool
CivInpHelperAbs
::
getTank
(
CivTank
&
tanks
)
{
CivTankTableTemp
::
TankTable
tankTable
;
std
::
vector
<
std
::
string
>
fields
=
{
tankTable
.
thePoint
,
tankTable
.
elev
,
tankTable
.
initLevel
,
tankTable
.
lowLevel
,
tankTable
.
highLevel
,
tankTable
.
diametor
,
tankTable
.
capacity
,
tankTable
.
volCurve
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PUMP
,
fields
,
resultVector
);
size_t
total
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
CivTank
::
TankTable
tank
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
tank
.
ID
=
map
.
find
(
tankTable
.
thePoint
)
->
second
;
tank
.
Elev
=
map
.
find
(
tankTable
.
elev
)
->
second
;
tank
.
InitLevel
=
map
.
find
(
tankTable
.
initLevel
)
->
second
;
tank
.
MinLevel
=
map
.
find
(
tankTable
.
lowLevel
)
->
second
;
tank
.
MaxLevel
=
map
.
find
(
tankTable
.
highLevel
)
->
second
;
tank
.
Diameter
=
map
.
find
(
tankTable
.
diametor
)
->
second
;
tank
.
MinVol
=
map
.
find
(
tankTable
.
capacity
)
->
second
;
tank
.
VolCurve
=
map
.
find
(
tankTable
.
volCurve
)
->
second
;
tanks
.
addItem
(
tank
);
}
return
true
;
}
bool
CivInpHelperAbs
::
getValve
(
CivValve
&
valves
)
{
CivValveTableTemp
::
ValveTable
vaveTable
;
std
::
vector
<
std
::
string
>
fields
=
{
vaveTable
.
id
,
vaveTable
.
startPoint
,
vaveTable
.
endPoint
,
vaveTable
.
diameter
,
vaveTable
.
type
,
vaveTable
.
setting
,
vaveTable
.
loss
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PUMP
,
fields
,
resultVector
);
size_t
totals
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
totals
;
i
++
)
{
CivValve
::
ValveTable
vave
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
vave
.
ID
=
map
.
find
(
vaveTable
.
id
)
->
second
;
vave
.
Node1
=
map
.
find
(
vaveTable
.
startPoint
)
->
second
;
vave
.
Node2
=
map
.
find
(
vaveTable
.
endPoint
)
->
second
;
vave
.
Diameter
=
map
.
find
(
vaveTable
.
diameter
)
->
second
;
vave
.
Type
=
map
.
find
(
vaveTable
.
type
)
->
second
;
vave
.
Setting
=
map
.
find
(
vaveTable
.
setting
)
->
second
;
vave
.
MinorLoss
=
map
.
find
(
vaveTable
.
loss
)
->
second
;
valves
.
addItem
(
vave
);
}
return
true
;
}
bool
CivInpHelperAbs
::
getPumps
(
CivPumps
&
pumps
)
{
CivPumpTableTemp
::
PumpTable
pmTable
;
std
::
vector
<
std
::
string
>
fields
=
{
pmTable
.
thePoint
,
pmTable
.
startPoint
,
pmTable
.
endPoint
,
pmTable
.
headCurve
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PUMP
,
fields
,
resultVector
);
size_t
totals
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
totals
;
i
++
)
{
CivPumps
::
PumpTable
pump
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
pump
.
ID
=
map
.
find
(
pmTable
.
thePoint
)
->
second
;
pump
.
Node1
=
map
.
find
(
pmTable
.
startPoint
)
->
second
;
pump
.
Node2
=
map
.
find
(
pmTable
.
endPoint
)
->
second
;
pump
.
Parameters
=
map
.
find
(
pmTable
.
headCurve
)
->
second
;
pumps
.
addItem
(
pump
);
}
return
true
;
}
bool
CivInpHelperAbs
::
getReservoirs
(
CivReservoirs
&
reservoirs
)
{
CivResourcesTableTemp
::
ResourcesTable
restemTable
;
std
::
vector
<
std
::
string
>
fields
=
{
restemTable
.
thePoint
,
restemTable
.
head
,
restemTable
.
headPattern
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PUMP
,
fields
,
resultVector
);
size_t
totals
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
totals
;
i
++
)
{
CivReservoirs
::
ReservoirsTable
resTable
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
resTable
.
ID
=
map
.
find
(
restemTable
.
thePoint
)
->
second
;
resTable
.
Head
=
map
.
find
(
restemTable
.
head
)
->
second
;
resTable
.
Pattern
=
map
.
find
(
restemTable
.
headPattern
)
->
second
;
reservoirs
.
addItem
(
resTable
);
}
return
true
;
}
...
...
@@ -214,32 +50,6 @@ bool CivInpHelperAbs::getEmitters(CivEmitters& emitter)
bool
CivInpHelperAbs
::
getCoordinates
(
CivCoordinates
&
coord
)
{
CivJunctionTableTemp
::
JunctionTable
nodeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTable
.
thePoint
,
nodeTable
.
xCoord
,
nodeTable
.
yCoord
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PIPENODE
,
fields
,
resultVector
);
mDbConn
->
query
(
TANK
,
fields
,
resultVector
);
mDbConn
->
query
(
RESIVOIR
,
fields
,
resultVector
);
size_t
totals
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
totals
;
i
++
)
{
CivCoordinates
::
CoordTable
coordTable
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
coordTable
.
ID
=
map
.
find
(
fields
[
0
])
->
second
;
coordTable
.
XCoord
=
map
.
find
(
fields
[
1
])
->
second
;
coordTable
.
YCoord
=
map
.
find
(
fields
[
2
])
->
second
;
coord
.
addItem
(
coordTable
);
}
return
true
;
}
...
...
@@ -250,102 +60,20 @@ bool CivInpHelperAbs::getMixing(CivMixing& mixing)
bool
CivInpHelperAbs
::
getParameter
(
std
::
vector
<
CivParameter
>&
params
)
{
CivParametorTableTemp
::
ParametorTable
restemTable
;
std
::
vector
<
std
::
string
>
fields
=
{
restemTable
.
name
,
restemTable
.
val
,
restemTable
.
type
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
OPTIONTTABLE
,
fields
,
resultVector
);
std
::
map
<
std
::
string
,
std
::
vector
<
CivParameter
::
ParamTable
>>
tempMap
;
for
(
int
i
=
0
;
i
<
resultVector
.
size
();
i
++
)
{
CivParameter
::
ParamTable
pTable
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
pTable
.
name
=
map
.
find
(
fields
[
0
])
->
second
;
pTable
.
val
=
map
.
find
(
fields
[
1
])
->
second
;
std
::
string
type
=
map
.
find
(
fields
[
2
])
->
second
;
tempMap
[
type
].
push_back
(
pTable
);
}
// 遍历临时存储的数据拼接参数对象
for
(
auto
iter
=
tempMap
.
begin
();
iter
!=
tempMap
.
end
();
iter
++
)
{
CivParameter
param
;
std
::
string
type
=
iter
->
first
;
std
::
vector
<
CivParameter
::
ParamTable
>
paramTables
=
iter
->
second
;
param
.
setType
(
type
);
int
total
=
paramTables
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
param
.
addItem
(
paramTables
[
i
]);
params
.
push_back
(
param
);
}
return
true
;
}
bool
CivInpHelperAbs
::
getPatterns
(
CivPatterns
&
patterns
)
{
CivPatternTableTemp
::
PatternTable
patternTable
;
std
::
vector
<
std
::
string
>
fields
=
{
patternTable
.
modelName
,
patternTable
.
modelData
,
patternTable
.
modelType
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PATTERNTABLE
,
fields
,
resultVector
);
size_t
totals
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
totals
;
i
++
)
{
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
CivPatterns
::
PatternTable
pTable
;
pTable
.
name
=
map
.
find
(
fields
[
0
])
->
second
;
pTable
.
val
=
map
.
find
(
fields
[
1
])
->
second
;
patterns
.
addItem
(
pTable
);
}
return
true
;
}
bool
CivInpHelperAbs
::
getCurves
(
CivCurves
&
curves
)
{
CivCurveTableTemp
::
CurveTable
curveTable
;
std
::
vector
<
std
::
string
>
fields
=
{
curveTable
.
CurveName
,
curveTable
.
CurveType
,
curveTable
.
CurveData
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PATTERNTABLE
,
fields
,
resultVector
);
size_t
totals
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
totals
;
i
++
)
{
CivCurves
::
CurvesTable
cTable
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
cTable
.
ID
=
map
.
find
(
fields
[
0
])
->
second
;
cTable
.
XCoord
=
map
.
find
(
fields
[
1
])
->
second
;
cTable
.
YCoord
=
map
.
find
(
fields
[
2
])
->
second
;
curves
.
addItem
(
cTable
);
}
return
true
;
}
...
...
@@ -366,25 +94,6 @@ bool CivInpHelperAbs::getStatus(CivStatus& status)
bool
CivInpHelperAbs
::
getQuality
(
CivQuality
&
quality
)
{
CivJunctionTableTemp
::
JunctionTable
nodeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTable
.
thePoint
,
nodeTable
.
initQuality
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PIPENODE
,
fields
,
resultVector
);
size_t
totals
=
resultVector
.
size
();
for
(
int
i
=
0
;
i
<
totals
;
i
++
)
{
CivQuality
::
QualityTable
quliTable
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
quliTable
.
ID
=
map
.
find
(
fields
[
0
])
->
second
;
quliTable
.
InitQuality
=
map
.
find
(
fields
[
1
])
->
second
;;
quality
.
addItem
(
quliTable
);
}
return
true
;
}
...
...
pandaDbManager/CivInpHelperAbs.h
View file @
e70c7e93
...
...
@@ -4,12 +4,11 @@
class
CivConnection
;
/**
תinpݿ
תinpݿ
*/
class
CivInpHelperAbs
{
public
:
explicit
CivInpHelperAbs
(
CivConnection
*
dbConn
);
virtual
~
CivInpHelperAbs
();
...
...
pandaDbManager/CivPgConn.cpp
View file @
e70c7e93
...
...
@@ -317,7 +317,7 @@ bool CivPgConn::getPipe(CivPipe& pipe)
sql
.
append
(
","
);
sql
.
append
(
pipeTable
.
status
);
sql
.
append
(
" from "
);
sql
.
append
(
PIPELINE
)
sql
.
append
(
PIPELINE
)
;
std
::
string
utf8Sql
=
TransUTFCoding
(
sql
);
if
(
!
execSql
(
utf8Sql
))
...
...
@@ -469,7 +469,6 @@ bool CivPgConn::getPumps(CivPumps& pump)
std
::
string
utf8Sql
=
TransUTFCoding
(
sql
);
if
(
!
execSql
(
utf8Sql
))
{
/* CivSysLog::getInstance()->error(mLastError, "CivPgConn", __FUNCTION__);*/
return
false
;
}
...
...
@@ -491,11 +490,11 @@ bool CivPgConn::getPumps(CivPumps& pump)
bool
CivPgConn
::
getReservoirs
(
CivReservoirs
&
reservoirs
)
{
CivResourcesTableTemp
::
ResourcesTable
restemTable
;
ResourcesTable
restemTable
;
//;ID Head Pattern
std
::
string
sql
=
"select "
;
sql
.
append
(
restemTable
.
thePoint
);
sql
.
append
(
restemTable
.
sn
);
sql
.
append
(
","
);
sql
.
append
(
restemTable
.
head
);
sql
.
append
(
","
);
...
...
@@ -566,7 +565,6 @@ bool CivPgConn::getCoordinates(CivCoordinates& coord)
if
(
!
execSql
(
sql
))
{
CivSysLog
::
getInstance
()
->
error
(
mLastError
,
"CivPgConn"
,
__FUNCTION__
);
return
false
;
}
...
...
@@ -867,88 +865,4 @@ bool CivPgConn::getValuesFromTableByCondition(
PQclear
(
mResult
);
return
true
;
}
void
CivPgConn
::
checkHyDrNetTable
()
{
// 创建曲线表
CivCurveTableTemp
temp
;
if
(
!
tableExist
(
temp
.
name
()))
{
createTable
(
temp
);
}
// 参数表
CivParametorTableTemp
paraTemp
;
if
(
!
tableExist
(
paraTemp
.
name
()))
{
createTable
(
paraTemp
);
}
// 模式表
CivPatternTableTemp
patternTemp
;
if
(
!
tableExist
(
patternTemp
.
name
()))
{
createTable
(
patternTemp
);
}
// 结果点表
CivNodeResultTableTemp
nodeTemp
;
if
(
!
tableExist
(
nodeTemp
.
name
()))
{
createTable
(
nodeTemp
);
}
// 结果线表
CivPipeResultTableTemp
pipeTemp
;
if
(
!
tableExist
(
pipeTemp
.
name
()))
{
createTable
(
pipeTemp
);
}
// 方案电表
CivProjNodeTableTemp
projeNodeTemp
;
if
(
!
tableExist
(
projeNodeTemp
.
name
()))
{
createTable
(
projeNodeTemp
);
}
//方案线表
CivProjPipeTableTemp
projPipeTemp
;
if
(
!
tableExist
(
projPipeTemp
.
name
()))
{
createTable
(
projPipeTemp
);
}
// 方案表
CivProjTableTemp
projTemp
;
if
(
!
tableExist
(
projTemp
.
name
()))
{
createTable
(
projTemp
);
}
// 监测点压力
CivMonitorPressureTableTemp
pressureTemp
;
if
(
!
tableExist
(
pressureTemp
.
name
()))
{
createTable
(
pressureTemp
);
}
// 监测点流量
CivMonitorFlowTableTemp
flowTemp
;
if
(
!
tableExist
(
flowTemp
.
name
()))
{
createTable
(
flowTemp
);
}
// 监测点水质表
CivMonitorQualityTableTemp
qualityTemp
;
if
(
!
tableExist
(
qualityTemp
.
name
()))
{
createTable
(
qualityTemp
);
}
}
}
\ No newline at end of file
pandaDbManager/CivPgConn.h
View file @
e70c7e93
...
...
@@ -53,14 +53,6 @@ public:
bool
getLabels
(
CivLabels
&
labels
)
override
;
bool
getTags
(
CivTags
&
tags
)
override
;
/**
*@brief 创建表格
*@param tableName: 表名
*@param schema:
*@param tableType:表类型,点结果,线结果
*/
bool
createTable
(
CivTableTemp
&
temp
)
override
;
/**
*@brief 根据字段值条件删除数据
*@param table:表
...
...
@@ -90,8 +82,6 @@ public:
const
std
::
string
&
condition
,
const
std
::
vector
<
std
::
string
>&
fileds
,
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>&
result
)
override
;
void
checkHyDrNetTable
()
override
;
private
:
PGconn
*
mConn
;
// 连接对象
...
...
pandaDbManager/CivTableTemp.cpp
deleted
100644 → 0
View file @
2b546d06
#include "CivTableTemp.h"
#include "CivDbConn.h"
CivTableTemp
::
CivTableTemp
()
{
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_INT
,
"int"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_INTEGER
,
"integer"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_DOUBLE
,
"double precision"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_VARCHAR
,
"varchar(32)"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_VARCHAR64
,
"varchar(64)"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_VARCHAR128
,
"varchar(128)"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_VARCHAR256
,
"varchar(256)"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_BOOLEAN
,
"boolean"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_CHARACTER_VARYING
,
"character varying"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_DATETIME
,
"timestamp"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_JSON
,
"json"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_DATE
,
"date"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_GEOM_POINT
,
"geometry(Point,4326)"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_GEOM_LINE
,
"geometry(MultiLineString,4326)"
));
}
CivTableTemp
::~
CivTableTemp
()
{
}
void
CivTableTemp
::
addProperty
(
Str
fileName
,
FieldType
filedType
)
{
FieldProperty
prop
=
{
fileName
,
mFieldTyepMap
.
find
(
filedType
)
->
second
};
mPropertys
.
push_back
(
prop
);
}
Str
CivTableTemp
::
createSql
()
{
if
(
mPropertys
.
size
()
<=
0
)
return
Str
();
std
::
string
sql
=
"create table "
;
sql
.
append
(
mTableName
);
sql
.
append
(
"(id serial primary key"
);
size_t
total
=
mPropertys
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
FieldProperty
property
=
mPropertys
[
i
];
sql
.
append
(
","
);
sql
.
append
(
"
\"
"
+
property
.
mFiledName
+
"
\"
"
);
sql
.
append
(
" "
);
sql
.
append
(
property
.
mFieldType
);
}
sql
.
append
(
")"
);
return
sql
;
}
bool
CivTableTemp
::
updateToDb
(
CivDbConn
*
dbConn
)
{
if
(
dbConn
==
nullptr
)
return
false
;
Str
sql
=
createSql
();
return
true
;
}
CivJunctionTableTemp
::
CivJunctionTableTemp
(
Str
tableName
)
{
setName
(
PIPENODE
);
TableFileds
fileds
;
addProperty
(
fileds
.
ID
,
CivTableTemp
::
FILED_VARCHAR
);
// "id";
addProperty
(
fileds
.
geom
,
CivTableTemp
::
FILED_VARCHAR
);
// "geom";
addProperty
(
fileds
.
thePoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "本点号";
addProperty
(
fileds
.
xCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "横坐标";
addProperty
(
fileds
.
yCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "纵坐标";
addProperty
(
fileds
.
elev
,
CivTableTemp
::
FILED_VARCHAR
);
// "高程";
addProperty
(
fileds
.
demand
,
CivTableTemp
::
FILED_VARCHAR
);
// "需水量";
addProperty
(
fileds
.
pattern
,
CivTableTemp
::
FILED_VARCHAR
);
// "需水量模式";
addProperty
(
fileds
.
head
,
CivTableTemp
::
FILED_VARCHAR
);
// "总水头";
addProperty
(
fileds
.
freeHead
,
CivTableTemp
::
FILED_VARCHAR
);
// "自由水头";
addProperty
(
fileds
.
actualDemand
,
CivTableTemp
::
FILED_VARCHAR
);
// "实际需水量";
addProperty
(
fileds
.
code
,
CivTableTemp
::
FILED_VARCHAR
);
// "code";
addProperty
(
fileds
.
createUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_user";
addProperty
(
fileds
.
modifyUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_user";
addProperty
(
fileds
.
createTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_time";
addProperty
(
fileds
.
modifyTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_time";
addProperty
(
fileds
.
symbolAngle
,
CivTableTemp
::
FILED_VARCHAR
);
// "symbol_angle";
addProperty
(
fileds
.
compType
,
CivTableTemp
::
FILED_VARCHAR
);
// "组分类型";
addProperty
(
fileds
.
pressure
,
CivTableTemp
::
FILED_VARCHAR
);
// "压力";
addProperty
(
fileds
.
quality
,
CivTableTemp
::
FILED_VARCHAR
);
// "水质";
};
/**
管线表模板
*/
CivPipeTableTemp
::
CivPipeTableTemp
()
:
CivTableTemp
()
{
setName
(
PIPELINE
);
TableFileds
fileds
;
addProperty
(
fileds
.
ID
,
CivTableTemp
::
FILED_VARCHAR
);
// "id";
addProperty
(
fileds
.
geom
,
CivTableTemp
::
FILED_VARCHAR
);
// "geom";
addProperty
(
fileds
.
snNo
,
CivTableTemp
::
FILED_VARCHAR
);
// "编号";
addProperty
(
fileds
.
thePoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "上点号";
addProperty
(
fileds
.
lastPoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "本点号";
addProperty
(
fileds
.
length
,
CivTableTemp
::
FILED_VARCHAR
);
// "管长";
addProperty
(
fileds
.
material
,
CivTableTemp
::
FILED_VARCHAR
);
// "管材";
addProperty
(
fileds
.
diameter
,
CivTableTemp
::
FILED_VARCHAR
);
// "管径";
addProperty
(
fileds
.
friction
,
CivTableTemp
::
FILED_VARCHAR
);
// "摩阻系数";
addProperty
(
fileds
.
localLoss
,
CivTableTemp
::
FILED_VARCHAR
);
// "局部损失系";
addProperty
(
fileds
.
initStatus
,
CivTableTemp
::
FILED_VARCHAR
);
// "初始状态";
addProperty
(
fileds
.
buryingTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "埋设时间";
addProperty
(
fileds
.
flow
,
CivTableTemp
::
FILED_VARCHAR
);
// "流量";
addProperty
(
fileds
.
velocity
,
CivTableTemp
::
FILED_VARCHAR
);
// "流速";
addProperty
(
fileds
.
unitHeadLoss
,
CivTableTemp
::
FILED_VARCHAR
);
// "单位水头损";
addProperty
(
fileds
.
headLoss
,
CivTableTemp
::
FILED_VARCHAR
);
// "水头总损失";
addProperty
(
fileds
.
unitPressLoss
,
CivTableTemp
::
FILED_VARCHAR
);
// "单位压力损";
addProperty
(
fileds
.
pressLoss
,
CivTableTemp
::
FILED_VARCHAR
);
// "压力总损失";
addProperty
(
fileds
.
lastHead
,
CivTableTemp
::
FILED_VARCHAR
);
// "上点水头";
addProperty
(
fileds
.
theHead
,
CivTableTemp
::
FILED_VARCHAR
);
// "本点水头";
addProperty
(
fileds
.
lastPress
,
CivTableTemp
::
FILED_VARCHAR
);
// "上点压力";
addProperty
(
fileds
.
thePress
,
CivTableTemp
::
FILED_VARCHAR
);
// "本点压力";
addProperty
(
fileds
.
localHeadLoss
,
CivTableTemp
::
FILED_VARCHAR
);
// "局部水头损";
addProperty
(
fileds
.
fracHeadLoss
,
CivTableTemp
::
FILED_VARCHAR
);
// "摩擦水头损";
addProperty
(
fileds
.
status
,
CivTableTemp
::
FILED_VARCHAR
);
// "状态";
addProperty
(
fileds
.
guid
,
CivTableTemp
::
FILED_VARCHAR
);
// "guid";
addProperty
(
fileds
.
code
,
CivTableTemp
::
FILED_VARCHAR
);
// "code";
addProperty
(
fileds
.
fromCode
,
CivTableTemp
::
FILED_VARCHAR
);
// "from_code";
addProperty
(
fileds
.
fromLayer
,
CivTableTemp
::
FILED_VARCHAR
);
// "from_layer";
addProperty
(
fileds
.
toCode
,
CivTableTemp
::
FILED_VARCHAR
);
// "to_code";
addProperty
(
fileds
.
toLayer
,
CivTableTemp
::
FILED_VARCHAR
);
// "to_layer";
addProperty
(
fileds
.
createUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_user";
addProperty
(
fileds
.
modifyUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_user";
addProperty
(
fileds
.
createTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_time";
addProperty
(
fileds
.
modifyTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_time";
addProperty
(
fileds
.
remarks
,
CivTableTemp
::
FILED_VARCHAR
);
// "备注";
addProperty
(
fileds
.
quality
,
CivTableTemp
::
FILED_VARCHAR
);
// "水质";
}
/**
水泵
*/
CivPumpTableTemp
::
CivPumpTableTemp
()
:
CivTableTemp
()
{
setName
(
PUMP
);
TableFileds
fileds
;
addProperty
(
fileds
.
ID
,
CivTableTemp
::
FILED_VARCHAR
);
// "id";
addProperty
(
fileds
.
geom
,
CivTableTemp
::
FILED_VARCHAR
);
// "geom";
addProperty
(
fileds
.
thePoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "本点号";
addProperty
(
fileds
.
xCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "横坐标";
addProperty
(
fileds
.
yCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "纵坐标";
addProperty
(
fileds
.
startPoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "起始节点";
addProperty
(
fileds
.
endPoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "终止节点";
addProperty
(
fileds
.
curve
,
CivTableTemp
::
FILED_VARCHAR
);
// "水泵曲线";
addProperty
(
fileds
.
ratio
,
CivTableTemp
::
FILED_VARCHAR
);
// "转速比";
addProperty
(
fileds
.
flow
,
CivTableTemp
::
FILED_VARCHAR
);
// "流量";
addProperty
(
fileds
.
headCurve
,
CivTableTemp
::
FILED_VARCHAR
);
// "扬程曲线";
addProperty
(
fileds
.
status
,
CivTableTemp
::
FILED_VARCHAR
);
// "状态";
addProperty
(
fileds
.
code
,
CivTableTemp
::
FILED_VARCHAR
);
// "code";
addProperty
(
fileds
.
createUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_user";
addProperty
(
fileds
.
modifyUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_user";
addProperty
(
fileds
.
createTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_time";
addProperty
(
fileds
.
modifyTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_time";
addProperty
(
fileds
.
SymbolAngle
,
CivTableTemp
::
FILED_VARCHAR
);
// "symbol_angle";
addProperty
(
fileds
.
compType
,
CivTableTemp
::
FILED_VARCHAR
);
// "组分类型";
addProperty
(
fileds
.
power
,
CivTableTemp
::
FILED_VARCHAR
);
// "功率";
}
/**
水池
*/
CivTankTableTemp
::
CivTankTableTemp
()
:
CivTableTemp
()
{
setName
(
TANK
);
TableFileds
fileds
;
addProperty
(
fileds
.
ID
,
CivTableTemp
::
FILED_VARCHAR
);
// "id";
addProperty
(
fileds
.
geom
,
CivTableTemp
::
FILED_VARCHAR
);
// "geom";
addProperty
(
fileds
.
thePoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "本点号";
addProperty
(
fileds
.
xCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "横坐标";
addProperty
(
fileds
.
yCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "纵坐标";
addProperty
(
fileds
.
elev
,
CivTableTemp
::
FILED_VARCHAR
);
// "高程";
addProperty
(
fileds
.
diametor
,
CivTableTemp
::
FILED_VARCHAR
);
// "直径";
addProperty
(
fileds
.
baseLevel
,
CivTableTemp
::
FILED_VARCHAR
);
// "基础水位";
addProperty
(
fileds
.
initLevel
,
CivTableTemp
::
FILED_VARCHAR
);
// "初始水位";
addProperty
(
fileds
.
highLevel
,
CivTableTemp
::
FILED_VARCHAR
);
// "最高水位";
addProperty
(
fileds
.
lowLevel
,
CivTableTemp
::
FILED_VARCHAR
);
// "最低水位";
addProperty
(
fileds
.
flowIn
,
CivTableTemp
::
FILED_VARCHAR
);
// "输入流量";
addProperty
(
fileds
.
flowOut
,
CivTableTemp
::
FILED_VARCHAR
);
// "输出流量";
addProperty
(
fileds
.
leveHeight
,
CivTableTemp
::
FILED_VARCHAR
);
// "液位高度";
addProperty
(
fileds
.
capacity
,
CivTableTemp
::
FILED_VARCHAR
);
// "容量";
addProperty
(
fileds
.
percentage
,
CivTableTemp
::
FILED_VARCHAR
);
// "装满水池百";
addProperty
(
fileds
.
status
,
CivTableTemp
::
FILED_VARCHAR
);
// "状态";
addProperty
(
fileds
.
code
,
CivTableTemp
::
FILED_VARCHAR
);
// "code";
addProperty
(
fileds
.
createUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_user";
addProperty
(
fileds
.
modifyUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_user";
addProperty
(
fileds
.
createTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_time";
addProperty
(
fileds
.
modifyTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_time";
addProperty
(
fileds
.
SymbolAngle
,
CivTableTemp
::
FILED_VARCHAR
);
// "symbol_angle";
addProperty
(
fileds
.
compType
,
CivTableTemp
::
FILED_VARCHAR
);
// "组分类型";
}
/**
水库
*/
CivResourcesTableTemp
::
CivResourcesTableTemp
()
:
CivTableTemp
()
{
setName
(
RESIVOIR
);
TableFileds
fileds
;
addProperty
(
fileds
.
ID
,
CivTableTemp
::
FILED_VARCHAR
);
// "id";
addProperty
(
fileds
.
geom
,
CivTableTemp
::
FILED_VARCHAR
);
// "geom";
addProperty
(
fileds
.
thePoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "本点号";
addProperty
(
fileds
.
xCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "横坐标";
addProperty
(
fileds
.
yCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "纵坐标";
addProperty
(
fileds
.
headPattern
,
CivTableTemp
::
FILED_VARCHAR
);
// "水头模式曲";
addProperty
(
fileds
.
elev
,
CivTableTemp
::
FILED_VARCHAR
);
// "高程";
addProperty
(
fileds
.
head
,
CivTableTemp
::
FILED_VARCHAR
);
// "水头";
addProperty
(
fileds
.
flow
,
CivTableTemp
::
FILED_VARCHAR
);
// "流出流量";
addProperty
(
fileds
.
code
,
CivTableTemp
::
FILED_VARCHAR
);
// "code";
addProperty
(
fileds
.
createUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_user";
addProperty
(
fileds
.
modifyUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_user";
addProperty
(
fileds
.
createTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_time";
addProperty
(
fileds
.
modifyTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_time";
addProperty
(
fileds
.
SymbolAngle
,
CivTableTemp
::
FILED_VARCHAR
);
// "symbol_angle";
addProperty
(
fileds
.
compType
,
CivTableTemp
::
FILED_VARCHAR
);
// "组分类型";
}
/**
阀门
*/
CivValveTableTemp
::
CivValveTableTemp
()
:
CivTableTemp
()
{
setName
(
VALVE
);
TableFileds
fileds
;
addProperty
(
fileds
.
id
,
CivTableTemp
::
FILED_VARCHAR
);
// "本点号";
addProperty
(
fileds
.
geom
,
CivTableTemp
::
FILED_VARCHAR
);
// "geom";
addProperty
(
fileds
.
xCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "横坐标";
addProperty
(
fileds
.
yCoord
,
CivTableTemp
::
FILED_VARCHAR
);
// "纵坐标";
addProperty
(
fileds
.
startPoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "起始节点";
addProperty
(
fileds
.
endPoint
,
CivTableTemp
::
FILED_VARCHAR
);
// "终止节点";
addProperty
(
fileds
.
diameter
,
CivTableTemp
::
FILED_VARCHAR
);
// "直径";
addProperty
(
fileds
.
status
,
CivTableTemp
::
FILED_VARCHAR
);
// "状态";
addProperty
(
fileds
.
type
,
CivTableTemp
::
FILED_VARCHAR
);
// "阀门类型";
addProperty
(
fileds
.
setting
,
CivTableTemp
::
FILED_VARCHAR
);
// "阀门设置";
addProperty
(
fileds
.
loss
,
CivTableTemp
::
FILED_VARCHAR
);
// "损失系数";
addProperty
(
fileds
.
flow
,
CivTableTemp
::
FILED_VARCHAR
);
// "流量 ";
addProperty
(
fileds
.
veclocity
,
CivTableTemp
::
FILED_VARCHAR
);
// "流速";
addProperty
(
fileds
.
headLoss
,
CivTableTemp
::
FILED_VARCHAR
);
// "水头损失";
addProperty
(
fileds
.
code
,
CivTableTemp
::
FILED_VARCHAR
);
// "code";
addProperty
(
fileds
.
createUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_user";
addProperty
(
fileds
.
modityUser
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_user";
addProperty
(
fileds
.
createTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "create_time";
addProperty
(
fileds
.
modifyTime
,
CivTableTemp
::
FILED_VARCHAR
);
// "modify_time";
addProperty
(
fileds
.
symbolAngle
,
CivTableTemp
::
FILED_VARCHAR
);
// "symbol_angle";
addProperty
(
fileds
.
compType
,
CivTableTemp
::
FILED_VARCHAR
);
// "组分类型";
}
/**
节点模拟结果存储表
*/
CivNodeResultTableTemp
::
CivNodeResultTableTemp
()
:
CivTableTemp
()
{
setName
(
NODERESULTTABLE
);
NodeResultTable
nodeTable
;
addProperty
(
nodeTable
.
Number
,
CivTableTemp
::
FILED_VARCHAR
);
addProperty
(
nodeTable
.
dPressure
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
nodeTable
.
dHead
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
nodeTable
.
dElevation
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
nodeTable
.
dDemand
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
nodeTable
.
dTankVolume
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
nodeTable
.
dTankMaxVolume
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
nodeTable
.
dTankLevel
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
nodeTable
.
dQuality
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
nodeTable
.
dDate
,
CivTableTemp
::
FILED_DATE
);
addProperty
(
nodeTable
.
dInterval
,
CivTableTemp
::
FILED_INT
);
addProperty
(
nodeTable
.
dModifyTime
,
CivTableTemp
::
FILED_DATETIME
);
}
/**
模拟结果线表
*/
CivPipeResultTableTemp
::
CivPipeResultTableTemp
()
:
CivTableTemp
()
{
setName
(
PIPERESULTTABLE
);
TableField
pipeFileds
;
addProperty
(
pipeFileds
.
szNo
,
CivTableTemp
::
FILED_VARCHAR
);
addProperty
(
pipeFileds
.
dFlow
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
pipeFileds
.
nFlowDirect
,
CivTableTemp
::
FILED_INT
);
addProperty
(
pipeFileds
.
dVelocity
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
pipeFileds
.
dHeadloss
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
pipeFileds
.
dUnitHeadloss
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
pipeFileds
.
dFromNodHeadloss
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
pipeFileds
.
dToNodHeadloss
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
pipeFileds
.
dLocalHeadloss
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
pipeFileds
.
dFrictionHeadloss
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
pipeFileds
.
szStatus
,
CivTableTemp
::
FILED_VARCHAR
);
addProperty
(
pipeFileds
.
dQuality
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
pipeFileds
.
dDate
,
CivTableTemp
::
FILED_DATE
);
addProperty
(
pipeFileds
.
dInterval
,
CivTableTemp
::
FILED_INT
);
addProperty
(
pipeFileds
.
dModifyTime
,
CivTableTemp
::
FILED_DATETIME
);
}
/**
模式表
*/
CivPatternTableTemp
::
CivPatternTableTemp
()
:
CivTableTemp
()
{
setName
(
PATTERNTABLE
);
TableField
fileds
;
addProperty
(
fileds
.
modelName
,
CivTableTemp
::
FILED_VARCHAR
);
addProperty
(
fileds
.
modelData
,
CivTableTemp
::
FILED_VARCHAR64
);
addProperty
(
fileds
.
modelType
,
CivTableTemp
::
FILED_INTEGER
);
}
/**
参数表
*/
CivParametorTableTemp
::
CivParametorTableTemp
()
:
CivTableTemp
()
{
setName
(
OPTIONTTABLE
);
TableField
fileds
;
addProperty
(
fileds
.
name
,
CivTableTemp
::
FILED_VARCHAR
);
addProperty
(
fileds
.
val
,
CivTableTemp
::
FILED_VARCHAR
);
addProperty
(
fileds
.
type
,
CivTableTemp
::
FILED_VARCHAR
);
addProperty
(
fileds
.
netName
,
CivTableTemp
::
FILED_VARCHAR64
);
}
/**
曲线表
*/
CivCurveTableTemp
::
CivCurveTableTemp
()
:
CivTableTemp
()
{
setName
(
CURVETABLE
);
TableField
fileds
;
addProperty
(
fileds
.
CurveName
,
CivTableTemp
::
FILED_VARCHAR64
);
addProperty
(
fileds
.
CurveType
,
CivTableTemp
::
FILED_INTEGER
);
addProperty
(
fileds
.
CurveData
,
CivTableTemp
::
FILED_VARCHAR256
);
}
/**
方案点表
*/
CivProjNodeTableTemp
::
CivProjNodeTableTemp
()
:
CivTableTemp
()
{
setName
(
PROJNODETABLE
);
TableField
fileds
;
addProperty
(
fileds
.
ProjCode
,
CivTableTemp
::
FILED_VARCHAR64
);
addProperty
(
fileds
.
ProjType
,
CivTableTemp
::
FILED_INT
);
addProperty
(
fileds
.
ProjGeom
,
CivTableTemp
::
FILED_GEOM_POINT
);
addProperty
(
fileds
.
ProjSn
,
CivTableTemp
::
FILED_VARCHAR64
);
addProperty
(
fileds
.
ProjXcoord
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjYcoord
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjDesc
,
CivTableTemp
::
FILED_CHARACTER_VARYING
);
addProperty
(
fileds
.
ProjLabel
,
CivTableTemp
::
FILED_VARCHAR64
);
addProperty
(
fileds
.
ProElev
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjBaseDemand
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjPattern
,
CivTableTemp
::
FILED_VARCHAR64
);
addProperty
(
fileds
.
ProjDemandType
,
CivTableTemp
::
FILED_VARCHAR64
);
addProperty
(
fileds
.
ProjDiffuserCoeff
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjInitQuality
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjSourceQuality
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjDmaID
,
CivTableTemp
::
FILED_VARCHAR64
);
addProperty
(
fileds
.
ProjDemand
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjConsumption
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjLackWater
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjLackWaterPer
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjTotalWater
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjTotalHead
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjPressure
,
CivTableTemp
::
FILED_DOUBLE
);
addProperty
(
fileds
.
ProjQuality
,
CivTableTemp
::
FILED_DOUBLE
);
}
/**
方案线表
*/
CivProjPipeTableTemp
::
CivProjPipeTableTemp
()
:
CivTableTemp
()
{
setName
(
PROJPIPETABLE
);
TableField
fileds
;
addProperty
(
fileds
.
ProjCode
,
CivTableTemp
::
FILED_VARCHAR64
);
// "方案名";
addProperty
(
fileds
.
ProjType
,
CivTableTemp
::
FILED_BOOLEAN
);
// "修改类型";
addProperty
(
fileds
.
ProjGeom
,
CivTableTemp
::
FILED_GEOM_LINE
);
// "Geom";
addProperty
(
fileds
.
ProjSn
,
CivTableTemp
::
FILED_VARCHAR64
);
// "编号";
addProperty
(
fileds
.
ProjStartID
,
CivTableTemp
::
FILED_VARCHAR64
);
// "起始节点";
addProperty
(
fileds
.
ProjEndID
,
CivTableTemp
::
FILED_VARCHAR64
);
// "终止节点";
addProperty
(
fileds
.
ProjDesc
,
CivTableTemp
::
FILED_CHARACTER_VARYING
);
// "描述";
addProperty
(
fileds
.
ProjLabel
,
CivTableTemp
::
FILED_VARCHAR64
);
// "标签";
addProperty
(
fileds
.
ProjLength
,
CivTableTemp
::
FILED_DOUBLE
);
// "管长";
addProperty
(
fileds
.
ProjDiameter
,
CivTableTemp
::
FILED_DOUBLE
);
// "管径";
addProperty
(
fileds
.
ProjMaterial
,
CivTableTemp
::
FILED_VARCHAR64
);
// "管材";
addProperty
(
fileds
.
ProjFractionCoeff
,
CivTableTemp
::
FILED_DOUBLE
);
// "摩阻系数";
addProperty
(
fileds
.
ProjLoclLossCoeff
,
CivTableTemp
::
FILED_DOUBLE
);
// "局损系数";
addProperty
(
fileds
.
ProjInitStatus
,
CivTableTemp
::
FILED_VARCHAR64
);
// "初始状态";
addProperty
(
fileds
.
ProjMainstreamCoeff
,
CivTableTemp
::
FILED_DOUBLE
);
// "主流系数";
addProperty
(
fileds
.
ProjWallCoeff
,
CivTableTemp
::
FILED_DOUBLE
);
// "管壁系数";
addProperty
(
fileds
.
ProjLeakageCoeff1
,
CivTableTemp
::
FILED_DOUBLE
);
// "漏水系数1";
addProperty
(
fileds
.
ProLeakageCoeff2
,
CivTableTemp
::
FILED_DOUBLE
);
// "漏水系数2";
addProperty
(
fileds
.
ProjDmaID
,
CivTableTemp
::
FILED_VARCHAR64
);
// "DMAID";
addProperty
(
fileds
.
ProjFlow
,
CivTableTemp
::
FILED_DOUBLE
);
// "流量";
addProperty
(
fileds
.
ProjVelocity
,
CivTableTemp
::
FILED_DOUBLE
);
// "流速";
addProperty
(
fileds
.
ProjUnitLoss
,
CivTableTemp
::
FILED_DOUBLE
);
// "单位水损";
addProperty
(
fileds
.
ProjStatus
,
CivTableTemp
::
FILED_DOUBLE
);
// "状态";
addProperty
(
fileds
.
ProjQuality
,
CivTableTemp
::
FILED_DOUBLE
);
// "水质";
addProperty
(
fileds
.
ProjWaterLeakage
,
CivTableTemp
::
FILED_DOUBLE
);
// "漏水量";
}
/**
方案表
*/
CivProjTableTemp
::
CivProjTableTemp
()
:
CivTableTemp
()
{
setName
(
PROJTABLE
);
TableField
fileds
;
addProperty
(
fileds
.
ProjName
,
CivTableTemp
::
FILED_VARCHAR64
);
// "方案名";
addProperty
(
fileds
.
ProjCode
,
CivTableTemp
::
FILED_VARCHAR64
);
// "方案编号";
addProperty
(
fileds
.
ProjType
,
CivTableTemp
::
FILED_VARCHAR64
);
// "方案类型";
addProperty
(
fileds
.
ProjCreator
,
CivTableTemp
::
FILED_VARCHAR64
);
// "创建人";
addProperty
(
fileds
.
ProjAddTime
,
CivTableTemp
::
FILED_DATETIME
);
// "创建时间";
addProperty
(
fileds
.
ProjUpdateTime
,
CivTableTemp
::
FILED_DATETIME
);
// "更新时间";
addProperty
(
fileds
.
ProjTime
,
CivTableTemp
::
FILED_DATETIME
);
// "方案时间";
addProperty
(
fileds
.
ProjScore
,
CivTableTemp
::
FILED_VARCHAR64
);
// "评分";
addProperty
(
fileds
.
ProDescribe
,
CivTableTemp
::
FILED_VARCHAR64
);
// "评价";
addProperty
(
fileds
.
ProjEvaluate
,
CivTableTemp
::
FILED_VARCHAR64
);
// "评估";
addProperty
(
fileds
.
ProjDemand
,
CivTableTemp
::
FILED_DOUBLE
);
// "水量调整";
addProperty
(
fileds
.
ProjWorkCode
,
CivTableTemp
::
FILED_VARCHAR64
);
// "作业编号";
addProperty
(
fileds
.
ProjDetection
,
CivTableTemp
::
FILED_VARCHAR64
);
// "关注检测点";
}
/**
压力监测表
*/
CivMonitorPressureTableTemp
::
CivMonitorPressureTableTemp
()
:
CivTableTemp
()
{
setName
(
PRESSURETABLE
);
TableField
fileds
;
addProperty
(
fileds
.
MonitorScard
,
CivTableTemp
::
FILED_VARCHAR64
);
// "SCADAID";
addProperty
(
fileds
.
MonitorXCoord
,
CivTableTemp
::
FILED_DOUBLE
);
// "横坐标";
addProperty
(
fileds
.
MonitorYCoord
,
CivTableTemp
::
FILED_DOUBLE
);
// "纵坐标 ";
addProperty
(
fileds
.
MonitorDesc
,
CivTableTemp
::
FILED_CHARACTER_VARYING
);
// "描述";
addProperty
(
fileds
.
MonitorLabel
,
CivTableTemp
::
FILED_VARCHAR64
);
// "标签";
addProperty
(
fileds
.
MonitorNode
,
CivTableTemp
::
FILED_VARCHAR64
);
// "节点ID ";
addProperty
(
fileds
.
MonitorMonitor
,
CivTableTemp
::
FILED_DOUBLE
);
// "检测值 ";
addProperty
(
fileds
.
MonitorCalc
,
CivTableTemp
::
FILED_DOUBLE
);
// "计算值 ";
addProperty
(
fileds
.
MonitorError
,
CivTableTemp
::
FILED_DOUBLE
);
// "误差";
addProperty
(
fileds
.
MonitorMonitorAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "检测平均值";
addProperty
(
fileds
.
MonitorCalcAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "计算平均值";
addProperty
(
fileds
.
MonitorErrorAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "平均误差 ";
addProperty
(
fileds
.
MonitorAbsErrirAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "平均绝对误差";
addProperty
(
fileds
.
MonitorSquareError
,
CivTableTemp
::
FILED_DOUBLE
);
// "均方根误差";
addProperty
(
fileds
.
MonitorErrorFlu
,
CivTableTemp
::
FILED_DOUBLE
);
// "误差波动";
addProperty
(
fileds
.
MonitorNashCoeff
,
CivTableTemp
::
FILED_DOUBLE
);
// "纳什系数";
addProperty
(
fileds
.
MonitorScore
,
CivTableTemp
::
FILED_DOUBLE
);
// "分数";
addProperty
(
fileds
.
MonitorReliability
,
CivTableTemp
::
FILED_VARCHAR64
);
// "可靠度";
}
/*
流量监测表
*/
CivMonitorFlowTableTemp
::
CivMonitorFlowTableTemp
()
:
CivTableTemp
()
{
setName
(
FLOWTABLE
);
TableField
fileds
;
addProperty
(
fileds
.
MonitorScard
,
CivTableTemp
::
FILED_VARCHAR64
);
// "SCADAID";
addProperty
(
fileds
.
MonitorXCoord
,
CivTableTemp
::
FILED_DOUBLE
);
// "横坐标";
addProperty
(
fileds
.
MonitorYCoord
,
CivTableTemp
::
FILED_DOUBLE
);
// "纵坐标 ";
addProperty
(
fileds
.
MonitorDesc
,
CivTableTemp
::
FILED_VARCHAR64
);
// "描述";
addProperty
(
fileds
.
MonitorLabel
,
CivTableTemp
::
FILED_VARCHAR64
);
// "标签";
addProperty
(
fileds
.
MonitorPipe
,
CivTableTemp
::
FILED_VARCHAR64
);
// "节点ID";
addProperty
(
fileds
.
MonitorMonitor
,
CivTableTemp
::
FILED_DOUBLE
);
// "检测值 ";
addProperty
(
fileds
.
MonitorCalc
,
CivTableTemp
::
FILED_DOUBLE
);
// "计算值 ";
addProperty
(
fileds
.
MonitorError
,
CivTableTemp
::
FILED_DOUBLE
);
// "误差";
addProperty
(
fileds
.
MonitorMonitorAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "检测平均值";
addProperty
(
fileds
.
MonitorCalcAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "计算平均值";
addProperty
(
fileds
.
MonitorErrorAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "平均误差 ";
addProperty
(
fileds
.
MonitorAbsErrirAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "平均绝对误差";
addProperty
(
fileds
.
MonitorSquareError
,
CivTableTemp
::
FILED_DOUBLE
);
// "均方根误差";
addProperty
(
fileds
.
MonitorErrorFlu
,
CivTableTemp
::
FILED_DOUBLE
);
// "误差波动";
addProperty
(
fileds
.
MonitorNashCoeff
,
CivTableTemp
::
FILED_DOUBLE
);
// "纳什系数";
addProperty
(
fileds
.
MonitorScore
,
CivTableTemp
::
FILED_DOUBLE
);
// "分数";
addProperty
(
fileds
.
MonitorReliability
,
CivTableTemp
::
FILED_VARCHAR64
);
// "可靠度";
}
/*
水质检测表
*/
CivMonitorQualityTableTemp
::
CivMonitorQualityTableTemp
()
:
CivTableTemp
()
{
setName
(
QUALITYTABLE
);
TableField
fileds
;
addProperty
(
fileds
.
MonitorScard
,
CivTableTemp
::
FILED_VARCHAR64
);
// "SCADAID";
addProperty
(
fileds
.
MonitorXCoord
,
CivTableTemp
::
FILED_DOUBLE
);
// "横坐标";
addProperty
(
fileds
.
MonitorYCoord
,
CivTableTemp
::
FILED_DOUBLE
);
// "纵坐标 ";
addProperty
(
fileds
.
MonitorDesc
,
CivTableTemp
::
FILED_CHARACTER_VARYING
);
// "描述";
addProperty
(
fileds
.
MonitorLabel
,
CivTableTemp
::
FILED_VARCHAR64
);
// "标签";
addProperty
(
fileds
.
MonitorNode
,
CivTableTemp
::
FILED_VARCHAR64
);
// "节点ID ";
addProperty
(
fileds
.
MonitorMonitor
,
CivTableTemp
::
FILED_DOUBLE
);
// "检测值 ";
addProperty
(
fileds
.
MonitorCalc
,
CivTableTemp
::
FILED_DOUBLE
);
// "计算值 ";
addProperty
(
fileds
.
MonitorError
,
CivTableTemp
::
FILED_DOUBLE
);
// "误差";
addProperty
(
fileds
.
MonitorMonitorAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "检测平均值";
addProperty
(
fileds
.
MonitorCalcAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "计算平均值";
addProperty
(
fileds
.
MonitorErrorAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "平均误差 ";
addProperty
(
fileds
.
MonitorAbsErrirAverage
,
CivTableTemp
::
FILED_DOUBLE
);
// "平均绝对误差";
addProperty
(
fileds
.
MonitorSquareError
,
CivTableTemp
::
FILED_DOUBLE
);
// "均方根误差";
addProperty
(
fileds
.
MonitorErrorFlu
,
CivTableTemp
::
FILED_DOUBLE
);
// "误差波动";
addProperty
(
fileds
.
MonitorNashCoeff
,
CivTableTemp
::
FILED_DOUBLE
);
// "纳什系数";
addProperty
(
fileds
.
MonitorScore
,
CivTableTemp
::
FILED_DOUBLE
);
// "分数";
addProperty
(
fileds
.
MonitorReliability
,
CivTableTemp
::
FILED_VARCHAR64
);
// "可靠度";
}
pandaDbManager/CivTableTemp.h
View file @
e70c7e93
...
...
@@ -7,593 +7,395 @@
#include "CivTypes.h"
struct
FieldProperty
{
std
::
string
mFiledName
;
//字段名
std
::
string
mFieldType
;
// 字段类型
};
#define FiledPropertys std::vector<FieldProperty>
class
CivDbConn
;
/**
* 数据库表模板
*/
class
CivTableTemp
{
public
:
// 字段类型
enum
FieldType
{
FILED_INT
,
FILED_INTEGER
,
FILED_DOUBLE
,
FILED_VARCHAR
,
FILED_VARCHAR64
,
FILED_VARCHAR128
,
FILED_VARCHAR256
,
FILED_BOOLEAN
,
FILED_CHARACTER_VARYING
,
FILED_DATETIME
,
FILED_JSON
,
FILED_DATE
,
FILED_GEOM_POINT
,
FILED_GEOM_LINE
};
explicit
CivTableTemp
();
~
CivTableTemp
();
// 返回创建表的sql语句
Str
createSql
();
/*
* @brief 表名
*/
Str
name
()
const
{
return
mTableName
;
}
void
setName
(
StrQuote
name
)
{
mTableName
=
name
;
}
/**
*@brief 添加字段属性
*@fileName:字段名
*@filedType:字段类型
*/
void
addProperty
(
std
::
string
fileName
,
FieldType
filedType
);
/**
*@brief 数据库创建模板表
*@dbConn: 数据库连接对象
*/
bool
updateToDb
(
CivDbConn
*
dbConn
);
protected
:
Str
mTableName
;
// 表名
FiledPropertys
mPropertys
;
// 字段和字段属性
std
::
map
<
FieldType
,
Str
>
mFieldTyepMap
;
};
/**
节点表模板
*/
class
CivJunctionTableTemp
:
public
CivTableTemp
typedef
struct
JunctionTableFileds
{
public
:
// 字段名
typedef
struct
TableFileds
{
Str
ID
=
"id"
;
Str
geom
=
"geom"
;
Str
thePoint
=
"本点号"
;
Str
xCoord
=
"横坐标"
;
Str
yCoord
=
"纵坐标"
;
Str
elev
=
"高程"
;
Str
demand
=
"需水量"
;
Str
pattern
=
"需水量模式"
;
Str
head
=
"总水头"
;
Str
freeHead
=
"自由水头"
;
Str
actualDemand
=
"实际需水量"
;
Str
code
=
"code"
;
Str
createUser
=
"create_user"
;
Str
modifyUser
=
"modify_user"
;
Str
createTime
=
"create_time"
;
Str
modifyTime
=
"modify_time"
;
Str
symbolAngle
=
"symbol_angle"
;
Str
compType
=
"组分类型"
;
Str
pressure
=
"压力"
;
Str
quality
=
"水质"
;
Str
initQuality
=
"初始水质"
;
}
JunctionTable
;
explicit
CivJunctionTableTemp
(
Str
tableName
);
};
Str
sn
=
"本点号"
;
Str
xCoord
=
"横坐标"
;
Str
yCoord
=
"纵坐标"
;
Str
desc
=
"描述"
;
Str
label
=
"标签"
;
Str
elev
=
"高程"
;
Str
baseDemand
=
"基本需水量"
;
Str
demandPattern
=
"需水量模式"
;
Str
demandType
=
"需水量类型"
;
Str
emiterCoffe
=
"扩散器系数"
;
Str
initQuality
=
"初始水质"
;
Str
sourceQuality
=
"源头水质"
;
Str
dmaId
=
"DMAID"
;
Str
demand
=
"实际需水量"
;
Str
waterConsump
=
"用水量"
;
Str
waterShortage
=
"用水缺额"
;
Str
waterShortageP
=
"用水缺额(%)"
;
Str
totalWater
=
"总水量"
;
Str
totalHead
=
"总水头"
;
Str
pressure
=
"压力"
;
Str
quality
=
"水质"
;
}
JunctionTable
;
/**
管线表模板
*/
class
CivPipeTableTemp
:
public
CivTableTemp
typedef
struct
PipeTableFields
{
public
:
// 字段名
typedef
struct
TableFileds
{
Str
ID
=
"id"
;
Str
geom
=
"geom"
;
Str
snNo
=
"编号"
;
Str
thePoint
=
"本点号"
;
Str
lastPoint
=
"上点号"
;
Str
length
=
"管长"
;
Str
material
=
"管材"
;
Str
diameter
=
"管径"
;
Str
friction
=
"摩阻系数"
;
Str
localLoss
=
"局部损失系"
;
Str
initStatus
=
"初始状态"
;
Str
buryingTime
=
"埋设时间"
;
Str
flow
=
"流量"
;
Str
velocity
=
"流速"
;
Str
unitHeadLoss
=
"单位水头损"
;
Str
headLoss
=
"水头总损失"
;
Str
unitPressLoss
=
"单位压力损"
;
Str
pressLoss
=
"压力总损失"
;
Str
lastHead
=
"上点水头"
;
Str
theHead
=
"本点水头"
;
Str
lastPress
=
"上点压力"
;
Str
thePress
=
"本点压力"
;
Str
localHeadLoss
=
"局部水头损"
;
Str
fracHeadLoss
=
"摩擦水头损"
;
Str
status
=
"状态"
;
Str
guid
=
"guid"
;
Str
code
=
"code"
;
Str
fromCode
=
"from_code"
;
Str
fromLayer
=
"from_layer"
;
Str
toCode
=
"to_code"
;
Str
toLayer
=
"to_layer"
;
Str
createUser
=
"create_user"
;
Str
modifyUser
=
"modify_user"
;
Str
createTime
=
"create_time"
;
Str
modifyTime
=
"modify_time"
;
Str
remarks
=
"备注"
;
Str
quality
=
"水质"
;
}
PipeTable
;
explicit
CivPipeTableTemp
();
};
Str
snNo
=
"编号"
;
Str
startPoint
=
"起始节点"
;
Str
endPoint
=
"终止节点"
;
Str
des
=
"描述"
;
Str
label
=
"标签"
;
Str
length
=
"管长"
;
Str
material
=
"管材"
;
Str
diameter
=
"管径"
;
Str
friction
=
"摩阻系数"
;
Str
localLoss
=
"局损系数"
;
Str
initStatus
=
"初始状态"
;
Str
mainCoffe
=
"主流系数"
;
Str
pipeCoffe
=
"管壁系数"
;
Str
leakCoffe1
=
"漏水系数1"
;
Str
leakCoffe2
=
"漏水系数2"
;
Str
dmaID
=
"DMAID"
;
Str
flow
=
"流量"
;
Str
velocity
=
"流速"
;
Str
unitHeadLoss
=
"单位水损"
;
Str
status
=
"状态"
;
Str
quality
=
"水质"
;
Str
leakWater
=
"漏水量"
;
}
PipeTable
;
/**
水泵
*/
class
CivPumpTableTemp
:
public
CivTableTemp
{
public
:
typedef
struct
TableFileds
{
Str
ID
=
"id"
;
Str
geom
=
"geom"
;
Str
thePoint
=
"本点号"
;
Str
xCoord
=
"横坐标"
;
Str
yCoord
=
"纵坐标"
;
Str
startPoint
=
"起始节点"
;
Str
endPoint
=
"终止节点"
;
Str
curve
=
"水泵曲线"
;
Str
ratio
=
"转速比"
;
Str
flow
=
"流量"
;
Str
headCurve
=
"扬程曲线"
;
Str
status
=
"状态"
;
Str
code
=
"code"
;
Str
createUser
=
"create_user"
;
Str
modifyUser
=
"modify_user"
;
Str
createTime
=
"create_time"
;
Str
modifyTime
=
"modify_time"
;
Str
SymbolAngle
=
"symbol_angle"
;
Str
compType
=
"组分类型"
;
Str
power
=
"功率"
;
}
PumpTable
;
explicit
CivPumpTableTemp
();
};
typedef
struct
PumpTableFileds
{
Str
startPoint
=
"起始节点"
;
Str
endPoint
=
"终止节点"
;
Str
sn
=
"本点号"
;
Str
desc
=
"描述"
;
Str
label
=
"标签"
;
Str
headCurve
=
"水泵曲线"
;
Str
power
=
"功率"
;
Str
ratio
=
"转速比"
;
Str
pattern
=
"模式"
;
Str
initStatus
=
"初始状态"
;
Str
efficCurve
=
"效率曲线"
;
Str
powerPrice
=
"能量价格"
;
Str
pricePattern
=
"价格模式"
;
Str
flow
=
"流量"
;
Str
headLoss
=
"水损"
;
Str
quality
=
"水质"
;
Str
status
=
"状态"
;
}
PumpTable
;
/**
水池
*/
class
CivTankTableTemp
:
public
CivTableTemp
typedef
struct
TankTableFileds
{
public
:
typedef
struct
TableFileds
{
Str
ID
=
"id"
;
Str
geom
=
"geom"
;
Str
thePoint
=
"本点号"
;
Str
xCoord
=
"横坐标"
;
Str
yCoord
=
"纵坐标"
;
Str
elev
=
"高程"
;
Str
diametor
=
"直径"
;
Str
baseLevel
=
"基础水位"
;
Str
initLevel
=
"初始水位"
;
Str
highLevel
=
"最高水位"
;
Str
lowLevel
=
"最低水位"
;
Str
flowIn
=
"输入流量"
;
Str
flowOut
=
"输出流量"
;
Str
leveHeight
=
"液位高度"
;
Str
capacity
=
"容量"
;
Str
volCurve
=
"容积曲线"
;
Str
percentage
=
"装满水池百"
;
Str
status
=
"状态"
;
Str
code
=
"code"
;
Str
createUser
=
"create_user"
;
Str
modifyUser
=
"modify_user"
;
Str
createTime
=
"create_time"
;
Str
modifyTime
=
"modify_time"
;
Str
SymbolAngle
=
"symbol_angle"
;
Str
compType
=
"组分类型"
;
}
TankTable
;
explicit
CivTankTableTemp
();
};
Str
sn
=
"本点号"
;
Str
xCoord
=
"横坐标"
;
Str
yCoord
=
"纵坐标"
;
Str
desc
=
"描述"
;
Str
label
=
"标签"
;
Str
elev
=
"高程"
;
Str
initLevel
=
"初始水位"
;
Str
minLevel
=
"最低水位"
;
Str
maxLevel
=
"最高水位"
;
Str
diametor
=
"直径"
;
Str
minVolume
=
"最小容积"
;
Str
volumeCurve
=
"容积曲线"
;
Str
mixedCore
=
"混合分数"
;
Str
mixedPattern
=
"混合模式"
;
Str
reaCoffe
=
"反应系数"
;
Str
initQuality
=
"初始水质"
;
Str
sourceQuality
=
"源头水质"
;
Str
flow
=
"流量"
;
Str
totalHead
=
"总水头"
;
Str
currLevel
=
"当前水位"
;
Str
quality
=
"水质"
;
}
TankTable
;
/**
水库
*/
class
CivResourcesTableTemp
:
public
CivTableTemp
typedef
struct
ResourcesTableFileds
{
public
:
typedef
struct
TableFileds
{
Str
ID
=
"id"
;
Str
geom
=
"geom"
;
Str
thePoint
=
"本点号"
;
Str
xCoord
=
"横坐标"
;
Str
yCoord
=
"纵坐标"
;
Str
headPattern
=
"水头模式曲"
;
Str
elev
=
"高程"
;
Str
head
=
"水头"
;
Str
flow
=
"流出流量"
;
Str
code
=
"code"
;
Str
createUser
=
"create_user"
;
Str
modifyUser
=
"modify_user"
;
Str
createTime
=
"create_time"
;
Str
modifyTime
=
"modify_time"
;
Str
SymbolAngle
=
"symbol_angle"
;
Str
compType
=
"组分类型"
;
}
ResourcesTable
;
explicit
CivResourcesTableTemp
();
};
Str
sn
=
"本点号"
;
Str
xCoord
=
"横坐标"
;
Str
yCoord
=
"纵坐标"
;
Str
headPattern
=
"水头模式"
;
Str
initQuality
=
"初始水质"
;
Str
sourceQuality
=
"源头水质"
;
Str
elev
=
"高程"
;
Str
label
=
"标签"
;
Str
desc
=
"描述"
;
Str
flow
=
"流量"
;
Str
totalHead
=
"总水头"
;
Str
quality
=
"水质"
;
}
ResourcesTable
;
/**
阀门
*/
class
CivValveTableTemp
:
public
CivTableTemp
typedef
struct
ValveTableFileds
{
public
:
typedef
struct
TableFileds
{
Str
id
=
"本点号"
;
Str
geom
=
"geom"
;
Str
xCoord
=
"横坐标"
;
Str
yCoord
=
"纵坐标"
;
Str
startPoint
=
"起始节点"
;
Str
endPoint
=
"终止节点"
;
Str
diameter
=
"直径"
;
Str
status
=
"状态"
;
Str
type
=
"阀门类型"
;
Str
setting
=
"阀门设置"
;
Str
loss
=
"损失系数"
;
Str
flow
=
"流量 "
;
Str
veclocity
=
"流速"
;
Str
headLoss
=
"水头损失"
;
Str
code
=
"code"
;
Str
createUser
=
"create_user"
;
Str
modityUser
=
"modify_user"
;
Str
createTime
=
"create_time"
;
Str
modifyTime
=
"modify_time"
;
Str
symbolAngle
=
"symbol_angle"
;
Str
compType
=
"组分类型"
;
}
ValveTable
;
explicit
CivValveTableTemp
();
};
Str
sn
=
"本点号"
;
Str
startPoint
=
"起始节点"
;
Str
endPoint
=
"终止节点"
;
Str
length
=
"直径"
;
Str
type
=
"类型"
;
Str
setting
=
"设置"
;
Str
lossCoeff
=
"水损系数"
;
Str
fixedState
=
"固定状态"
;
Str
flow
=
"流量"
;
Str
velocity
=
"流速"
;
Str
headLoss
=
"水头损失"
;
Str
quality
=
"水质"
;
Str
state
=
"状态"
;
}
ValveTable
;
/**
节点模拟结果存储表
*/
class
CivNodeResultTableTemp
:
public
CivTableTemp
typedef
struct
NodeResultTableField
{
public
:
typedef
struct
TableField
{
Str
Number
=
"本点号"
;
Str
dHead
=
"水头"
;
Str
dPressure
=
"压力"
;
Str
dElevation
=
"标高"
;
Str
dDemand
=
"实际需水量"
;
Str
dTankVolume
=
"水池容量"
;
Str
dTankMaxVolume
=
"水池最大容量"
;
Str
dTankLevel
=
"液位高度"
;
Str
dQuality
=
"水质"
;
Str
dDate
=
"日期"
;
Str
dInterval
=
"时段"
;
Str
dModifyTime
=
"修改时间"
;
}
NodeResultTable
;
explicit
CivNodeResultTableTemp
();
};
Str
Number
=
"本点号"
;
Str
dHead
=
"水头"
;
Str
dPressure
=
"压力"
;
Str
dElevation
=
"标高"
;
Str
dDemand
=
"实际需水量"
;
Str
dTankVolume
=
"水池容量"
;
Str
dTankMaxVolume
=
"水池最大容量"
;
Str
dTankLevel
=
"液位高度"
;
Str
dQuality
=
"水质"
;
Str
dDate
=
"日期"
;
Str
dInterval
=
"时段"
;
Str
dModifyTime
=
"修改时间"
;
}
NodeResultTable
;
/**
模拟结果线表
*/
class
CivPipeResultTableTemp
:
public
CivTableTemp
typedef
struct
PipeResultTableField
{
public
:
typedef
struct
TableField
{
Str
szNo
=
"编号"
;
Str
dFlow
=
"流量"
;
Str
nFlowDirect
=
"流向"
;
Str
dVelocity
=
"流速"
;
Str
dHeadloss
=
"水头损失"
;
Str
dUnitHeadloss
=
"单位水头损"
;
Str
dFromNodHeadloss
=
"上点水头"
;
Str
dToNodHeadloss
=
"本点水头"
;
Str
dLocalHeadloss
=
"局部水头损"
;
Str
dFrictionHeadloss
=
"摩擦水头损"
;
Str
szStatus
=
"状态"
;
Str
dQuality
=
"水质"
;
Str
dDate
=
"日期"
;
Str
dInterval
=
"时段"
;
Str
dModifyTime
=
"修改时间"
;
}
PipeResultTable
;
explicit
CivPipeResultTableTemp
();
};
Str
szNo
=
"编号"
;
Str
dFlow
=
"流量"
;
Str
nFlowDirect
=
"流向"
;
Str
dVelocity
=
"流速"
;
Str
dHeadloss
=
"水头损失"
;
Str
dUnitHeadloss
=
"单位水头损"
;
Str
dFromNodHeadloss
=
"上点水头"
;
Str
dToNodHeadloss
=
"本点水头"
;
Str
dLocalHeadloss
=
"局部水头损"
;
Str
dFrictionHeadloss
=
"摩擦水头损"
;
Str
szStatus
=
"状态"
;
Str
dQuality
=
"水质"
;
Str
dDate
=
"日期"
;
Str
dInterval
=
"时段"
;
Str
dModifyTime
=
"修改时间"
;
}
PipeResultTable
;
/**
模式表
*/
class
CivPatternTableTemp
:
public
CivTableTemp
typedef
struct
PatternTableField
{
public
:
typedef
struct
TableField
{
Str
modelName
=
"model_name"
;
Str
modelType
=
"model_type"
;
Str
modelData
=
"model_data"
;
}
PatternTable
;
enum
PatternType
{
PATTERN_DEMAND
,
// 需水量模式
PATTERN_PRESS
// 压力模式
};
explicit
CivPatternTableTemp
();
};
Str
modelName
=
"模式名"
;
Str
modelType
=
"类型"
;
Str
modelData
=
"模式值"
;
}
PatternTable
;
/**
参数表
*/
class
CivParametorTableTemp
:
public
CivTableTemp
typedef
struct
ParametorTableField
{
public
:
typedef
struct
TableField
{
Str
name
=
"参数名"
;
Str
val
=
"参数值"
;
Str
type
=
"参数类型"
;
Str
netName
=
"管网名"
;
}
ParametorTable
;
explicit
CivParametorTableTemp
();
};
Str
name
=
"参数名"
;
Str
val
=
"参数值"
;
Str
type
=
"类型"
;
}
ParametorTable
;
/**
曲线表
*/
class
CivCurveTableTemp
:
public
CivTableTemp
typedef
struct
CurveTableField
{
public
:
typedef
struct
TableField
{
Str
CurveName
=
"curve_name"
;
Str
CurveType
=
"curve_type"
;
Str
CurveData
=
"curve_data"
;
}
CurveTable
;
// 曲线类型
enum
CurveType
{
CURVE_ELEV
,
// 水泵扬程与流量
CURVE_EFFIC
,
//水泵效率与流量
CURVE_VOLUME
,
// 水池容积与水深
CURVE_HEADLOSS
//常规阀门的水头损失与流量
};
explicit
CivCurveTableTemp
();
};
Str
CurveName
=
"曲线名"
;
Str
CurveType
=
"类型"
;
Str
CurveData
=
"曲线值"
;
}
CurveTable
;
/**
方案点表
*/
class
CivProjNodeTableTemp
:
public
CivTableTemp
typedef
struct
ProjNodeTableField
{
public
:
typedef
struct
TableField
{
Str
ProjCode
=
"方案编号"
;
Str
ProjType
=
"修改类型"
;
Str
ProjGeom
=
"geom"
;
Str
ProjSn
=
"本点号"
;
Str
ProjXcoord
=
"横坐标"
;
Str
ProjYcoord
=
"纵坐标 "
;
Str
ProjDesc
=
"描述"
;
Str
ProjLabel
=
"标签"
;
Str
ProElev
=
"高程"
;
Str
ProjBaseDemand
=
"基本需水量"
;
Str
ProjPattern
=
"需水量模式"
;
Str
ProjDemandType
=
"需水量类型"
;
Str
ProjDiffuserCoeff
=
"扩散器系数"
;
Str
ProjInitQuality
=
"初始水质 "
;
Str
ProjSourceQuality
=
"源头水质 "
;
Str
ProjDmaID
=
"DMAID"
;
Str
ProjDemand
=
"实际需水量"
;
Str
ProjConsumption
=
"用水量"
;
Str
ProjLackWater
=
"用水缺额"
;
Str
ProjLackWaterPer
=
"用水缺额(%)"
;
Str
ProjTotalWater
=
"总水量"
;
Str
ProjTotalHead
=
"总水头"
;
Str
ProjPressure
=
"压力"
;
Str
ProjQuality
=
"水质"
;
}
ProjNodeTable
;
explicit
CivProjNodeTableTemp
();
};
Str
ProjCode
=
"方案编号"
;
Str
ProjType
=
"修改类型"
;
Str
ProjSn
=
"本点号"
;
Str
ProjXcoord
=
"横坐标"
;
Str
ProjYcoord
=
"纵坐标 "
;
Str
ProjDesc
=
"描述"
;
Str
ProjLabel
=
"标签"
;
Str
ProElev
=
"高程"
;
Str
ProjBaseDemand
=
"基本需水量"
;
Str
ProjPattern
=
"需水量模式"
;
Str
ProjDemandType
=
"需水量类型"
;
Str
ProjDiffuserCoeff
=
"扩散器系数"
;
Str
ProjInitQuality
=
"初始水质 "
;
Str
ProjSourceQuality
=
"源头水质 "
;
Str
ProjDmaID
=
"DMAID"
;
Str
ProjDemand
=
"实际需水量"
;
Str
ProjConsumption
=
"用水量"
;
Str
ProjLackWater
=
"用水缺额"
;
Str
ProjLackWaterPer
=
"用水缺额(%)"
;
Str
ProjTotalWater
=
"总水量"
;
Str
ProjTotalHead
=
"总水头"
;
Str
ProjPressure
=
"压力"
;
Str
ProjQuality
=
"水质"
;
}
ProjNodeTable
;
/**
方案线表
*/
class
CivProjPipeTableTemp
:
public
CivTableTemp
typedef
struct
ProjPipeTableField
{
public
:
typedef
struct
TableField
{
Str
ProjCode
=
"方案名"
;
Str
ProjType
=
"修改类型"
;
Str
ProjGeom
=
"Geom"
;
Str
ProjSn
=
"编号"
;
Str
ProjStartID
=
"起始节点"
;
Str
ProjEndID
=
"终止节点"
;
Str
ProjDesc
=
"描述"
;
Str
ProjLabel
=
"标签"
;
Str
ProjLength
=
"管长"
;
Str
ProjDiameter
=
"管径"
;
Str
ProjMaterial
=
"管材"
;
Str
ProjFractionCoeff
=
"摩阻系数"
;
Str
ProjLoclLossCoeff
=
"局损系数"
;
Str
ProjInitStatus
=
"初始状态"
;
Str
ProjMainstreamCoeff
=
"主流系数"
;
Str
ProjWallCoeff
=
"管壁系数"
;
Str
ProjLeakageCoeff1
=
"漏水系数1"
;
Str
ProLeakageCoeff2
=
"漏水系数2"
;
Str
ProjDmaID
=
"DMAID"
;
Str
ProjFlow
=
"流量"
;
Str
ProjVelocity
=
"流速"
;
Str
ProjUnitLoss
=
"单位水损"
;
Str
ProjStatus
=
"状态"
;
Str
ProjQuality
=
"水质"
;
Str
ProjWaterLeakage
=
"漏水量"
;
}
ProjPipeTable
;
explicit
CivProjPipeTableTemp
();
};
Str
ProjCode
=
"方案名"
;
Str
ProjType
=
"修改类型"
;
Str
ProjSn
=
"编号"
;
Str
ProjStartID
=
"起始节点"
;
Str
ProjEndID
=
"终止节点"
;
Str
ProjDesc
=
"描述"
;
Str
ProjLabel
=
"标签"
;
Str
ProjLength
=
"管长"
;
Str
ProjDiameter
=
"管径"
;
Str
ProjMaterial
=
"管材"
;
Str
ProjFractionCoeff
=
"摩阻系数"
;
Str
ProjLoclLossCoeff
=
"局损系数"
;
Str
ProjInitStatus
=
"初始状态"
;
Str
ProjMainstreamCoeff
=
"主流系数"
;
Str
ProjWallCoeff
=
"管壁系数"
;
Str
ProjLeakageCoeff1
=
"漏水系数1"
;
Str
ProLeakageCoeff2
=
"漏水系数2"
;
Str
ProjDmaID
=
"DMAID"
;
Str
ProjFlow
=
"流量"
;
Str
ProjVelocity
=
"流速"
;
Str
ProjUnitLoss
=
"单位水损"
;
Str
ProjStatus
=
"状态"
;
Str
ProjQuality
=
"水质"
;
Str
ProjWaterLeakage
=
"漏水量"
;
}
ProjPipeTable
;
/**
方案表
*/
class
CivProjTableTemp
:
public
CivTableTemp
typedef
struct
ProjTableField
{
public
:
typedef
struct
TableField
{
Str
ProjName
=
"方案名"
;
Str
ProjCode
=
"方案编号"
;
Str
ProjType
=
"方案类型"
;
Str
ProjCreator
=
"创建人"
;
Str
ProjAddTime
=
"创建时间"
;
Str
ProjUpdateTime
=
"更新时间"
;
Str
ProjTime
=
"方案时间"
;
Str
ProjScore
=
"评分"
;
Str
ProDescribe
=
"评价"
;
Str
ProjEvaluate
=
"评估"
;
Str
ProjDemand
=
"水量调整"
;
Str
ProjWorkCode
=
"作业编号"
;
Str
ProjDetection
=
"关注检测点"
;
}
ProjTable
;
explicit
CivProjTableTemp
();
};
Str
ProjName
=
"方案名"
;
Str
ProjCode
=
"方案编号"
;
Str
ProjType
=
"方案类型"
;
Str
ProjCreator
=
"创建人"
;
Str
ProjAddTime
=
"创建时间"
;
Str
ProjUpdateTime
=
"更新时间"
;
Str
ProjTime
=
"方案时间"
;
Str
ProjScore
=
"评分"
;
Str
ProDescribe
=
"评价"
;
Str
ProjEvaluate
=
"评估"
;
Str
ProjDemand
=
"水量调整"
;
Str
ProjWorkCode
=
"作业编号"
;
Str
ProjDetection
=
"关注检测点"
;
}
ProjTable
;
/**
检测压力表
*/
class
CivMonitorPressureTableTemp
:
public
CivTableTemp
typedef
struct
MonitorPressureTableField
{
public
:
typedef
struct
TableField
{
Str
MonitorScard
=
"SCADAID"
;
Str
MonitorXCoord
=
"横坐标"
;
Str
MonitorYCoord
=
"纵坐标 "
;
Str
MonitorDesc
=
"描述"
;
Str
MonitorLabel
=
"标签"
;
Str
MonitorNode
=
"节点ID "
;
Str
MonitorMonitor
=
"检测值 "
;
Str
MonitorCalc
=
"计算值 "
;
Str
MonitorError
=
"误差"
;
Str
MonitorMonitorAverage
=
"检测平均值"
;
Str
MonitorCalcAverage
=
"计算平均值"
;
Str
MonitorErrorAverage
=
"平均误差 "
;
Str
MonitorAbsErrirAverage
=
"平均绝对误差"
;
Str
MonitorSquareError
=
"均方根误差"
;
Str
MonitorErrorFlu
=
"误差波动"
;
Str
MonitorNashCoeff
=
"纳什系数"
;
Str
MonitorScore
=
"分数"
;
Str
MonitorReliability
=
"可靠度"
;
}
MonitorPressureTable
;
explicit
CivMonitorPressureTableTemp
();
};
Str
MonitorScard
=
"SCADAID"
;
Str
MonitorXCoord
=
"横坐标"
;
Str
MonitorYCoord
=
"纵坐标 "
;
Str
MonitorDesc
=
"描述"
;
Str
MonitorLabel
=
"标签"
;
Str
MonitorNode
=
"节点ID "
;
Str
MonitorMonitor
=
"检测值 "
;
Str
MonitorCalc
=
"计算值 "
;
Str
MonitorError
=
"误差"
;
Str
MonitorMonitorAverage
=
"检测平均值"
;
Str
MonitorCalcAverage
=
"计算平均值"
;
Str
MonitorErrorAverage
=
"平均误差 "
;
Str
MonitorAbsErrirAverage
=
"平均绝对误差"
;
Str
MonitorSquareError
=
"均方根误差"
;
Str
MonitorErrorFlu
=
"误差波动"
;
Str
MonitorNashCoeff
=
"纳什系数"
;
Str
MonitorScore
=
"分数"
;
Str
MonitorReliability
=
"可靠度"
;
}
MonitorPressureTable
;
/**
检测流量表
*/
class
CivMonitorFlowTableTemp
:
public
CivTableTemp
typedef
struct
MonitorFlowTableField
{
public
:
typedef
struct
TableField
{
Str
MonitorScard
=
"SCADAID"
;
Str
MonitorXCoord
=
"横坐标"
;
Str
MonitorYCoord
=
"纵坐标 "
;
Str
MonitorDesc
=
"描述"
;
Str
MonitorLabel
=
"标签"
;
Str
MonitorPipe
=
"管段ID "
;
Str
MonitorMonitor
=
"检测值 "
;
Str
MonitorCalc
=
"计算值 "
;
Str
MonitorError
=
"误差"
;
Str
MonitorMonitorAverage
=
"检测平均值"
;
Str
MonitorCalcAverage
=
"计算平均值"
;
Str
MonitorErrorAverage
=
"平均误差 "
;
Str
MonitorAbsErrirAverage
=
"平均绝对误差"
;
Str
MonitorSquareError
=
"均方根误差"
;
Str
MonitorErrorFlu
=
"误差波动"
;
Str
MonitorNashCoeff
=
"纳什系数"
;
Str
MonitorScore
=
"分数"
;
Str
MonitorReliability
=
"可靠度"
;
}
MonitorFlowTable
;
explicit
CivMonitorFlowTableTemp
();
};
/**
检测水质表
*/
class
CivMonitorQualityTableTemp
:
public
CivTableTemp
Str
MonitorScard
=
"SCADAID"
;
Str
MonitorXCoord
=
"横坐标"
;
Str
MonitorYCoord
=
"纵坐标 "
;
Str
MonitorDesc
=
"描述"
;
Str
MonitorLabel
=
"标签"
;
Str
MonitorPipe
=
"管段ID "
;
Str
MonitorMonitor
=
"检测值 "
;
Str
MonitorCalc
=
"计算值 "
;
Str
MonitorError
=
"误差"
;
Str
MonitorMonitorAverage
=
"检测平均值"
;
Str
MonitorCalcAverage
=
"计算平均值"
;
Str
MonitorErrorAverage
=
"平均误差 "
;
Str
MonitorAbsErrirAverage
=
"平均绝对误差"
;
Str
MonitorSquareError
=
"均方根误差"
;
Str
MonitorErrorFlu
=
"误差波动"
;
Str
MonitorNashCoeff
=
"纳什系数"
;
Str
MonitorScore
=
"分数"
;
Str
MonitorReliability
=
"可靠度"
;
}
MonitorFlowTable
;
typedef
struct
MonitorQualityTableField
{
public
:
typedef
struct
TableField
{
Str
MonitorScard
=
"SCADAID"
;
Str
MonitorXCoord
=
"横坐标"
;
Str
MonitorYCoord
=
"纵坐标 "
;
Str
MonitorDesc
=
"描述"
;
Str
MonitorLabel
=
"标签"
;
Str
MonitorNode
=
"节点ID "
;
Str
MonitorMonitor
=
"检测值 "
;
Str
MonitorCalc
=
"计算值 "
;
Str
MonitorError
=
"误差"
;
Str
MonitorMonitorAverage
=
"检测平均值"
;
Str
MonitorCalcAverage
=
"计算平均值"
;
Str
MonitorErrorAverage
=
"平均误差 "
;
Str
MonitorAbsErrirAverage
=
"平均绝对误差"
;
Str
MonitorSquareError
=
"均方根误差"
;
Str
MonitorErrorFlu
=
"误差波动"
;
Str
MonitorNashCoeff
=
"纳什系数"
;
Str
MonitorScore
=
"分数"
;
Str
MonitorReliability
=
"可靠度"
;
}
MonitorQualityTable
;
explicit
CivMonitorQualityTableTemp
();
};
Str
MonitorScard
=
"SCADAID"
;
Str
MonitorXCoord
=
"横坐标"
;
Str
MonitorYCoord
=
"纵坐标 "
;
Str
MonitorDesc
=
"描述"
;
Str
MonitorLabel
=
"标签"
;
Str
MonitorNode
=
"节点ID "
;
Str
MonitorMonitor
=
"检测值 "
;
Str
MonitorCalc
=
"计算值 "
;
Str
MonitorError
=
"误差"
;
Str
MonitorMonitorAverage
=
"检测平均值"
;
Str
MonitorCalcAverage
=
"计算平均值"
;
Str
MonitorErrorAverage
=
"平均误差 "
;
Str
MonitorAbsErrirAverage
=
"平均绝对误差"
;
Str
MonitorSquareError
=
"均方根误差"
;
Str
MonitorErrorFlu
=
"误差波动"
;
Str
MonitorNashCoeff
=
"纳什系数"
;
Str
MonitorScore
=
"分数"
;
Str
MonitorReliability
=
"可靠度"
;
}
MonitorQualityTable
;
#endif // !CIVTABLETEMP_H
...
...
pandaDbManager/CivTrackingResultCache.cpp
View file @
e70c7e93
#include "CivTrackingResultCache.h"
#include "Civ
PgCon
n.h"
#include "Civ
Connectio
n.h"
void
CivTrackingResultCache
::
cacheInfoFromDb
(
Civ
DbCon
n
*
dbConn
)
void
CivTrackingResultCache
::
cacheInfoFromDb
(
Civ
Connectio
n
*
dbConn
)
{
if
(
dbConn
==
nullptr
)
return
;
...
...
@@ -54,7 +54,7 @@ void CivTrackingResultCache::transformToJsonStr(std::string jsonStr)
jsonStr
.
append
(
"}"
);
}
void
CivTrackingResultCache
::
cacheJunctionInfoFromDb
(
Civ
DbCon
n
*
dbConn
)
void
CivTrackingResultCache
::
cacheJunctionInfoFromDb
(
Civ
Connectio
n
*
dbConn
)
{
if
(
dbConn
==
nullptr
)
return
;
...
...
@@ -66,10 +66,10 @@ void CivTrackingResultCache::cacheJunctionInfoFromDb(CivDbConn* dbConn)
fileds
.
push_back
(
"ST_X(geom) as xCoord"
);
fileds
.
push_back
(
"ST_Y(geom) as yCoord"
);
if
(
!
dbConn
->
getFieldValueFromTable
(
PIPENODE
,
fileds
,
nodeResult
))
/*
if (!dbConn->getFieldValueFromTable(PIPENODE, fileds, nodeResult))
{
return;
}
}
*/
// 缓存节点数据
int
rows
=
nodeResult
.
size
();
...
...
@@ -90,7 +90,7 @@ void CivTrackingResultCache::cacheJunctionInfoFromDb(CivDbConn* dbConn)
}
void
CivTrackingResultCache
::
cachePipeInfoFromDb
(
Civ
DbCon
n
*
dbConn
)
void
CivTrackingResultCache
::
cachePipeInfoFromDb
(
Civ
Connectio
n
*
dbConn
)
{
if
(
dbConn
==
nullptr
)
return
;
...
...
@@ -104,10 +104,10 @@ void CivTrackingResultCache::cachePipeInfoFromDb(CivDbConn* dbConn)
fileds
.
push_back
(
"ST_X(ST_EndPoint(ST_GeometryN(geom, 1))) as endX"
);
fileds
.
push_back
(
"ST_Y(ST_EndPoint(ST_GeometryN(geom, 1))) as endY"
);
if
(
!
dbConn
->
getFieldValueFromTable
(
PIPELINE
,
fileds
,
pipeResult
))
/*
if (!dbConn->getFieldValueFromTable(PIPELINE,fileds, pipeResult))
{
return;
}
}
*/
// 缓存节点数据
int
rows
=
pipeResult
.
size
();
...
...
pandaDbManager/CivTrackingResultCache.h
View file @
e70c7e93
...
...
@@ -3,7 +3,7 @@
#include <string>
#include <vector>
class
Civ
DbCon
n
;
class
Civ
Connectio
n
;
#define CACHEEXPORT __declspec(dllexport)
// 节点
...
...
@@ -34,7 +34,7 @@ public:
*@brief 缓存数据库的信息
*@param dbConn 数据库连接
*/
void
cacheInfoFromDb
(
Civ
DbCon
n
*
dbConn
);
void
cacheInfoFromDb
(
Civ
Connectio
n
*
dbConn
);
/**
*@brief 缓存信息转json字符串
...
...
@@ -61,13 +61,13 @@ private:
*@brief 缓存数据库的节点数据
*@param dbConn 数据库连接
*/
void
cacheJunctionInfoFromDb
(
Civ
DbCon
n
*
dbConn
);
void
cacheJunctionInfoFromDb
(
Civ
Connectio
n
*
dbConn
);
/**
*@brief 缓存数据管段信息
*@param dbConn
*/
void
cachePipeInfoFromDb
(
Civ
DbCon
n
*
dbConn
);
void
cachePipeInfoFromDb
(
Civ
Connectio
n
*
dbConn
);
private
:
std
::
map
<
std
::
string
,
Junctions
>
mNodeCache
;
// 节点信息缓存
...
...
pandaDbManager/pandaDbManager.vcxproj
View file @
e70c7e93
...
...
@@ -150,9 +150,7 @@
</Link>
<PostBuildEvent>
<Command>
copy CivTypes.h $(OutDir)..\include /y
copy CivPgConn.h $(OutDir)..\include /y
copy CivAssembly.h $(OutDir)..\include /y
copy CivDbConn.h $(OutDir)..\include /y
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
...
...
@@ -160,12 +158,8 @@ copy CivDbConn.h $(OutDir)..\include /y
<ClInclude
Include=
"CivAssembly.h"
/>
<ClInclude
Include=
"CivCommonUtils.h"
/>
<ClInclude
Include=
"CivConnection.h"
/>
<ClInclude
Include=
"CivDbConn.h"
/>
<ClInclude
Include=
"CivDbUtils.h"
/>
<ClInclude
Include=
"CivInpDbHelper.h"
/>
<ClInclude
Include=
"CivInpHelperAbs.h"
/>
<ClInclude
Include=
"CivMaintainModel.h"
/>
<ClInclude
Include=
"CivPgConn.h"
/>
<ClInclude
Include=
"CivPgDbConnection.h"
/>
<ClInclude
Include=
"CivProjInpDbHelper.h"
/>
<ClInclude
Include=
"CivSimuResDbHelper.h"
/>
...
...
@@ -177,16 +171,11 @@ copy CivDbConn.h $(OutDir)..\include /y
<ClCompile
Include=
"CivAssembly.cpp"
/>
<ClCompile
Include=
"CivCommonUtils.cpp"
/>
<ClCompile
Include=
"CivConnection.cpp"
/>
<ClCompile
Include=
"CivDbConn.cpp"
/>
<ClCompile
Include=
"CivDbUtils.cpp"
/>
<ClCompile
Include=
"CivInpDbHelper.cpp"
/>
<ClCompile
Include=
"CivInpHelperAbs.cpp"
/>
<ClCompile
Include=
"CivMaintainModel.cpp"
/>
<ClCompile
Include=
"CivPgConn.cpp"
/>
<ClCompile
Include=
"CivPgDbConnection.cpp"
/>
<ClCompile
Include=
"CivProjInpDbHelper.cpp"
/>
<ClCompile
Include=
"CivSimuResDbHelper.cpp"
/>
<ClCompile
Include=
"CivTableTemp.cpp"
/>
<ClCompile
Include=
"CivTrackingResultCache.cpp"
/>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
...
...
pandaDbManager/pandaDbManager.vcxproj.filters
View file @
e70c7e93
...
...
@@ -24,12 +24,6 @@
<ClInclude
Include=
"CivCommonUtils.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivDbConn.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivPgConn.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivAssembly.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
...
...
@@ -39,9 +33,6 @@
<ClInclude
Include=
"CivConnection.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivMaintainModel.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivPgDbConnection.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
...
...
@@ -57,23 +48,11 @@
<ClInclude
Include=
"CivSimuResDbHelper.h"
>
<Filter>
源文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivDbUtils.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"CivTableTemp.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivCommonUtils.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivDbConn.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivPgConn.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivAssembly.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
...
...
@@ -83,9 +62,6 @@
<ClCompile
Include=
"CivConnection.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivMaintainModel.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivPgDbConnection.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
...
...
@@ -101,8 +77,5 @@
<ClCompile
Include=
"CivSimuResDbHelper.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivDbUtils.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
pandaLog/CivCsvReader.cpp
0 → 100644
View file @
e70c7e93
#include "CivCsvReader.h"
CivCsvReader
::
CivCsvReader
(
const
char
*
path
)
{
_csvInput
.
open
(
path
);
}
void
CivCsvReader
::
readOnLoad
()
{
string
line
;
// ȡͷ
int
index
=
0
;
while
(
getline
(
_csvInput
,
line
))
{
istringstream
sin
(
line
);
vector
<
string
>
fields
;
string
field
;
while
(
getline
(
sin
,
field
,
','
))
{
if
(
index
==
0
)
mHeaders
.
push_back
(
field
);
else
fields
.
push_back
(
field
);
}
if
(
index
>
0
)
mVecVec
.
push_back
(
fields
);
index
++
;
}
}
vector
<
string
>
CivCsvReader
::
getHeaders
()
{
return
mHeaders
;
}
void
CivCsvReader
::
readByColumn
(
int
column
,
vector
<
string
>&
vec
)
{
for
(
int
i
=
0
;
i
<
mVecVec
.
size
();
i
++
)
{
vector
<
string
>
temp
=
mVecVec
[
i
];
if
(
column
>
temp
.
size
())
return
;
vec
.
push_back
(
temp
[
column
]);
}
}
void
CivCsvReader
::
readByRow
(
int
row
,
vector
<
string
>&
vec
)
{
if
(
mVecVec
.
size
()
<
row
)
return
;
vec
=
mVecVec
[
row
];
}
int
CivCsvReader
::
getRows
()
{
return
mVecVec
.
size
();
}
int
CivCsvReader
::
getColumns
()
{
if
(
mVecVec
.
size
()
<=
0
)
return
0
;
return
mVecVec
[
0
].
size
();
}
pandaLog/CivCsvReader.h
0 → 100644
View file @
e70c7e93
#pragma once
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#define CSVEXPORT __declspec(dllexport)
using
namespace
std
;
class
CSVEXPORT
CivCsvReader
{
public
:
explicit
CivCsvReader
(
const
char
*
);
void
readOnLoad
();
void
readByColumn
(
int
column
,
vector
<
string
>&
vec
);
void
readByRow
(
int
row
,
vector
<
string
>&
vec
);
// ȡ
int
getRows
();
// ȡ
int
getColumns
();
vector
<
string
>
getHeaders
();
private
:
ifstream
_csvInput
;
vector
<
vector
<
string
>>
mVecVec
;
vector
<
string
>
mHeaders
;
};
pandaLog/pandaLog.vcxproj
View file @
e70c7e93
...
...
@@ -141,13 +141,16 @@
<ImportLibrary>
$(OutDir)..\lib\$(TargetName).lib
</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>
copy CivSysLog.h $(OutDir)..\include /y
</Command>
<Command>
copy CivSysLog.h $(OutDir)..\include /y
copy CivCsvReader.h $(OutDir)..\include /y
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude
Include=
"CivCsvReader.h"
/>
<ClInclude
Include=
"CivSysLog.h"
/>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"CivCsvReader.cpp"
/>
<ClCompile
Include=
"CivSysLog.cpp"
/>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
...
...
pandaLog/pandaLog.vcxproj.filters
View file @
e70c7e93
...
...
@@ -18,10 +18,16 @@
<ClInclude
Include=
"CivSysLog.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivCsvReader.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"CivSysLog.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivCsvReader.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
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