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
93fd6516
Commit
93fd6516
authored
Aug 18, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 dd
parent
d635cb68
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
118 additions
and
22 deletions
+118
-22
EPNAET2.vcxproj
EPNAET2/EPNAET2.vcxproj
+1
-1
main.cpp
funcDemo/main.cpp
+1
-1
CivHydrCompute.cpp
pandaAnalysis/CivHydrCompute.cpp
+5
-0
CivHydrCompute.h
pandaAnalysis/CivHydrCompute.h
+1
-0
CivHydrSimulation.cpp
pandaAnalysis/CivHydrSimulation.cpp
+5
-3
CivInpConvertor.cpp
pandaAnalysis/CivInpConvertor.cpp
+2
-2
CivSimulResultCache.cpp
pandaAnalysis/CivSimulResultCache.cpp
+14
-2
CivSimulResultCache.h
pandaAnalysis/CivSimulResultCache.h
+6
-2
CivConnection.cpp
pandaDbManager/CivConnection.cpp
+9
-3
CivInpDbHelper.cpp
pandaDbManager/CivInpDbHelper.cpp
+1
-1
CivProjInpDbHelper.cpp
pandaDbManager/CivProjInpDbHelper.cpp
+1
-1
CivSimuResStruct.h
pandaDbManager/CivSimuResStruct.h
+1
-0
CivSimulResDbHelper.cpp
pandaDbManager/CivSimulResDbHelper.cpp
+55
-5
CivSimulResDbHelper.h
pandaDbManager/CivSimulResDbHelper.h
+2
-1
CivSimulResHelperAbs.cpp
pandaDbManager/CivSimulResHelperAbs.cpp
+12
-0
CivSimulResHelperAbs.h
pandaDbManager/CivSimulResHelperAbs.h
+2
-0
No files found.
EPNAET2/EPNAET2.vcxproj
View file @
93fd6516
...
...
@@ -142,7 +142,7 @@ copy epanet2.h $(OutDir)..\include /y</Command>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
_CRT_SECURE_NO_WARNINGS
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
<Optimization>
MaxSpe
ed
</Optimization>
<Optimization>
Disabl
ed
</Optimization>
<WholeProgramOptimization>
true
</WholeProgramOptimization>
</ClCompile>
<Link>
...
...
funcDemo/main.cpp
View file @
93fd6516
...
...
@@ -18,7 +18,7 @@ int main(int argc, char* argv[])
char
*
findUri
=
const_cast
<
char
*>
(
uri
);
// 测试水力
/*
CivTestContext context(new CivConHydrTest());
/*
CivTestContext context(new CivConHydrTest());
context.contextTest(findUri);*/
// 测试水质
...
...
pandaAnalysis/CivHydrCompute.cpp
View file @
93fd6516
...
...
@@ -338,6 +338,11 @@ void CivHydrCompute::saveResult(const std::string& uri)
mResultCache
.
save
(
uri
);
}
void
CivHydrCompute
::
cacheCodeSn
(
const
std
::
string
&
uri
)
{
mResultCache
.
getCodeToSnMap
(
uri
);
}
void
CivHydrCompute
::
getTrackingResult
(
const
std
::
string
&
uri
,
std
::
string
&
jsonResult
)
{
PipeCoords
pipeCoords
;
...
...
pandaAnalysis/CivHydrCompute.h
View file @
93fd6516
...
...
@@ -25,6 +25,7 @@ public:
*@param uri 数据库连接地址
*/
void
saveResult
(
const
std
::
string
&
uri
);
void
cacheCodeSn
(
const
std
::
string
&
uri
);
void
getTrackingResult
(
const
std
::
string
&
uri
,
std
::
string
&
jsonResult
);
...
...
pandaAnalysis/CivHydrSimulation.cpp
View file @
93fd6516
...
...
@@ -18,10 +18,12 @@ bool CivHydrSimulation::hdyrSimulation()
if
(
inpFileS
.
empty
())
return
false
;
mHydrCompute
.
cacheCodeSn
(
mUri
);
if
(
!
mHydrCompute
.
hdyrCompute
())
{
return
false
;
}
mHydrCompute
.
saveResult
(
mUri
);
return
true
;
...
...
@@ -31,14 +33,14 @@ bool CivHydrSimulation::qualitySimulation()
{
CivInpConvertor
convertor
(
mUri
);
std
::
string
inpFileS
=
convertor
.
convertBaseInp
();
if
(
inpFileS
.
empty
())
if
(
inpFileS
.
empty
()
||
inpFileS
==
""
)
return
false
;
mHydrCompute
.
cacheCodeSn
(
mUri
);
if
(
!
mHydrCompute
.
qualityCompute
())
{
return
false
;
}
mHydrCompute
.
saveResult
(
mUri
);
return
true
;
...
...
pandaAnalysis/CivInpConvertor.cpp
View file @
93fd6516
...
...
@@ -39,7 +39,7 @@ std::string CivInpConvertor::convertPorjInp(
if
(
builder
->
getNewInp
(
inpFile
))
{
delete
builder
;
return
NULL
;
return
""
;
}
delete
builder
;
...
...
@@ -63,7 +63,7 @@ std::string CivInpConvertor::convertBaseInp()
if
(
!
builder
->
getNewInp
(
inpFile
))
{
delete
builder
;
return
NULL
;
return
""
;
}
delete
builder
;
...
...
pandaAnalysis/CivSimulResultCache.cpp
View file @
93fd6516
...
...
@@ -26,13 +26,18 @@ void CivSimulResultCache::addLinkQuality(float quality, int interval,const std::
mLinkItemsMap
[
interval
][
sNo
].
dQuality
=
quality
;
}
void
CivSimulResultCache
::
addNodeItems
(
int
internal
,
const
NodeResultItem
&
nodeItem
)
void
CivSimulResultCache
::
addNodeItems
(
int
internal
,
NodeResultItem
&
nodeItem
)
{
if
(
mNodeCodeSnMap
.
find
(
nodeItem
.
szNo
)
!=
mNodeCodeSnMap
.
end
())
nodeItem
.
code
=
mNodeCodeSnMap
.
find
(
nodeItem
.
szNo
)
->
second
;
mNodeItemsMap
[
internal
][
nodeItem
.
szNo
]
=
nodeItem
;
}
void
CivSimulResultCache
::
addLinkItems
(
int
interval
,
const
LinkResultItem
&
linkItem
)
void
CivSimulResultCache
::
addLinkItems
(
int
interval
,
LinkResultItem
&
linkItem
)
{
if
(
mLineCodeSnMap
.
find
(
linkItem
.
szNo
)
!=
mLineCodeSnMap
.
end
())
linkItem
.
code
=
mLineCodeSnMap
.
find
(
linkItem
.
szNo
)
->
second
;
mLinkItemsMap
[
interval
][
linkItem
.
szNo
]
=
linkItem
;
}
...
...
@@ -101,3 +106,10 @@ void CivSimulResultCache::getPipeItemByInterval(int time, LinkResultItems& linkI
if
(
iter
!=
mLinkItemsMap
.
end
())
linkItems
=
iter
->
second
;
}
void
CivSimulResultCache
::
getCodeToSnMap
(
const
std
::
string
&
uri
)
{
CivSimulResDbHelper
helper
(
uri
);
helper
.
getNodeCodeSnMap
(
mNodeCodeSnMap
);
helper
.
getLinCodeSnMap
(
mLineCodeSnMap
);
}
pandaAnalysis/CivSimulResultCache.h
View file @
93fd6516
...
...
@@ -33,13 +33,13 @@ public:
*@brief 缓存节点水力模拟情况
*@param nodeItem:节点水力结果值
*/
void
addNodeItems
(
int
interval
,
const
NodeResultItem
&
nodeItem
);
void
addNodeItems
(
int
interval
,
NodeResultItem
&
nodeItem
);
/**
*@brief 缓存管线水力模拟情况
*@param linkItem:管线模拟结果
*/
void
addLinkItems
(
int
interval
,
const
LinkResultItem
&
linkItem
);
void
addLinkItems
(
int
interval
,
LinkResultItem
&
linkItem
);
/**
*@brief 释放缓存的结果值
...
...
@@ -54,9 +54,13 @@ public:
void
getAllPipeCoords
(
const
std
::
string
&
uri
,
PipeCoords
&
pipeCoords
);
void
getNodeItemByInterval
(
int
time
,
NodeResultItems
&
nodeItem
);
void
getPipeItemByInterval
(
int
time
,
LinkResultItems
&
linkItem
);
void
getCodeToSnMap
(
const
string
&
uri
);
private
:
map
<
int
,
NodeResultItems
>
mNodeItemsMap
;
// 模拟
map
<
int
,
LinkResultItems
>
mLinkItemsMap
;
// 计算的
map
<
int
,
TankResultItems
>
mTankItemsMap
;
map
<
string
,
string
>
mNodeCodeSnMap
;
map
<
string
,
string
>
mLineCodeSnMap
;
};
#endif // !CIVSIMULRESULTCACHE_H
pandaDbManager/CivConnection.cpp
View file @
93fd6516
...
...
@@ -12,7 +12,9 @@ CivConnection::~CivConnection()
}
bool
CivConnection
::
update
(
const
std
::
string
&
table
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
result
,
const
std
::
string
&
where
)
bool
CivConnection
::
update
(
const
std
::
string
&
table
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
result
,
const
std
::
string
&
where
)
{
std
::
string
sql
=
"update "
+
table
+
"set "
;
...
...
@@ -94,7 +96,8 @@ bool CivConnection::insertBulk(const std::string& table,
}
bool
CivConnection
::
insert
(
const
std
::
string
&
table
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
result
)
bool
CivConnection
::
insert
(
const
std
::
string
&
table
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
result
)
{
if
(
table
.
empty
()
||
result
.
size
()
<=
0
)
return
false
;
...
...
@@ -127,7 +130,10 @@ bool CivConnection::insert(const std::string& table, const std::map<std::string,
return
true
;
}
bool
CivConnection
::
query
(
const
std
::
string
&
table
,
const
std
::
vector
<
std
::
string
>&
fields
,
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>&
result
,
const
std
::
string
&
where
)
bool
CivConnection
::
query
(
const
std
::
string
&
table
,
const
std
::
vector
<
std
::
string
>&
fields
,
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>&
result
,
const
std
::
string
&
where
)
{
//1 拼接sql语句
if
(
fields
.
size
()
<=
0
||
table
.
empty
())
...
...
pandaDbManager/CivInpDbHelper.cpp
View file @
93fd6516
...
...
@@ -7,7 +7,7 @@
CivInpDbHelper
::
CivInpDbHelper
(
const
std
::
string
&
uri
)
:
CivInpHelperAbs
(
uri
)
{
mCondtion
=
"
where "
+
PROJFILED
+
" is null or "
+
PROJFILED
+
"=
\"\"
"
;
mCondtion
=
"
"
+
PROJFILED
+
" is null or "
+
PROJFILED
+
"=''
"
;
}
CivInpDbHelper
::~
CivInpDbHelper
()
...
...
pandaDbManager/CivProjInpDbHelper.cpp
View file @
93fd6516
...
...
@@ -16,7 +16,7 @@ CivProjInpDbHelper::~CivProjInpDbHelper()
void
CivProjInpDbHelper
::
setProjCode
(
const
std
::
string
&
projCode
)
{
mPorjCode
=
projCode
;
std
::
string
mCondition
=
PROJFILED
+
" = "
+
projCode
+
"or "
+
PROJFILED
+
" is null or "
+
PROJFILED
+
"=
\"\"
"
;
std
::
string
mCondition
=
PROJFILED
+
" = "
+
projCode
+
"or "
+
PROJFILED
+
" is null or "
+
PROJFILED
+
"=
''
"
;
}
bool
CivProjInpDbHelper
::
getNode
(
CivNode
&
node
)
...
...
pandaDbManager/CivSimuResStruct.h
View file @
93fd6516
...
...
@@ -4,6 +4,7 @@
struct
ResultItem
{
std
::
string
code
;
char
szNo
[
64
];
std
::
string
dDate
;
std
::
string
dTime
;
...
...
pandaDbManager/CivSimulResDbHelper.cpp
View file @
93fd6516
#include "CivSimulResDbHelper.h"
#include "CivPgDbConnection.h"
#include "CivTypes.h"
#include "CivTableFields.h"
#include "CivCommonUtils.h"
...
...
@@ -9,9 +10,10 @@ CivSimulResDbHelper::CivSimulResDbHelper(const std::string& uri)
mConn
->
connect
(
uri
);
NodeResultTableField
tableFields
;
mNodeFields
=
mNodeFields
=
{
tableFields
.
Number
,
"code"
,
//tableFields.Number,
tableFields
.
dDemand
,
tableFields
.
dPressure
,
tableFields
.
dQuality
,
...
...
@@ -24,7 +26,8 @@ CivSimulResDbHelper::CivSimulResDbHelper(const std::string& uri)
//
PipeResultTableField
pipeFields
;
mLinkFileds
=
{
pipeFields
.
szNo
,
"code"
,
//pipeFields.szNo,
pipeFields
.
dFlow
,
pipeFields
.
dVelocity
,
pipeFields
.
dUnitHeadloss
,
...
...
@@ -50,7 +53,7 @@ bool CivSimulResDbHelper::insertNodes(const NodeResultItems& nodeitems)
{
NodeResultItem
nodeItem
=
iter
->
second
;
std
::
string
sn
=
nodeItem
.
szNo
;
std
::
string
sn
=
nodeItem
.
code
;
std
::
vector
<
std
::
string
>
vecRes
=
{
"
\'
"
+
sn
+
"
\'
"
,
...
...
@@ -82,7 +85,7 @@ bool CivSimulResDbHelper::insertLinks(const LinkResultItems& linkMap)
for
(
auto
iter
=
linkMap
.
begin
();
iter
!=
linkMap
.
end
();
iter
++
)
{
LinkResultItem
linkItem
=
iter
->
second
;
std
::
string
sn
=
linkItem
.
szNo
;
std
::
string
sn
=
linkItem
.
code
;
std
::
string
status
=
linkItem
.
szStatus
;
std
::
vector
<
std
::
string
>
vecRes
=
{
...
...
@@ -165,4 +168,50 @@ void CivSimulResDbHelper::getAllPipeCoords(PipeCoords& pipeCoords)
pipeCoord
.
endY
=
nodeInfo
.
find
(
"endy"
)
->
second
;
pipeCoords
[
key
]
=
pipeCoord
;
}
}
void
CivSimulResDbHelper
::
getLinCodeSnMap
(
std
::
map
<
std
::
string
,
std
::
string
>&
map
)
{
std
::
vector
<
std
::
string
>
fileds
=
{
"
\"
编号
\"
"
,
"
\"
code
\"
"
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
res
;
if
(
!
mConn
->
query
(
PIPELINE
,
fileds
,
res
))
return
;
size_t
total
=
res
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
std
::
map
<
std
::
string
,
std
::
string
>
nodeInfo
=
res
[
i
];
PipeCoord
pipeCoord
;
std
::
string
sn
=
nodeInfo
.
find
(
"编号"
)
->
second
;
std
::
string
code
=
nodeInfo
.
find
(
"code"
)
->
second
;
map
[
sn
]
=
code
;
}
}
void
CivSimulResDbHelper
::
getNodeCodeSnMap
(
std
::
map
<
std
::
string
,
std
::
string
>&
map
)
{
std
::
vector
<
std
::
string
>
fileds
=
{
"
\"
本点号
\"
"
,
"
\"
code
\"
"
};
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
res
;
if
(
!
mConn
->
query
(
PIPENODE
,
fileds
,
res
))
return
;
size_t
total
=
res
.
size
();
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
std
::
map
<
std
::
string
,
std
::
string
>
nodeInfo
=
res
[
i
];
PipeCoord
pipeCoord
;
std
::
string
sn
=
nodeInfo
.
find
(
"本点号"
)
->
second
;
std
::
string
code
=
nodeInfo
.
find
(
"code"
)
->
second
;
map
[
sn
]
=
code
;
}
}
\ No newline at end of file
pandaDbManager/CivSimulResDbHelper.h
View file @
93fd6516
...
...
@@ -18,7 +18,8 @@ public:
virtual
void
getAllNodeCoords
(
NodeCoords
&
nodeCoords
);
virtual
void
getAllPipeCoords
(
PipeCoords
&
pipeCoords
);
virtual
void
getLinCodeSnMap
(
std
::
map
<
std
::
string
,
std
::
string
>&
map
);
virtual
void
getNodeCodeSnMap
(
std
::
map
<
std
::
string
,
std
::
string
>&
map
);
private
:
std
::
vector
<
std
::
string
>
mNodeFields
;
std
::
vector
<
std
::
string
>
mLinkFileds
;
...
...
pandaDbManager/CivSimulResHelperAbs.cpp
View file @
93fd6516
...
...
@@ -35,3 +35,15 @@ void CivSimulResHelperAbs::getAllPipeCoords(PipeCoords& pipeCoords)
{
}
void
CivSimulResHelperAbs
::
getLinCodeSnMap
(
std
::
map
<
std
::
string
,
std
::
string
>&
map
)
{
}
void
CivSimulResHelperAbs
::
getNodeCodeSnMap
(
std
::
map
<
std
::
string
,
std
::
string
>&
map
)
{
}
pandaDbManager/CivSimulResHelperAbs.h
View file @
93fd6516
...
...
@@ -21,6 +21,8 @@ public:
virtual
void
getAllNodeCoords
(
NodeCoords
&
nodeCoords
);
virtual
void
getAllPipeCoords
(
PipeCoords
&
pipeCoords
);
virtual
void
getLinCodeSnMap
(
std
::
map
<
std
::
string
,
std
::
string
>&
map
);
virtual
void
getNodeCodeSnMap
(
std
::
map
<
std
::
string
,
std
::
string
>&
map
);
protected
:
CivConnection
*
mConn
=
nullptr
;
...
...
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