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
fcd5a414
Commit
fcd5a414
authored
Oct 27, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1, 修改保存
parent
4805137f
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
168 additions
and
30 deletions
+168
-30
GenAlg.cpp
pandaAlgorithm/GenAlg.cpp
+4
-15
GenAlg.h
pandaAlgorithm/GenAlg.h
+11
-6
OptScheduling.h
pandaAlgorithm/OptScheduling.h
+8
-0
CivGraphList.h
pandaAnalysis/CivGraphList.h
+1
-1
CivHydDataType.h
pandaAnalysis/CivHydDataType.h
+3
-2
CivHydrScheduling.cpp
pandaAnalysis/CivHydrScheduling.cpp
+54
-0
CivHydrScheduling.h
pandaAnalysis/CivHydrScheduling.h
+75
-0
CivTrackingAnalysis.cpp
pandaAnalysis/CivTrackingAnalysis.cpp
+10
-5
CivTrackingAnalysis.h
pandaAnalysis/CivTrackingAnalysis.h
+1
-1
CivInpHelperAbs.h
pandaDbManager/CivInpHelperAbs.h
+1
-0
No files found.
pandaAlgorithm/GenAlg.cpp
View file @
fcd5a414
...
@@ -105,17 +105,6 @@ void GenAlg::select()
...
@@ -105,17 +105,6 @@ void GenAlg::select()
}
}
int
GenAlg
::
nextRandom
(
int
total
,
vector
<
int
>
visited
)
{
int
index
=
random
(
0
,
total
);
std
::
vector
<
int
>::
iterator
iter
=
std
::
find
(
visited
.
begin
(),
visited
.
end
(),
index
);
if
(
iter
!=
visited
.
end
())
return
nextRandom
(
total
,
visited
);
visited
.
push_back
(
index
);
return
index
;
}
void
GenAlg
::
corssver
()
void
GenAlg
::
corssver
()
{
{
// 染色体个数
// 染色体个数
...
@@ -150,8 +139,7 @@ void GenAlg::crossover(vector<char>& chromo1, vector<char>& chromo2)
...
@@ -150,8 +139,7 @@ void GenAlg::crossover(vector<char>& chromo1, vector<char>& chromo2)
return
;
return
;
int
total
=
chromo1
.
size
();
int
total
=
chromo1
.
size
();
// 基因交叉重组
// 基因交叉重组
for
(
int
i
=
0
;
i
<
total
;
i
++
)
for
(
int
i
=
0
;
i
<
total
;
i
++
)
{
{
...
@@ -270,12 +258,12 @@ void GenAlg::fitnessfunction()
...
@@ -270,12 +258,12 @@ void GenAlg::fitnessfunction()
}
}
void
GenAlg
::
encoding
()
void
GenAlg
::
encoding
(
map
<
string
,
int
>&
phenotype
,
vector
<
char
>&
chromo
)
{
{
}
}
void
GenAlg
::
decoding
()
void
GenAlg
::
decoding
(
vector
<
char
>&
chromo
,
map
<
string
,
int
>&
phenotype
)
{
{
}
}
\ No newline at end of file
pandaAlgorithm/GenAlg.h
View file @
fcd5a414
...
@@ -65,17 +65,22 @@ public:
...
@@ -65,17 +65,22 @@ public:
// 计算个体自适应度
// 计算个体自适应度
void
fitnessfunction
();
void
fitnessfunction
();
// 编码,
/**
void
encoding
();
* @brief 编码, 将水泵开关状态编码成二进制状态:0表示管,1表示开
* @param
*/
void
encoding
(
map
<
string
,
int
>&
phenotype
,
vector
<
char
>&
chromo
);
/**
* @brief 解码, 将二进制状态吗解码成水泵对应的状态
* @param
*/
void
decoding
(
vector
<
char
>&
chromo
,
map
<
string
,
int
>&
phenotype
);
// 解码
void
decoding
();
private
:
private
:
// 产生[a,b)之间的浮点数
// 产生[a,b)之间的浮点数
double
random
(
int
a
=
0
,
int
b
=
RAND_MAX
);
double
random
(
int
a
=
0
,
int
b
=
RAND_MAX
);
int
nextRandom
(
int
total
,
vector
<
int
>
visited
);
// 两个染色体交叉运算
// 两个染色体交叉运算
void
crossover
(
vector
<
char
>&
chromo1
,
vector
<
char
>&
chromo2
);
void
crossover
(
vector
<
char
>&
chromo1
,
vector
<
char
>&
chromo2
);
...
...
pandaAlgorithm/OptScheduling.h
View file @
fcd5a414
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
#include <vector>
#include <vector>
#include <map>
#include <map>
using
namespace
std
;
class
PANDAALGORITHM_API
OptScheduling
class
PANDAALGORITHM_API
OptScheduling
{
{
public
:
public
:
...
@@ -59,4 +61,9 @@ public:
...
@@ -59,4 +61,9 @@ public:
* @return
* @return
*/
*/
virtual
double
waterSupplyAndDemand
(
const
std
::
vector
<
double
>&
Q
,
const
double
&
Qd
);
virtual
double
waterSupplyAndDemand
(
const
std
::
vector
<
double
>&
Q
,
const
double
&
Qd
);
protected
:
};
};
\ No newline at end of file
pandaAnalysis/CivGraphList.h
View file @
fcd5a414
...
@@ -56,7 +56,7 @@ template <class VertexType, class EdgeType>
...
@@ -56,7 +56,7 @@ template <class VertexType, class EdgeType>
class
ALGraph
class
ALGraph
{
{
public
:
public
:
explicit
ALGraph
();
ALGraph
();
~
ALGraph
();
~
ALGraph
();
void
getVisitedResult
(
IN
const
VertexType
&
vetexType
,
OUT
std
::
vector
<
VertexType
>&
vertex
,
OUT
std
::
vector
<
EdgeType
>&
edges
);
void
getVisitedResult
(
IN
const
VertexType
&
vetexType
,
OUT
std
::
vector
<
VertexType
>&
vertex
,
OUT
std
::
vector
<
EdgeType
>&
edges
);
...
...
pandaAnalysis/CivHydDataType.h
View file @
fcd5a414
...
@@ -11,7 +11,7 @@ class CivGraphJunction
...
@@ -11,7 +11,7 @@ class CivGraphJunction
public
:
public
:
CivGraphJunction
();
CivGraphJunction
();
CivGraphJunction
(
std
::
string
sN
);
explicit
CivGraphJunction
(
std
::
string
sN
);
CivGraphJunction
(
std
::
string
sN
,
std
::
string
xCoord
,
std
::
string
yCoord
);
CivGraphJunction
(
std
::
string
sN
,
std
::
string
xCoord
,
std
::
string
yCoord
);
bool
operator
==
(
const
CivGraphJunction
&
j1
);
bool
operator
==
(
const
CivGraphJunction
&
j1
);
...
@@ -53,6 +53,7 @@ public:
...
@@ -53,6 +53,7 @@ public:
CivGraphEdage
(
std
::
string
sn
,
std
::
string
length
,
std
::
vector
<
std
::
string
>
position
);
CivGraphEdage
(
std
::
string
sn
,
std
::
string
length
,
std
::
vector
<
std
::
string
>
position
);
friend
bool
operator
==
(
const
CivGraphEdage
&
left
,
const
CivGraphEdage
&
right
);
friend
bool
operator
==
(
const
CivGraphEdage
&
left
,
const
CivGraphEdage
&
right
);
bool
operator
==
(
const
CivGraphEdage
&
edage
);
bool
operator
==
(
const
CivGraphEdage
&
edage
);
bool
operator
>
(
const
CivGraphEdage
&
edage
);
bool
operator
>
(
const
CivGraphEdage
&
edage
);
bool
operator
<
(
const
CivGraphEdage
&
edage
);
bool
operator
<
(
const
CivGraphEdage
&
edage
);
...
@@ -71,10 +72,10 @@ public:
...
@@ -71,10 +72,10 @@ public:
void
setStartY
(
const
std
::
string
&
startY
)
{
mStartY
=
startY
;
}
void
setStartY
(
const
std
::
string
&
startY
)
{
mStartY
=
startY
;
}
void
setEndX
(
const
std
::
string
&
endX
)
{
mEndX
=
endX
;
}
void
setEndX
(
const
std
::
string
&
endX
)
{
mEndX
=
endX
;
}
void
setEndY
(
const
std
::
string
&
endY
)
{
mEndY
=
endY
;
}
void
setEndY
(
const
std
::
string
&
endY
)
{
mEndY
=
endY
;
}
private
:
private
:
std
::
string
mSN
;
// 编号
std
::
string
mSN
;
// 编号
std
::
string
mLength
;
// 管长
std
::
string
mLength
;
// 管长
std
::
string
mStartX
;
std
::
string
mStartX
;
std
::
string
mStartY
;
std
::
string
mStartY
;
std
::
string
mEndX
;
std
::
string
mEndX
;
...
...
pandaAnalysis/CivHydrScheduling.cpp
0 → 100644
View file @
fcd5a414
#include "CivHydrScheduling.h"
CivHydrScheduling
::
CivHydrScheduling
(
SchedulingType
schedulingType
)
:
mSchedulingType
(
schedulingType
)
{
}
bool
CivHydrScheduling
::
open
()
{
}
bool
CivHydrScheduling
::
close
()
{
}
void
CivHydrScheduling
::
updatePumpStatus
(
const
map
<
string
,
int
>&
statusMap
)
{
}
bool
CivHydrScheduling
::
compute
()
{
}
void
CivHydrScheduling
::
setPressMonitors
(
vector
<
string
>&
monitors
)
{
mPressMonitorMap
=
monitors
;
}
void
CivHydrScheduling
::
setFlowMonitor
(
vector
<
string
>&
monitors
)
{
mFlowMonitorMap
=
monitors
;
}
void
CivHydrScheduling
::
monitorsValue
(
SchedulingType
schedulingType
,
vector
<
map
<
string
,
double
>>&
simulMap
)
{
switch
(
schedulingType
)
{
case
CivHydrScheduling
:
:
SchedulingFlow
:
simulMap
=
mMonitorPressSmulVal
;
break
;
case
CivHydrScheduling
:
:
SchedulingPressure
:
simulMap
=
mMonitorFlowSmulVal
;
break
;
case
CivHydrScheduling
:
:
SchedulingALL
:
default
:
break
;
}
}
\ No newline at end of file
pandaAnalysis/CivHydrScheduling.h
0 → 100644
View file @
fcd5a414
#pragma once
#include <map>
#include <string>
#include <vector>
using
namespace
std
;
/**
优化调度水力计算
*/
class
CivHydrScheduling
{
public
:
// 调度类型:压力,为
enum
SchedulingType
{
SchedulingFlow
,
SchedulingPressure
,
SchedulingALL
};
CivHydrScheduling
(
SchedulingType
schedulingType
);
/**
* 加载,打开 inp 文件
*/
bool
open
();
/**
*结束运算,关闭文件句柄
*/
bool
close
();
/**
* 动态更新水泵参数
*/
void
updatePumpStatus
(
const
map
<
string
,
int
>&
statusMap
);
/**
* 执行一次水力计算
*/
bool
compute
();
/**
* 设置压力监测点
*/
void
setPressMonitors
(
vector
<
string
>&
monitors
);
/**
* 设置流量监测点
*/
void
setFlowMonitor
(
vector
<
string
>&
monitors
);
/**
* 获取监测点的模拟值
*/
void
monitorsValue
(
SchedulingType
schedulingType
,
vector
<
map
<
string
,
double
>>&
simulMap
);
private
:
// 调度类型: 压力,流量
SchedulingType
mSchedulingType
;
// 压力监测点
vector
<
string
>
mPressMonitorMap
;
// 流量监测点
vector
<
string
>
mFlowMonitorMap
;
// 压力监测监测点的模拟值
vector
<
map
<
string
,
double
>>
mMonitorPressSmulVal
;
// 流量监测点模拟值
vector
<
map
<
string
,
double
>>
mMonitorFlowSmulVal
;
};
pandaAnalysis/CivTrackingAnalysis.cpp
View file @
fcd5a414
...
@@ -116,8 +116,10 @@ bool CivTrackingAnalysis::createGraphFrom()
...
@@ -116,8 +116,10 @@ bool CivTrackingAnalysis::createGraphFrom()
return
true
;
return
true
;
}
}
bool
CivTrackingAnalysis
::
transformJson
(
const
std
::
vector
<
CivGraphJunction
>&
junctions
,
bool
CivTrackingAnalysis
::
transformJson
(
const
std
::
vector
<
CivGraphEdage
>&
pipes
,
std
::
string
&
jsonResult
)
const
std
::
vector
<
CivGraphJunction
>&
junctions
,
const
std
::
vector
<
CivGraphEdage
>&
pipes
,
std
::
string
&
jsonResult
)
{
{
// 管段
// 管段
size_t
pipesTotal
=
pipes
.
size
();
size_t
pipesTotal
=
pipes
.
size
();
...
@@ -197,7 +199,8 @@ bool CivTrackingAnalysis::waterSupplyScopeAnalysis(const std::string& sN, std::s
...
@@ -197,7 +199,8 @@ bool CivTrackingAnalysis::waterSupplyScopeAnalysis(const std::string& sN, std::s
return
true
;
return
true
;
}
}
bool
CivTrackingAnalysis
::
upstreamTracking
(
const
std
::
string
&
sN
,
bool
CivTrackingAnalysis
::
upstreamTracking
(
const
std
::
string
&
sN
,
std
::
vector
<
CivGraphJunction
>&
junctions
,
std
::
vector
<
CivGraphJunction
>&
junctions
,
std
::
vector
<
CivGraphEdage
>&
pipes
)
std
::
vector
<
CivGraphEdage
>&
pipes
)
{
{
...
@@ -212,7 +215,8 @@ bool CivTrackingAnalysis::upstreamTracking(const std::string& sN,
...
@@ -212,7 +215,8 @@ bool CivTrackingAnalysis::upstreamTracking(const std::string& sN,
return
true
;
return
true
;
}
}
bool
CivTrackingAnalysis
::
downstreamTracking
(
const
std
::
string
&
sN
,
bool
CivTrackingAnalysis
::
downstreamTracking
(
const
std
::
string
&
sN
,
std
::
vector
<
CivGraphJunction
>&
junctions
,
std
::
vector
<
CivGraphJunction
>&
junctions
,
std
::
vector
<
CivGraphEdage
>&
pipes
)
std
::
vector
<
CivGraphEdage
>&
pipes
)
{
{
...
@@ -223,7 +227,8 @@ bool CivTrackingAnalysis::downstreamTracking(const std::string& sN,
...
@@ -223,7 +227,8 @@ bool CivTrackingAnalysis::downstreamTracking(const std::string& sN,
return
true
;
return
true
;
}
}
bool
CivTrackingAnalysis
::
waterSupplyScopeAnalysis
(
const
std
::
string
&
sN
,
bool
CivTrackingAnalysis
::
waterSupplyScopeAnalysis
(
const
std
::
string
&
sN
,
std
::
vector
<
CivGraphJunction
>&
junctions
,
std
::
vector
<
CivGraphJunction
>&
junctions
,
std
::
vector
<
CivGraphEdage
>&
pipes
)
std
::
vector
<
CivGraphEdage
>&
pipes
)
{
{
...
...
pandaAnalysis/CivTrackingAnalysis.h
View file @
fcd5a414
...
@@ -39,9 +39,9 @@ public:
...
@@ -39,9 +39,9 @@ public:
*@param uri 数据库连接地址
*@param uri 数据库连接地址
*/
*/
bool
createGraphFrom
();
bool
createGraphFrom
();
private
:
private
:
/**
/**
*@brief 节点和管段集合信息转换成json字符串
*@brief 节点和管段集合信息转换成json字符串
*@param junctions 节点信息集合
*@param junctions 节点信息集合
...
...
pandaDbManager/CivInpHelperAbs.h
View file @
fcd5a414
...
@@ -22,6 +22,7 @@ public:
...
@@ -22,6 +22,7 @@ public:
virtual
void
handlePump
()
=
0
;
virtual
void
handlePump
()
=
0
;
virtual
void
handleValve
()
=
0
;
virtual
void
handleValve
()
=
0
;
// 组件需要重载
// 组件需要重载
virtual
bool
getNode
(
CivNode
&
node
)
=
0
;
virtual
bool
getNode
(
CivNode
&
node
)
=
0
;
virtual
bool
getPipe
(
CivPipe
&
pipe
)
=
0
;
virtual
bool
getPipe
(
CivPipe
&
pipe
)
=
0
;
...
...
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