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
0b99f27c
Commit
0b99f27c
authored
Nov 03, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
一些小改动
parent
7ba722aa
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
61 additions
and
18 deletions
+61
-18
main.cpp
funcDemo/main.cpp
+1
-1
pandaAlgorithm.vcxproj
pandaAlgorithm/pandaAlgorithm.vcxproj
+1
-0
CivBaseInpBuilder.cpp
pandaAnalysis/CivBaseInpBuilder.cpp
+1
-1
CivOptSchedEngine.cpp
pandaAnalysis/CivOptSchedEngine.cpp
+24
-0
CivOptSchedEngine.h
pandaAnalysis/CivOptSchedEngine.h
+0
-4
CivReportReader.cpp
pandaAnalysis/CivReportReader.cpp
+13
-3
CivReportReader.h
pandaAnalysis/CivReportReader.h
+5
-2
CivSchedulingCompute.cpp
pandaAnalysis/CivSchedulingCompute.cpp
+1
-1
CivSchedulingCompute.h
pandaAnalysis/CivSchedulingCompute.h
+2
-1
pandaAnalysis.vcxproj
pandaAnalysis/pandaAnalysis.vcxproj
+1
-1
CivInpHelperAbs.cpp
pandaDbManager/CivInpHelperAbs.cpp
+12
-2
StringUtils.cpp
pandaLog/StringUtils.cpp
+0
-2
No files found.
funcDemo/main.cpp
View file @
0b99f27c
...
...
@@ -21,7 +21,7 @@ int main(int argc, char* argv[])
{
while
(
true
)
{
const
char
*
uri
=
"host=192.168.19.100 port=5432 dbname=JinXian user=postgres password=admin"
;
const
char
*
uri
=
"host=192.168.19.100 port=5432 dbname=JinXian
3
user=postgres password=admin"
;
char
*
findUri
=
const_cast
<
char
*>
(
uri
);
SetConsoleTextAttribute
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
FOREGROUND_INTENSITY
|
FOREGROUND_GREEN
);
...
...
pandaAlgorithm/pandaAlgorithm.vcxproj
View file @
0b99f27c
...
...
@@ -141,6 +141,7 @@
<EnableCOMDATFolding>
true
</EnableCOMDATFolding>
<OptimizeReferences>
true
</OptimizeReferences>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
<ImportLibrary>
$(OutDir)..\lib\$(TargetName).lib
</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>
copy pandaAlgorithm.h $(OutDir)..\include /y
...
...
pandaAnalysis/CivBaseInpBuilder.cpp
View file @
0b99f27c
...
...
@@ -20,7 +20,7 @@ CivBaseInpBuilder::~CivBaseInpBuilder()
void
CivBaseInpBuilder
::
preHandleLikelyPipe
()
{
mHelper
->
handleValve
();
mHelper
->
handlePump
();
//
mHelper->handlePump();
}
void
CivBaseInpBuilder
::
buildNode
()
...
...
pandaAnalysis/CivOptSchedEngine.cpp
View file @
0b99f27c
...
...
@@ -5,6 +5,8 @@
#include "CivPumpHelper.h"
#include "CivSchedulingCompute.h"
#include "Genome.h"
#include "CivReportReader.h"
#include "CivCommonUtils.h"
...
...
@@ -67,8 +69,29 @@ bool CivOptSchedEngine::optimalScheduling()
vector
<
map
<
string
,
int
>>
monitorsMap
;
genAlg
.
decoding
(
monitorsMap
);
size_t
mSize
=
monitorsMap
.
size
();
for
(
int
i
=
0
;
i
<
mSize
;
i
++
)
{
schedulingCompute
.
updatePumpStatus
(
monitorsMap
[
i
]);
if
(
!
schedulingCompute
.
calculate
())
continue
;
// 获取计算的监测点的值
vector
<
map
<
string
,
double
>>
monitorCalcMapValues
;
schedulingCompute
.
getMonitorsValue
(
monitorCalcMapValues
);
CivReportReader
reportReader
;
float
cost
=
0
;
string
rptPath
=
CivCommonUtils
::
getExePath
()
+
"//test.rpt"
;
reportReader
.
open
(
rptPath
);
// cost = reportReader.readEnergy();
//
// 计算个体自适度
// genAlg.fitnessfunction();
}
// 根据个体自适应度进行选择
// 自适应交叉变异
...
...
@@ -92,6 +115,7 @@ bool CivOptSchedEngine::optimalScheduling()
// 结束计算
schedulingCompute
.
close
();
return
true
;
}
...
...
pandaAnalysis/CivOptSchedEngine.h
View file @
0b99f27c
...
...
@@ -57,16 +57,12 @@ private:
// 初始中群大小
int
popsize
;
// 变异率
double
mMutRate
;
// 交叉率
double
mCrossRate
;
//基因编码长度
int
mGenLength
;
// 针对浮点数编码
double
mLeftPoint
;
double
mRightPoint
;
...
...
pandaAnalysis/CivReportReader.cpp
View file @
0b99f27c
#include "CivReportReader.h"
#include "StringUtils.h"
#include "CivReport.h"
#include<fstream>
#include<iostream>
...
...
@@ -7,21 +10,28 @@ CivReportReader::CivReportReader()
}
void
CivReportReader
::
readEnergy
(
const
string
&
pumpSn
,
string
&
enery
)
float
CivReportReader
::
readEnergy
(
const
string
&
pumpSn
)
{
float
res
=
0
;
return
res
;
}
bool
CivReportReader
::
open
(
const
string
&
reportFile
)
void
CivReportReader
::
open
(
const
string
&
reportFile
)
{
ifstream
reader
(
reportFile
.
c_str
());
// жȡ
string
sLine
;
int
lineNumber
=
0
;
while
(
getline
(
reader
,
sLine
))
{
StringUtils
::
trim
(
sLine
);
if
(
sLine
.
find
(
EnergyHead
))
{
}
lineNumber
++
;
}
reader
.
close
();
}
pandaAnalysis/CivReportReader.h
View file @
0b99f27c
...
...
@@ -3,6 +3,7 @@
#include <string>
#include <vector>
#include <map>
#include "CivReport.h"
using
namespace
std
;
...
...
@@ -15,9 +16,11 @@ class CivReportReader
public
:
CivReportReader
();
bool
open
(
const
string
&
reportFile
);
// 加载读取水力计算报告文件
void
open
(
const
string
&
reportFile
);
void
readEnergy
(
const
string
&
pumpSn
,
string
&
enery
);
// 读取水泵消耗的能量值
float
readEnergy
(
const
string
&
pumpSn
);
private
:
vector
<
EnergyStruct
>
mEnergys
;
// 能耗读取
...
...
pandaAnalysis/CivSchedulingCompute.cpp
View file @
0b99f27c
...
...
@@ -10,7 +10,7 @@ CivSchedulingCompute::CivSchedulingCompute()
mBinFile
=
CivCommonUtils
::
getExePath
()
+
"
\\
test.bin"
;
}
bool
CivSchedulingCompute
::
openFile
(
string
&
inpFILE
)
bool
CivSchedulingCompute
::
openFile
(
const
string
&
inpFILE
)
{
char
inpFile
[
256
];
strcpy_s
(
inpFile
,
inpFILE
.
c_str
());
...
...
pandaAnalysis/CivSchedulingCompute.h
View file @
0b99f27c
#pragma once
#include <map>
#include<vector>
#include <string>
using
namespace
std
;
...
...
@@ -15,7 +16,7 @@ public:
void
setMonitors
(
const
vector
<
string
>&
monitor
);
// 读入inp文件
bool
openFile
(
string
&
inpFILE
);
bool
openFile
(
const
string
&
inpFILE
);
// 水力计算
bool
calculate
();
...
...
pandaAnalysis/pandaAnalysis.vcxproj
View file @
0b99f27c
...
...
@@ -145,7 +145,7 @@
<EnableCOMDATFolding>
true
</EnableCOMDATFolding>
<OptimizeReferences>
true
</OptimizeReferences>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
<AdditionalDependencies>
libpq.lib;pandaDbManager.lib;EPNAET2.lib;pandaLog.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalDependencies>
libpq.lib;pandaDbManager.lib;EPNAET2.lib;pandaLog.lib;
pandaAlgorithm.lib;
%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>
$(OUTDIR)..\lib
</AdditionalLibraryDirectories>
<ImportLibrary>
$(OutDir)..\lib\$(TargetName).lib
</ImportLibrary>
</Link>
...
...
pandaDbManager/CivInpHelperAbs.cpp
View file @
0b99f27c
...
...
@@ -3,6 +3,8 @@
#include "CivPgDbConnection.h"
#include "CivTableFields.h"
#include "StringUtils.h"
#include <vector>
#include<string>
CivInpHelperAbs
::
CivInpHelperAbs
(
const
std
::
string
&
uri
)
{
...
...
@@ -125,9 +127,17 @@ bool CivInpHelperAbs::getCurves(CivCurves& curves)
CivCurves
::
CurvesTable
cTable
;
std
::
map
<
std
::
string
,
std
::
string
>
map
=
resultVector
[
i
];
std
::
string
tempStr
=
map
.
find
(
fields
[
2
])
->
second
;
std
::
vector
<
std
::
string
>
res
;
StringUtils
::
trim
(
tempStr
);
StringUtils
::
split
(
tempStr
,
res
,
","
);
if
(
res
.
size
()
<=
1
)
continue
;
cTable
.
ID
=
map
.
find
(
fields
[
0
])
->
second
;
cTable
.
XCoord
=
map
.
find
(
fields
[
1
])
->
second
;
cTable
.
YCoord
=
map
.
find
(
fields
[
2
])
->
second
;
cTable
.
XCoord
=
res
[
0
]
;
cTable
.
YCoord
=
res
[
1
]
;
curves
.
addItem
(
cTable
);
}
...
...
pandaLog/StringUtils.cpp
View file @
0b99f27c
...
...
@@ -21,11 +21,9 @@ void StringUtils::split(std::string sourceStr, std::vector<std::string>& res, co
void
StringUtils
::
trim
(
std
::
string
&
s
)
{
if
(
!
s
.
empty
())
{
s
.
erase
(
0
,
s
.
find_first_not_of
(
" "
));
s
.
erase
(
s
.
find_last_not_of
(
" "
)
+
1
);
}
}
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