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
618d8082
Commit
618d8082
authored
Nov 30, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1, 优化调度接口修改和优化
parent
8b64e676
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
170 additions
and
67 deletions
+170
-67
CivHydrTest.cpp
funcDemo/CivHydrTest.cpp
+5
-2
FirstOptScheduling.cpp
pandaAlgorithm/FirstOptScheduling.cpp
+3
-3
FirstOptScheduling.h
pandaAlgorithm/FirstOptScheduling.h
+2
-0
OptScheduling.cpp
pandaAlgorithm/OptScheduling.cpp
+1
-0
OptScheduling.h
pandaAlgorithm/OptScheduling.h
+5
-0
CivHydrCompute.cpp
pandaAnalysis/CivHydrCompute.cpp
+53
-35
CivHydrCompute.h
pandaAnalysis/CivHydrCompute.h
+2
-0
CivHydrFuncInter.cpp
pandaAnalysis/CivHydrFuncInter.cpp
+3
-0
CivHydrSimulation.cpp
pandaAnalysis/CivHydrSimulation.cpp
+3
-1
CivInpConvertor.cpp
pandaAnalysis/CivInpConvertor.cpp
+8
-7
CivInpConvertor.h
pandaAnalysis/CivInpConvertor.h
+4
-0
CivOptSchedEngine.cpp
pandaAnalysis/CivOptSchedEngine.cpp
+22
-7
CivSchedulingCompute.cpp
pandaAnalysis/CivSchedulingCompute.cpp
+4
-3
CivSchedulingCompute.h
pandaAnalysis/CivSchedulingCompute.h
+1
-0
CivSimulResultCache.cpp
pandaAnalysis/CivSimulResultCache.cpp
+12
-0
CivSimulResultCache.h
pandaAnalysis/CivSimulResultCache.h
+1
-0
CivInpDbHelper.cpp
pandaDbManager/CivInpDbHelper.cpp
+31
-9
CivCommonUtils.h
pandaLog/CivCommonUtils.h
+10
-0
No files found.
funcDemo/CivHydrTest.cpp
View file @
618d8082
...
...
@@ -41,15 +41,18 @@ void CivConQuaTest::test(char* uri)
// 追踪分析
void
CivConTrackTest
::
test
(
char
*
uri
)
{
char
result
[
1024
*
512
];
char
sn
[
64
];
strcpy_s
(
sn
,
"5
fbaaf9e-dfcf-4e97-9fb1-31d03293f654
"
);
strcpy_s
(
sn
,
"5
c8afd3e-b361-4458-b5ca-6891ec80ae8c
"
);
int
succ
=
trackingSimulation
(
uri
,
sn
,
6
,
result
);
memset
(
result
,
0
,
sizeof
(
result
)
/
sizeof
(
char
));
int
succ
=
trackingSimulation
(
uri
,
sn
,
1
,
result
);
std
::
cout
<<
result
<<
std
::
endl
;
std
::
cout
<<
"测试结果:"
<<
succ
<<
std
::
endl
;
}
void
CivUpstreamTrackingTest
::
test
(
char
*
uri
)
...
...
pandaAlgorithm/FirstOptScheduling.cpp
View file @
618d8082
...
...
@@ -92,7 +92,7 @@ double FirstOptScheduling::objectiveFunction(float cost, const map<string, doubl
continue
;
map
<
string
,
double
>::
iterator
maxIter
=
mMaxMonitorVals
.
find
(
key
);
if
(
maxIter
==
mMaxMonitorVals
.
end
())
if
(
maxIter
==
mMaxMonitorVals
.
end
())
continue
;
float
minVal
=
minIter
->
second
;
...
...
@@ -101,11 +101,11 @@ double FirstOptScheduling::objectiveFunction(float cost, const map<string, doubl
if
(
val
<
minVal
)
{
sum
+=
((
minVal
-
val
)
/
maxMinDiff
);
sum
+=
((
val
-
minVal
)
/
maxMinDiff
);
}
else
if
(
val
>
maxVal
)
{
sum
+=
((
val
-
maxVal
)
/
maxMinDiff
);
sum
+=
((
maxVal
-
val
)
/
maxMinDiff
);
}
}
...
...
pandaAlgorithm/FirstOptScheduling.h
View file @
618d8082
...
...
@@ -43,4 +43,6 @@ public:
virtual
double
waterProductionCost
(
const
vector
<
double
>&
Q
,
const
vector
<
double
>&
S3
);
virtual
double
waterSupplyAndDemand
(
const
vector
<
double
>&
Q
,
const
double
&
Qd
);
};
pandaAlgorithm/OptScheduling.cpp
View file @
618d8082
...
...
@@ -44,6 +44,7 @@ double OptScheduling::waterSupplyAndDemand(const std::vector<double>& Q, const d
void
OptScheduling
::
setMaxMonitorVals
(
const
map
<
string
,
double
>&
maxMonitors
)
{
mMaxMonitorVals
=
maxMonitors
;
}
void
OptScheduling
::
setMinMonitorsVals
(
const
map
<
string
,
double
>&
minMonitors
)
...
...
pandaAlgorithm/OptScheduling.h
View file @
618d8082
...
...
@@ -84,6 +84,10 @@ protected:
// 设置的监测点的调度最大值
map
<
string
,
double
>
mMaxMonitorVals
;
double
mMaxVals
;
// 监测点最大值
double
mMinVals
;
// 监测点最小是
// 设置的监测点的调度最小值
map
<
string
,
double
>
mMinMonitorVals
;
};
\ No newline at end of file
pandaAnalysis/CivHydrCompute.cpp
View file @
618d8082
...
...
@@ -6,9 +6,9 @@
CivHydrCompute
::
CivHydrCompute
()
{
mInFile
=
CivCommonUtils
::
getExePath
()
+
"
\\
test.inp"
;
mRptFile
=
CivCommonUtils
::
getExePath
()
+
"
\\
test.rpt"
;
mBinFile
=
CivCommonUtils
::
getExePath
()
+
"
\\
test.bin"
;
mInFile
=
"
test.inp"
;
mRptFile
=
"
test.rpt"
;
mBinFile
=
"
test.bin"
;
}
bool
CivHydrCompute
::
qualityCompute
()
...
...
@@ -51,6 +51,7 @@ bool CivHydrCompute::qualityCompute()
return
false
;
}
mResultCache
.
clear
();
do
{
...
...
@@ -117,6 +118,11 @@ bool CivHydrCompute::qualityCompute()
return
true
;
}
void
CivHydrCompute
::
clearCache
()
{
mResultCache
.
clear
();
}
bool
CivHydrCompute
::
hdyrCompute
()
{
short
hydCode
=
1
;
...
...
@@ -135,6 +141,7 @@ bool CivHydrCompute::hdyrCompute()
errcode
=
ENopen
(
inpFile
,
rptFile
,
binFile
);
if
(
errcode
>
0
)
{
...
...
@@ -232,8 +239,7 @@ bool CivHydrCompute::chlorineCompute()
ENclose
();
return
false
;
}
do
{
int
nLinkCount
;
...
...
@@ -299,29 +305,15 @@ void CivHydrCompute::dateAndTime(int time,std::string& nowDate,std::string& nowT
{
CivDate
civDate
;
nowDate
=
civDate
.
getDate
();
int
baseTime
=
0
;
// CivCommonUtils::currentHour();
int
a
=
baseTime
+
time
;
int
modulus
=
a
%
24
;
int
yu
=
a
/
24
;
if
(
yu
>
0
)
{
civDate
.
addDate
();
nowDate
=
civDate
.
getDate
();
a
=
modulus
;
}
if
(
modulus
<
10
)
nowTime
=
(
"0"
+
std
::
to_string
(
a
)
+
":00:00"
);
else
nowTime
=
(
std
::
to_string
(
a
)
+
":00:00"
);
nowTime
=
nowDate
+
" "
+
nowTime
;
nowTime
=
nowDate
+
" "
+
to_string
(
time
)
+
":00:00"
;
}
void
CivHydrCompute
::
getNodeResult
(
short
time
)
{
if
(
time
<=
0
)
return
;
time
-=
1
;
// 计算节点
int
nNodeCount
;
ENgetcount
(
EN_NODECOUNT
,
&
nNodeCount
);
...
...
@@ -366,6 +358,10 @@ void CivHydrCompute::getNodeResult(short time)
void
CivHydrCompute
::
getLinkResult
(
short
time
)
{
if
(
time
<=
0
)
return
;
time
-=
1
;
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
int
*
typeCode
=
(
int
*
)
malloc
(
sizeof
(
int
));
...
...
@@ -422,6 +418,10 @@ void CivHydrCompute::getLinkResult(short time)
void
CivHydrCompute
::
getNodeQuality
(
short
time
)
{
if
(
time
<=
0
)
return
;
time
-=
1
;
int
nNodeCount
;
ENgetcount
(
EN_NODECOUNT
,
&
nNodeCount
);
...
...
@@ -444,6 +444,10 @@ void CivHydrCompute::getNodeQuality(short time)
void
CivHydrCompute
::
getLinkQuality
(
short
time
)
{
if
(
time
<=
0
)
return
;
time
-=
1
;
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
int
*
typeCode
=
(
int
*
)
malloc
(
sizeof
(
int
));
...
...
@@ -465,6 +469,11 @@ void CivHydrCompute::getLinkQuality(short time)
void
CivHydrCompute
::
getNodeChlorine
(
short
time
)
{
if
(
time
<=
0
)
return
;
time
-=
1
;
int
nNodeCount
;
ENgetcount
(
EN_NODECOUNT
,
&
nNodeCount
);
int
*
typeCode
=
(
int
*
)
malloc
(
sizeof
(
int
));
...
...
@@ -489,6 +498,11 @@ void CivHydrCompute::getNodeChlorine(short time)
void
CivHydrCompute
::
getLinkChlorine
(
short
time
)
{
if
(
time
<=
0
)
return
;
time
-=
1
;
int
nLinkCount
;
ENgetcount
(
EN_LINKCOUNT
,
&
nLinkCount
);
int
*
typeCode
=
(
int
*
)
malloc
(
sizeof
(
int
));
...
...
@@ -540,17 +554,21 @@ void CivHydrCompute::getTrackingResult(const std::string& uri,std::string& jsonR
for
(
int
j
=
0
;
j
<
total
;
j
++
)
{
std
::
string
sn
=
pipeS
[
j
];
PipeCoord
pipe
=
pipeCoords
.
find
(
sn
)
->
second
;
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
(
"]],"
);
auto
iter
=
pipeCoords
.
find
(
sn
);
if
(
iter
!=
pipeCoords
.
end
())
{
PipeCoord
pipe
=
iter
->
second
;
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
(
"]],"
);
}
}
jsonResult
=
jsonResult
.
substr
(
0
,
jsonResult
.
length
()
-
1
);
...
...
pandaAnalysis/CivHydrCompute.h
View file @
618d8082
...
...
@@ -37,6 +37,8 @@ public:
void
getNodeItemByInterval
(
int
time
,
NodeResultItems
&
nodeItem
);
void
getPipeItemByInterval
(
int
time
,
LinkResultItems
&
linkItem
);
void
clearCache
();
private
:
void
getNodeResult
(
short
time
);
void
getLinkResult
(
short
time
);
...
...
pandaAnalysis/CivHydrFuncInter.cpp
View file @
618d8082
...
...
@@ -32,6 +32,9 @@ bool PANDANALYSIS_API trackingSimulation(char* uri, char* sN, int hours, char* r
std
::
string
uriStr
=
uri
;
std
::
string
sNStr
=
sN
;
// 先清空掉输出空间的
memset
(
result
,
0
,
sizeof
(
result
)
/
sizeof
(
char
));
if
(
uriStr
.
empty
()
||
sNStr
.
empty
())
return
false
;
...
...
pandaAnalysis/CivHydrSimulation.cpp
View file @
618d8082
...
...
@@ -89,7 +89,7 @@ bool CivHydrSimulation::qualitySimulation()
return
true
;
}
bool
CivHydrSimulation
::
trackingSimulation
(
char
*
snNode
,
int
hours
,
std
::
string
&
jsonResult
)
bool
CivHydrSimulation
::
trackingSimulation
(
char
*
snNode
,
int
hours
,
std
::
string
&
jsonResult
)
{
CivInpConvertor
convertor
(
mUri
);
...
...
@@ -101,6 +101,8 @@ bool CivHydrSimulation::trackingSimulation(char* snNode, int hours,std::string&
if
(
inpFileS
.
empty
())
return
false
;
// 先清除一次已经计算的缓存数据
mHydrCompute
.
clearCache
();
if
(
!
mHydrCompute
.
qualityCompute
())
{
return
false
;
...
...
pandaAnalysis/CivInpConvertor.cpp
View file @
618d8082
...
...
@@ -9,7 +9,8 @@
CivInpConvertor
::
CivInpConvertor
(
const
std
::
string
&
uri
)
:
mUri
(
uri
)
{
mInpFileName
=
"test.inp"
;
mProjInpFileName
=
"ptest.inp"
;
}
CivInpConvertor
::~
CivInpConvertor
()
...
...
@@ -41,7 +42,7 @@ std::string CivInpConvertor::convertPorjInp(const std::string& projCode, const s
director
.
setBuilder
(
builder
);
director
.
create
();
std
::
string
inpFile
=
"ptest.inp"
;
std
::
string
inpFile
=
mProjInpFileName
;
if
(
!
builder
->
getNewInp
(
inpFile
))
{
delete
builder
;
...
...
@@ -59,7 +60,7 @@ std::string CivInpConvertor::convertBaseInp()
director
.
setBuilder
(
builder
);
director
.
create
();
std
::
string
inpFile
=
"test.inp"
;
std
::
string
inpFile
=
mInpFileName
;
if
(
!
builder
->
getNewInp
(
inpFile
))
{
delete
builder
;
...
...
@@ -87,7 +88,7 @@ std::string CivInpConvertor::convertTrackInp(const std::string& sn, const std::s
director
.
setBuilder
(
builder
);
director
.
create
();
std
::
string
inpFile
=
"test.inp"
;
std
::
string
inpFile
=
mInpFileName
;
if
(
!
builder
->
getNewInp
(
inpFile
))
{
delete
builder
;
...
...
@@ -107,7 +108,7 @@ std::string CivInpConvertor::convertAnalysisInp()
director
.
setBuilder
(
builder
);
director
.
create
();
std
::
string
inpFile
=
"test.inp"
;
std
::
string
inpFile
=
mInpFileName
;
if
(
!
builder
->
getNewInp
(
inpFile
))
{
delete
builder
;
...
...
@@ -130,7 +131,7 @@ std::string CivInpConvertor::convertResidualInp()
director
.
setBuilder
(
builder
);
director
.
create
();
std
::
string
inpFile
=
"test.inp"
;
std
::
string
inpFile
=
mInpFileName
;
if
(
!
builder
->
getNewInp
(
inpFile
))
{
delete
builder
;
...
...
@@ -154,7 +155,7 @@ std::string CivInpConvertor::convertNotPorjInp(const std::string& simulTime)
director
.
setBuilder
(
builder
);
director
.
create
();
std
::
string
inpFile
=
"test.inp"
;
std
::
string
inpFile
=
mInpFileName
;
if
(
!
builder
->
getNewInp
(
inpFile
))
{
delete
builder
;
...
...
pandaAnalysis/CivInpConvertor.h
View file @
618d8082
...
...
@@ -47,4 +47,7 @@ public:
private
:
std
::
string
mUri
;
std
::
string
mInpFileName
;
std
::
string
mProjInpFileName
;
};
\ No newline at end of file
pandaAnalysis/CivOptSchedEngine.cpp
View file @
618d8082
...
...
@@ -18,7 +18,11 @@ CivOptSchedEngine::CivOptSchedEngine(const string& uri)
bool
CivOptSchedEngine
::
optimalScheduling
(
int
time
)
{
// 计算初始化
beginCompute
();
if
(
!
beginCompute
())
{
return
false
;
}
// 开始遗传算法
std
::
shared_ptr
<
OptScheduling
>
optScheduling
(
new
FirstOptScheduling
());
...
...
@@ -29,14 +33,14 @@ bool CivOptSchedEngine::optimalScheduling(int time)
genAlg
.
setPumpVec
(
mPumpVec
);
// 种群初始化
popsize
=
2
0
;
popsize
=
1
0
;
genAlg
.
init
(
popsize
,
mMutRate
,
mCrossRate
,
mGenLength
,
0
,
1
);
// 开始迭代计算
int
index
=
0
;
// 迭代次数
int
generation
=
10
0
;
int
generation
=
2
0
;
mSchedulingCompute
->
clearLastVals
();
while
(
index
++
<
generation
)
...
...
@@ -79,7 +83,7 @@ bool CivOptSchedEngine::optimalScheduling(int time)
// 计算个体自适度
double
fitness
=
genAlg
.
fitnessfunction
(
cost
,
monitorCalcMapValues
);
if
(
fitness
>
1
)
if
(
fitness
>
=
1
)
fitness
=
0
;
logStr
.
append
(
" 适应度值:"
+
to_string
(
fitness
));
...
...
@@ -113,9 +117,10 @@ bool CivOptSchedEngine::optimalScheduling(int time)
string
infoStr
=
"最优水泵组合值:"
;
for
(
int
i
=
0
;
i
<
totalGenVec
;
i
++
)
{
infoStr
.
append
(
mPumpVec
[
i
]
+
":
"
+
to_string
(
genVec
[
i
])
);
infoStr
.
append
(
mPumpVec
[
i
]
+
":
"
+
to_string
(
genVec
[
i
])
+
" "
);
mPumpBestSpeed
.
insert
(
pair
<
string
,
double
>
(
mPumpVec
[
i
],
genVec
[
i
]));
}
infoStr
.
append
(
" 最佳适应度:"
+
to_string
(
genome
.
fitness
));
CivSysLog
::
getInstance
()
->
error
(
infoStr
,
"CivOptSchedEngine"
,
__FUNCTION__
);
mSchedulingCompute
->
clearLastVals
();
...
...
@@ -195,6 +200,12 @@ bool CivOptSchedEngine::beginCompute()
// 获取水泵个数,根据水泵个数确定基因编码长度
CivPumpHelper
pumpHelper
(
mUri
);
mGenLength
=
pumpHelper
.
getPumpNumbers
();
if
(
mGenLength
<=
0
)
{
CivSysLog
::
getInstance
()
->
error
(
"CivOptSchedEngine"
,
"获取不到水泵"
,
__FUNCTION__
);
return
false
;
}
// 获取本点号和code的映射
map
<
string
,
string
>
snToCodeMap
;
...
...
@@ -214,8 +225,12 @@ bool CivOptSchedEngine::beginCompute()
// 构造水力计算对象
mSchedulingCompute
->
setMonitors
(
mMonitorsVec
);
mSchedulingCompute
->
openFile
(
inpFile
);
if
(
!
mSchedulingCompute
->
openFile
(
inpFile
))
{
CivSysLog
::
getInstance
()
->
info
(
inpFile
,
"CivOptSchedEngine"
,
__FUNCTION__
);
return
false
;
}
// 原始管网计算一次水力,保留调度前的水力计算结果
if
(
!
mSchedulingCompute
->
calculate
())
return
false
;
...
...
pandaAnalysis/CivSchedulingCompute.cpp
View file @
618d8082
...
...
@@ -7,14 +7,15 @@
CivSchedulingCompute
::
CivSchedulingCompute
(
SchdulingType
schedulingType
)
:
mChdulingType
(
schedulingType
)
{
mRptFile
=
CivCommonUtils
::
getExePath
()
+
"
\\
test.rpt"
;
mBinFile
=
CivCommonUtils
::
getExePath
()
+
"
\\
test.bin"
;
mRptFile
=
"test.rpt"
;
mBinFile
=
"test.bin"
;
mInpFile
=
"test.inp"
;
}
bool
CivSchedulingCompute
::
openFile
(
const
string
&
inpFILE
)
{
char
inpFile
[
256
];
strcpy_s
(
inpFile
,
inpFILE
.
c_str
());
strcpy_s
(
inpFile
,
mInpFile
.
c_str
());
char
rptFile
[
128
];
strcpy_s
(
rptFile
,
mRptFile
.
c_str
());
...
...
pandaAnalysis/CivSchedulingCompute.h
View file @
618d8082
...
...
@@ -64,6 +64,7 @@ private:
private
:
std
::
string
mRptFile
;
std
::
string
mBinFile
;
std
::
string
mInpFile
;
// 水泵编号和code的映射
vector
<
string
>
mMonitors
;
...
...
pandaAnalysis/CivSimulResultCache.cpp
View file @
618d8082
...
...
@@ -14,6 +14,15 @@ void CivSimulResultCache::addNodeQuality(float quality, int interval, const std:
mNodeItemsMap
[
interval
][
sNo
].
dQuality
=
quality
;
}
CivSimulResultCache
::~
CivSimulResultCache
()
{
mNodeItemsMap
.
clear
();
mLinkItemsMap
.
clear
();
mTankItemsMap
.
clear
();
mNodeCodeSnMap
.
clear
();
mLineCodeSnMap
.
clear
();
}
void
CivSimulResultCache
::
addLinkQuality
(
float
quality
,
int
interval
,
const
std
::
string
&
sNo
)
{
if
(
mLinkItemsMap
.
find
(
interval
)
==
mLinkItemsMap
.
end
())
...
...
@@ -115,6 +124,9 @@ void CivSimulResultCache::getPipeItemByInterval(int time, LinkResultItems& linkI
void
CivSimulResultCache
::
getCodeToSnMap
(
const
std
::
string
&
uri
)
{
if
(
mNodeCodeSnMap
.
size
()
>
0
||
mLineCodeSnMap
.
size
()
>
0
)
return
;
CivSimulResDbHelper
helper
(
uri
);
helper
.
getNodeCodeSnMap
(
mNodeCodeSnMap
);
helper
.
getLinCodeSnMap
(
mLineCodeSnMap
);
...
...
pandaAnalysis/CivSimulResultCache.h
View file @
618d8082
...
...
@@ -13,6 +13,7 @@ using namespace std;
class
CivSimulResultCache
{
public
:
~
CivSimulResultCache
();
/**
*@brief 缓存节点水质
*@param quality:存储的值
...
...
pandaDbManager/CivInpDbHelper.cpp
View file @
618d8082
...
...
@@ -340,7 +340,10 @@ void CivInpDbHelper::handleValve()
CivPipe
::
Table
pipeStruct
;
pipeStruct
.
ID
=
pipe
.
find
(
"编号"
)
->
second
;
pipeStruct
.
code
=
pipe
.
find
(
"code"
)
->
second
;
if
(
pipe
.
find
(
"code"
)
!=
pipe
.
end
())
pipeStruct
.
code
=
pipe
.
find
(
"code"
)
->
second
;
pipeStruct
.
Node1
=
pipe
.
find
(
"起始节点"
)
->
second
;
pipeStruct
.
Node2
=
pipe
.
find
(
"终止节点"
)
->
second
;
pipeStruct
.
Length
=
pipe
.
find
(
"管长"
)
->
second
;
...
...
@@ -368,15 +371,34 @@ void CivInpDbHelper::handleValve()
std
::
map
<
std
::
string
,
std
::
string
>
pipe
=
downPipes
[
i
];
CivPipe
::
Table
pipeStruct
;
pipeStruct
.
ID
=
pipe
.
find
(
"编号"
)
->
second
;
pipeStruct
.
code
=
pipe
.
find
(
"code"
)
->
second
;
pipeStruct
.
Node1
=
pipe
.
find
(
"起始节点"
)
->
second
;
pipeStruct
.
Node2
=
pipe
.
find
(
"终止节点"
)
->
second
;
pipeStruct
.
Length
=
pipe
.
find
(
"管长"
)
->
second
;
pipeStruct
.
Diameter
=
pipe
.
find
(
"管径"
)
->
second
;
pipeStruct
.
Roughness
=
pipe
.
find
(
"摩阻系数"
)
->
second
;
auto
iterEnd
=
pipe
.
end
();
if
(
pipe
.
find
(
"编号"
)
!=
iterEnd
)
pipeStruct
.
ID
=
pipe
.
find
(
"编号"
)
->
second
;
if
(
pipe
.
find
(
"code"
)
!=
iterEnd
)
pipeStruct
.
code
=
pipe
.
find
(
"code"
)
->
second
;
if
(
pipe
.
find
(
"起始节点"
)
!=
iterEnd
)
pipeStruct
.
Node1
=
pipe
.
find
(
"起始节点"
)
->
second
;
if
(
pipe
.
find
(
"终止节点"
)
!=
iterEnd
)
pipeStruct
.
Node2
=
pipe
.
find
(
"终止节点"
)
->
second
;
if
(
pipe
.
find
(
"管长"
)
!=
iterEnd
)
pipeStruct
.
Length
=
pipe
.
find
(
"管长"
)
->
second
;
if
(
pipe
.
find
(
"管径"
)
!=
iterEnd
)
pipeStruct
.
Diameter
=
pipe
.
find
(
"管径"
)
->
second
;
if
(
pipe
.
find
(
"摩阻系数"
)
!=
iterEnd
)
pipeStruct
.
Roughness
=
pipe
.
find
(
"摩阻系数"
)
->
second
;
pipeStruct
.
Status
=
"Open"
;
pipeStruct
.
MinorLoss
=
pipe
.
find
(
"局损系数"
)
->
second
;
if
(
pipe
.
find
(
"局损系数"
)
!=
iterEnd
)
pipeStruct
.
MinorLoss
=
pipe
.
find
(
"局损系数"
)
->
second
;
mPipesVec
.
push_back
(
pipeStruct
);
}
...
...
pandaLog/CivCommonUtils.h
View file @
618d8082
...
...
@@ -4,6 +4,16 @@
#include<vector>
#include "pandaLog.h"
#ifdef _WIN32
#define SEP "\\\\"
#else
#define SEP "/"
#endif // _WIN32
// 字符串转编码
#define TransUTFCoding(name) CivCommonUtils::string_To_UTF8(name)
#define UTFTransCoding(name) CivCommonUtils::UTF8_To_string(name)
...
...
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