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
d19dee3a
Commit
d19dee3a
authored
Aug 28, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1, 测试框架修改
parent
aafa2bec
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
270 additions
and
84 deletions
+270
-84
CivTestContext.cpp
funcDemo/CivTestContext.cpp
+5
-0
CivTestContext.h
funcDemo/CivTestContext.h
+3
-0
main.cpp
funcDemo/main.cpp
+51
-26
CivBreakPipeAnalysis.cpp
pandaAnalysis/CivBreakPipeAnalysis.cpp
+12
-0
CivBreakPipeAnalysis.h
pandaAnalysis/CivBreakPipeAnalysis.h
+15
-0
CivCloseValveProj.cpp
pandaAnalysis/CivCloseValveProj.cpp
+12
-0
CivCloseValveProj.h
pandaAnalysis/CivCloseValveProj.h
+11
-0
CivInpProject.cpp
pandaAnalysis/CivInpProject.cpp
+18
-0
CivInpProject.h
pandaAnalysis/CivInpProject.h
+19
-0
CivStopWaterAnalysis.cpp
pandaAnalysis/CivStopWaterAnalysis.cpp
+12
-0
CivStopWaterAnalysis.h
pandaAnalysis/CivStopWaterAnalysis.h
+13
-0
pandaAnalysis.vcxproj
pandaAnalysis/pandaAnalysis.vcxproj
+8
-0
pandaAnalysis.vcxproj.filters
pandaAnalysis/pandaAnalysis.vcxproj.filters
+25
-0
CivProjInpDbHelper.cpp
pandaDbManager/CivProjInpDbHelper.cpp
+58
-58
CivTypes.h
pandaDbManager/CivTypes.h
+8
-0
No files found.
funcDemo/CivTestContext.cpp
View file @
d19dee3a
...
...
@@ -13,6 +13,11 @@ CivTestContext::~CivTestContext()
delete
mTest
;
}
void
CivTestContext
::
setHydrTest
(
CivHydrTest
*
test
)
{
mTest
=
test
;
}
void
CivTestContext
::
contextTest
(
char
*
uri
)
{
if
(
mTest
==
nullptr
)
...
...
funcDemo/CivTestContext.h
View file @
d19dee3a
...
...
@@ -6,8 +6,11 @@ class CivTestContext
{
public
:
explicit
CivTestContext
(
CivHydrTest
*
test
);
CivTestContext
()
=
default
;
~
CivTestContext
();
void
setHydrTest
(
CivHydrTest
*
test
);
void
contextTest
(
char
*
uri
);
private
:
...
...
funcDemo/main.cpp
View file @
d19dee3a
...
...
@@ -8,42 +8,68 @@
#include "CivHydrTest.h"
#include <vector>
#include <string>
#include <windows.h>
#include <consoleapi2.h>
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
while
(
true
)
{
const
char
*
uri
=
"host=192.168.19.100 port=5432 dbname=JinXian user=postgres password=admin"
;
char
*
findUri
=
const_cast
<
char
*>
(
uri
);
// 测试水力
/* CivTestContext context(new CivConHydrTest())
;
context.contextTest(findUri);*/
// 测试水质
/*CivTestContext context(new CivConQuaTest())
;
context.contextTest(findUri);*/
SetConsoleTextAttribute
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
FOREGROUND_INTENSITY
|
FOREGROUND_GREEN
);
cout
<<
"C++对象模型测试程序,请输入对应的测试号:(输入0退出)
\n
"
;
cout
<<
"
\t
1.水力接口测试
\n
"
;
cout
<<
"
\t
2.水质计算接口测试
\n
"
;
cout
<<
"
\t
3.追踪测试
\n
"
;
cout
<<
"
\t
4.上游追踪
\n
"
;
cout
<<
"
\t
5.下游追踪
\n
"
;
cout
<<
"
\t
6.水源供水范围分析
\n
"
;
// 测试追踪分析
/*CivTestContext context(new CivConTrackTest());
context.contextTest(findUri);*/
SetConsoleTextAttribute
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
FOREGROUND_INTENSITY
|
FOREGROUND_RED
);
int
test_no
;
cout
<<
"请输入:"
;
cin
>>
test_no
;
cout
<<
"你选择的测试号是:"
<<
test_no
<<
endl
;
CivTestContext
context
;
// 上游追踪
/*CivTestContext context(new CivUpstreamTrackingTest());
context.contextTest(findUri);*/
// 下游追踪
CivTestContext
context
(
new
CivDownStreamTrackingTest
());
switch
(
test_no
)
{
case
0
:
//退出
exit
(
0
);
break
;
case
1
:
//1.测试水力
context
.
setHydrTest
(
new
CivConHydrTest
());
context
.
contextTest
(
findUri
);
break
;
case
2
:
//测试水质
context
.
setHydrTest
(
new
CivConQuaTest
());
context
.
contextTest
(
findUri
);
break
;
case
3
:
//3.测试追踪
context
.
setHydrTest
(
new
CivConTrackTest
());
context
.
contextTest
(
findUri
);
break
;
case
4
:
//4.测试上游追踪
context
.
setHydrTest
(
new
CivUpstreamTrackingTest
());
context
.
contextTest
(
findUri
);
break
;
case
5
:
//5.测试下游追踪
context
.
setHydrTest
(
new
CivDownStreamTrackingTest
());
context
.
contextTest
(
findUri
);
break
;
case
6
:
//6.测试水源供水范围
context
.
setHydrTest
(
new
CivWaterSupplyScopeTest
());
context
.
contextTest
(
findUri
);
break
;
default:
cout
<<
"输入测试号错误!"
<<
endl
;
break
;
}
}
// 水源供水范围分析
/* CivTestContext context(new CivWaterSupplyScopeTest());
context.contextTest(findUri);*/
getchar
();
return
0
;
}
\ No newline at end of file
pandaAnalysis/CivBreakPipeAnalysis.cpp
0 → 100644
View file @
d19dee3a
#include "CivBreakPipeAnalysis.h"
CivBreakPipeAnalysis
::
CivBreakPipeAnalysis
()
{
}
CivBreakPipeAnalysis
::~
CivBreakPipeAnalysis
()
{
}
\ No newline at end of file
pandaAnalysis/CivBreakPipeAnalysis.h
0 → 100644
View file @
d19dee3a
#pragma once
#include <string>
/**
ܷ
*/
class
CivBreakPipeAnalysis
{
public
:
explicit
CivBreakPipeAnalysis
();
~
CivBreakPipeAnalysis
();
};
pandaAnalysis/CivCloseValveProj.cpp
0 → 100644
View file @
d19dee3a
#include "CivCloseValveProj.h"
CivCloseValveProj
::
CivCloseValveProj
()
{
}
CivCloseValveProj
::~
CivCloseValveProj
()
{
}
\ No newline at end of file
pandaAnalysis/CivCloseValveProj.h
0 → 100644
View file @
d19dee3a
#pragma once
/**
طģ
*/
class
CivCloseValveProj
{
public
:
CivCloseValveProj
();
~
CivCloseValveProj
();
};
pandaAnalysis/CivInpProject.cpp
0 → 100644
View file @
d19dee3a
#include "CivInpProject.h"
CivInpProject
::
CivInpProject
()
{
}
CivInpProject
::~
CivInpProject
()
{
}
bool
CivInpProject
::
writeToFile
(
const
string
&
filename
)
{
return
true
;
}
\ No newline at end of file
pandaAnalysis/CivInpProject.h
0 → 100644
View file @
d19dee3a
#pragma once
#include <string>
using
namespace
std
;
/*
ݿinpļ
*/
class
CivInpProject
{
public
:
explicit
CivInpProject
();
~
CivInpProject
();
bool
writeToFile
(
const
string
&
filename
);
private
:
};
pandaAnalysis/CivStopWaterAnalysis.cpp
0 → 100644
View file @
d19dee3a
#include "CivStopWaterAnalysis.h"
CivStopWaterAnalysis
::
CivStopWaterAnalysis
()
{
}
CivStopWaterAnalysis
::~
CivStopWaterAnalysis
()
{
}
\ No newline at end of file
pandaAnalysis/CivStopWaterAnalysis.h
0 → 100644
View file @
d19dee3a
#pragma once
/**
ͣˮ
*/
class
CivStopWaterAnalysis
{
public
:
CivStopWaterAnalysis
();
~
CivStopWaterAnalysis
();
};
pandaAnalysis/pandaAnalysis.vcxproj
View file @
d19dee3a
...
...
@@ -153,6 +153,8 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile
Include=
"CivBaseInpBuilder.cpp"
/>
<ClCompile
Include=
"CivBreakPipeAnalysis.cpp"
/>
<ClCompile
Include=
"CivCloseValveProj.cpp"
/>
<ClCompile
Include=
"CivHydDataType.cpp"
/>
<ClCompile
Include=
"CivHydrCompute.cpp"
/>
<ClCompile
Include=
"CivHydrFuncInter.cpp"
/>
...
...
@@ -160,16 +162,20 @@
<ClCompile
Include=
"CivInpBuilder.cpp"
/>
<ClCompile
Include=
"CivInpConvertor.cpp"
/>
<ClCompile
Include=
"CivInpDirector.cpp"
/>
<ClCompile
Include=
"CivInpProject.cpp"
/>
<ClCompile
Include=
"CivNewInp.cpp"
/>
<ClCompile
Include=
"CivOptSchedSimulation.cpp"
/>
<ClCompile
Include=
"CivProjInpBuilder.cpp"
/>
<ClCompile
Include=
"CivProjManager.cpp"
/>
<ClCompile
Include=
"CivProjSimulation.cpp"
/>
<ClCompile
Include=
"CivSimulResultCache.cpp"
/>
<ClCompile
Include=
"CivStopWaterAnalysis.cpp"
/>
<ClCompile
Include=
"CivTrackingAnalysis.cpp"
/>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"CivBaseInpBuilder.h"
/>
<ClInclude
Include=
"CivBreakPipeAnalysis.h"
/>
<ClInclude
Include=
"CivCloseValveProj.h"
/>
<ClInclude
Include=
"CivGraphList.h"
/>
<ClInclude
Include=
"CivHydDataType.h"
/>
<ClInclude
Include=
"CivHydrCompute.h"
/>
...
...
@@ -178,12 +184,14 @@
<ClInclude
Include=
"CivInpBuilder.h"
/>
<ClInclude
Include=
"CivInpConvertor.h"
/>
<ClInclude
Include=
"CivInpDirector.h"
/>
<ClInclude
Include=
"CivInpProject.h"
/>
<ClInclude
Include=
"CivNewInp.h"
/>
<ClInclude
Include=
"CivOptSchedSimulation.h"
/>
<ClInclude
Include=
"CivProjInpBuilder.h"
/>
<ClInclude
Include=
"CivProjManager.h"
/>
<ClInclude
Include=
"CivProjSimulation.h"
/>
<ClInclude
Include=
"CivSimulResultCache.h"
/>
<ClInclude
Include=
"CivStopWaterAnalysis.h"
/>
<ClInclude
Include=
"CivTrackingAnalysis.h"
/>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
...
...
pandaAnalysis/pandaAnalysis.vcxproj.filters
View file @
d19dee3a
...
...
@@ -60,6 +60,18 @@
<ClCompile
Include=
"CivInpBuilder.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivBreakPipeAnalysis.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivCloseValveProj.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivInpProject.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"CivStopWaterAnalysis.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"CivHydrFuncInter.h"
>
...
...
@@ -110,5 +122,17 @@
<ClInclude
Include=
"CivBaseInpBuilder.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivStopWaterAnalysis.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivInpProject.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivCloseValveProj.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"CivBreakPipeAnalysis.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
pandaDbManager/CivProjInpDbHelper.cpp
View file @
d19dee3a
...
...
@@ -23,13 +23,12 @@ bool CivProjInpDbHelper::getNode(CivNode& node)
{
JunctionTable
nodeTableFields
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTableFields
.
sn
,
nodeTableFields
.
elev
,
nodeTableFields
.
baseDemand
,
nodeTableFields
.
demandPattern
};
std
::
vector
<
std
::
string
>
fields
;
fields
.
push_back
(
nodeTableFields
.
sn
);
fields
.
push_back
(
nodeTableFields
.
elev
);
fields
.
push_back
(
nodeTableFields
.
baseDemand
);
fields
.
push_back
(
nodeTableFields
.
demandPattern
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PIPENODE
,
fields
,
resultVector
,
mCondition
);
...
...
@@ -54,16 +53,17 @@ bool CivProjInpDbHelper::getPipe(CivPipe& pipes)
{
PipeTable
pipeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
pipeTable
.
snNo
,
pipeTable
.
startPoint
,
pipeTable
.
endPoint
,
pipeTable
.
length
,
pipeTable
.
diameter
,
pipeTable
.
friction
,
pipeTable
.
localLoss
,
pipeTable
.
status
};
std
::
vector
<
std
::
string
>
fields
;
fields
.
push_back
(
pipeTable
.
snNo
);
fields
.
push_back
(
pipeTable
.
startPoint
);
fields
.
push_back
(
pipeTable
.
endPoint
);
fields
.
push_back
(
pipeTable
.
length
);
fields
.
push_back
(
pipeTable
.
diameter
);
fields
.
push_back
(
pipeTable
.
friction
);
fields
.
push_back
(
pipeTable
.
localLoss
);
fields
.
push_back
(
pipeTable
.
status
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PIPELINE
,
fields
,
resultVector
);
...
...
@@ -93,16 +93,17 @@ bool CivProjInpDbHelper::getTank(CivTank& tanks)
{
TankTable
tankTable
;
std
::
vector
<
std
::
string
>
fields
=
{
tankTable
.
sn
,
tankTable
.
elev
,
tankTable
.
initLevel
,
tankTable
.
minLevel
,
tankTable
.
maxLevel
,
tankTable
.
diametor
,
tankTable
.
minVolume
,
tankTable
.
volumeCurve
};
std
::
vector
<
std
::
string
>
fields
;
fields
.
push_back
(
tankTable
.
sn
);
fields
.
push_back
(
tankTable
.
elev
);
fields
.
push_back
(
tankTable
.
initLevel
);
fields
.
push_back
(
tankTable
.
minLevel
);
fields
.
push_back
(
tankTable
.
maxLevel
);
fields
.
push_back
(
tankTable
.
diametor
);
fields
.
push_back
(
tankTable
.
minVolume
);
fields
.
push_back
(
tankTable
.
volumeCurve
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
TANK
,
fields
,
resultVector
);
...
...
@@ -130,15 +131,15 @@ bool CivProjInpDbHelper::getTank(CivTank& tanks)
bool
CivProjInpDbHelper
::
getValve
(
CivValve
&
valves
)
{
ValveTable
vaveTable
;
std
::
vector
<
std
::
string
>
fields
=
{
vaveTable
.
sn
,
vaveTable
.
startPoint
,
vaveTable
.
endPoint
,
vaveTable
.
length
,
vaveTable
.
type
,
vaveTable
.
setting
,
vaveTable
.
lossCoeff
}
;
std
::
vector
<
std
::
string
>
fields
;
fields
.
push_back
(
vaveTable
.
sn
);
fields
.
push_back
(
vaveTable
.
startPoint
);
fields
.
push_back
(
vaveTable
.
endPoint
);
fields
.
push_back
(
vaveTable
.
length
);
fields
.
push_back
(
vaveTable
.
type
);
fields
.
push_back
(
vaveTable
.
setting
);
fields
.
push_back
(
vaveTable
.
lossCoeff
)
;
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
VALVE
,
fields
,
resultVector
);
...
...
@@ -165,13 +166,14 @@ bool CivProjInpDbHelper::getValve(CivValve& valves)
bool
CivProjInpDbHelper
::
getPumps
(
CivPumps
&
pumps
)
{
PumpTable
pmTable
;
std
::
vector
<
std
::
string
>
fields
=
{
pmTable
.
sn
,
pmTable
.
startPoint
,
pmTable
.
endPoint
,
pmTable
.
headCurve
,
pmTable
.
power
};
std
::
vector
<
std
::
string
>
fields
;
fields
.
push_back
(
pmTable
.
sn
);
fields
.
push_back
(
pmTable
.
startPoint
);
fields
.
push_back
(
pmTable
.
endPoint
);
fields
.
push_back
(
pmTable
.
headCurve
);
fields
.
push_back
(
pmTable
.
power
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PUMP
,
fields
,
resultVector
);
...
...
@@ -205,11 +207,9 @@ bool CivProjInpDbHelper::getReservoirs(CivReservoirs& reservoirs)
{
ResourcesTable
restemTable
;
std
::
vector
<
std
::
string
>
fields
=
{
restemTable
.
sn
,
restemTable
.
totalHead
,
restemTable
.
headPattern
};
std
::
vector
<
std
::
string
>
fields
;
fields
.
push_back
(
restemTable
.
sn
);
fields
.
push_back
(
restemTable
.
headPattern
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
RESIVOIR
,
fields
,
resultVector
);
...
...
@@ -233,11 +233,11 @@ bool CivProjInpDbHelper::getCoordinates(CivCoordinates& coord)
{
JunctionTable
nodeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTable
.
sn
,
nodeTable
.
xCoord
,
nodeTable
.
yCoord
}
;
std
::
vector
<
std
::
string
>
fields
;
fields
.
push_back
(
nodeTable
.
sn
);
fields
.
push_back
(
nodeTable
.
xCoord
);
fields
.
push_back
(
nodeTable
.
yCoord
)
;
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PIPENODE
,
fields
,
resultVector
);
...
...
@@ -264,11 +264,11 @@ bool CivProjInpDbHelper::getQuality(CivQuality& quality)
{
JunctionTable
nodeTable
;
std
::
vector
<
std
::
string
>
fields
=
{
nodeTable
.
sn
,
nodeTable
.
initQuality
};
std
::
vector
<
std
::
string
>
fields
;
fields
.
push_back
(
nodeTable
.
sn
);
fields
.
push_back
(
nodeTable
.
initQuality
);
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
resultVector
;
mDbConn
->
query
(
PIPENODE
,
fields
,
resultVector
);
...
...
pandaDbManager/CivTypes.h
View file @
d19dee3a
...
...
@@ -15,6 +15,14 @@
#define TANK Str("水池")
#define PUMP Str("水泵")
#define VALVE Str("阀门")
#define PROJ_PIPELINE Str("方案管段")
#define PROJ_PIPENODE Str("方案节点")
#define PROJ_RESIVOIR Str("方案水库")
#define PROJ_TANK Str("方案水池")
#define PROJ_PUMP Str("方案水泵")
#define PROJ_VALVE Str("方案阀门")
#define NODERESULTTABLE Str("节点模拟值")
#define PIPERESULTTABLE Str("管段模拟值")
#define PATTERNTABLE Str("水力模式")
...
...
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