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
47d69698
Commit
47d69698
authored
Jun 16, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1, 模型修正
parent
bebd398c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
15 deletions
+68
-15
main.cpp
funcDemo/main.cpp
+1
-1
CivHydrCalc.cpp
pandaAnalysis/CivHydrCalc.cpp
+33
-11
CivDbConnection.cpp
pandaDbManager/CivDbConnection.cpp
+10
-1
CivDbConnection.h
pandaDbManager/CivDbConnection.h
+2
-1
CivTableTemp.cpp
pandaDbManager/CivTableTemp.cpp
+2
-0
CivTableTemp.h
pandaDbManager/CivTableTemp.h
+2
-0
CivTypes.h
pandaDbManager/CivTypes.h
+18
-1
水力模型.docx
建模文档/水力模型.docx
+0
-0
No files found.
funcDemo/main.cpp
View file @
47d69698
...
...
@@ -5,7 +5,7 @@
int
main
(
int
argc
,
char
*
argv
[])
{
const
char
*
uri
=
"host=192.168.12.7 port=5432 dbname=
liulele
user=postgres password=admin"
;
const
char
*
uri
=
"host=192.168.12.7 port=5432 dbname=
2222
user=postgres password=admin"
;
char
*
findUri
=
const_cast
<
char
*>
(
uri
);
char
net
[
128
];
...
...
pandaAnalysis/CivHydrCalc.cpp
View file @
47d69698
...
...
@@ -91,8 +91,9 @@ bool CivHydrCalc::exportInp(char* fileName)
if
(
!
mDbConn
->
open
())
return
false
;
bool
patren
=
mDbConn
->
createTable
(
PATTERNTABLE
,
"public"
,
CivDbConnection
::
PATTERN_TABLE
);
bool
curve
=
mDbConn
->
createTable
(
CURVETABLE
,
"public"
,
CivDbConnection
::
CURVE_TABLE
);
bool
pattern
=
mDbConn
->
createTable
(
PATTERNTABLE
,
"public"
,
CivDbConnection
::
PATTERN_TABLE
);
bool
cii
=
mDbConn
->
createTable
(
OPTIONTTABLE
,
"public"
,
CivDbConnection
::
PARAMETER_TABLE
);
// 获取表格
Tables
tables
=
mDbConn
->
getTables
(
mNetname
);
...
...
@@ -111,14 +112,7 @@ bool CivHydrCalc::exportInp(char* fileName)
}
assemble
(
PIPELINE
,
civInp
);
// 设置模式
Componets
patterns
=
mDbConn
->
getComponets
(
PATTERNTABLE
);
size_t
patternSize
=
patterns
.
size
();
for
(
int
i
=
0
;
i
<
patternSize
;
i
++
)
{
}
// 设置曲线
Componets
curves
=
mDbConn
->
getComponets
(
CURVETABLE
);
...
...
@@ -245,9 +239,38 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
nodeCoordItem
.
push_back
(
y_coord
);
nodeCoordItems
.
push_back
(
nodeCoordItem
);
if
(
pattern
==
""
)
continue
;
// 蓄水模式
PatternFields
fileds
;
char
where
[
128
]
=
" where "
;
strcat_s
(
where
,
fileds
.
NetName
.
c_str
());
strcat_s
(
where
,
"="
);
strcat_s
(
where
,
mNetname
.
c_str
());
strcat_s
(
where
,
" and "
);
strcat_s
(
where
,
fileds
.
Name
.
c_str
());
strcat_s
(
where
,
"= "
);
strcat_s
(
where
,
pattern
.
c_str
());
Componets
patterns
=
mDbConn
->
getComponetsByWhere
(
PATTERNTABLE
,
where
);
size_t
patternSize
=
patterns
.
size
();
for
(
int
i
=
0
;
i
<
patternSize
;
i
++
)
{
Componet
pattern
=
patterns
[
i
];
Str
paternName
=
pattern
.
find
(
fileds
.
Name
)
->
second
;
Str
paternValue
=
pattern
.
find
(
fileds
.
Value
)
->
second
;
CivItem
item
;
item
.
push_back
(
paternName
);
item
.
push_back
(
paternValue
);
patternItems
.
push_back
(
item
);
}
}
inp
.
writeComponet
(
jounItems
,
_JUNCTIONS
);
inp
.
writeComponet
(
nodeCoordItems
,
_COORDS
);
inp
.
writeComponet
(
patternItems
,
_PATTERNS
);
}
else
if
(
RESIVOIR
==
table
)
// 水源
{
...
...
@@ -421,7 +444,6 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
}
inp
.
writeComponet
(
vavleItems
,
_VALVES
);
}
}
void
CivHydrCalc
::
getNodeResult
(
short
time
)
...
...
pandaDbManager/CivDbConnection.cpp
View file @
47d69698
...
...
@@ -624,7 +624,7 @@ bool CivDbConnection::createTable(StrQuote tableName, StrQuote schema,TableType
{
PatternFields
fileds
;
tableTemp
.
addProperty
(
fileds
.
Name
,
CivTableTemp
::
FILED_VARCHAR
);
tableTemp
.
addProperty
(
fileds
.
Value
,
CivTableTemp
::
FILED_
JSON
);
tableTemp
.
addProperty
(
fileds
.
Value
,
CivTableTemp
::
FILED_
VARCHAR64
);
tableTemp
.
addProperty
(
fileds
.
NetName
,
CivTableTemp
::
FILED_VARCHAR
);
}
break
;
...
...
@@ -637,6 +637,15 @@ bool CivDbConnection::createTable(StrQuote tableName, StrQuote schema,TableType
tableTemp
.
addProperty
(
fileds
.
YCoord
,
CivTableTemp
::
FILED_DOUBLE
);
}
break
;
case
PARAMETER_TABLE
:
{
ParameterFileds
fileds
;
tableTemp
.
addProperty
(
fileds
.
name
,
CivTableTemp
::
FILED_VARCHAR
);
tableTemp
.
addProperty
(
fileds
.
val
,
CivTableTemp
::
FILED_VARCHAR
);
tableTemp
.
addProperty
(
fileds
.
type
,
CivTableTemp
::
FILED_VARCHAR
);
tableTemp
.
addProperty
(
fileds
.
netName
,
CivTableTemp
::
FILED_VARCHAR64
);
}
break
;
default
:
break
;
}
...
...
pandaDbManager/CivDbConnection.h
View file @
47d69698
...
...
@@ -22,7 +22,8 @@ public:
NODE_TABLE
,
// 计算结果点表
PIPE_TABLE
,
// 计算结果线表
PATTERN_TABLE
,
// 模式表
CURVE_TABLE
CURVE_TABLE
,
PARAMETER_TABLE
// 参数表
};
CivDbConnection
(
char
*
uri
);
...
...
pandaDbManager/CivTableTemp.cpp
View file @
47d69698
...
...
@@ -8,6 +8,8 @@ CivTableTemp::CivTableTemp(std::string tableName)
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_INTEGER
,
"integer"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_DOUBLE
,
"double precision"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_VARCHAR
,
"varchar(20)"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_VARCHAR64
,
"varchar(64)"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_VARCHAR128
,
"varchar(20)"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_DATETIME
,
"timestamp"
));
mFieldTyepMap
.
insert
(
std
::
pair
<
FieldType
,
std
::
string
>
(
CivTableTemp
::
FILED_JSON
,
"json"
));
}
...
...
pandaDbManager/CivTableTemp.h
View file @
47d69698
...
...
@@ -25,6 +25,8 @@ public:
FILED_INTEGER
,
FILED_DOUBLE
,
FILED_VARCHAR
,
FILED_VARCHAR64
,
FILED_VARCHAR128
,
FILED_DATETIME
,
FILED_JSON
};
...
...
pandaDbManager/CivTypes.h
View file @
47d69698
...
...
@@ -14,6 +14,7 @@ typedef const std::string& StrQuote;
#define PUMP Str("水泵")
#define PATTERNTABLE Str("__pattern__")
#define CURVETABLE Str("__curve__")
#define OPTIONTTABLE Str("__parameter__")
#define PRV_TYPE Str("稳压阀")
#define PSV_TYPE Str("减压阀")
...
...
@@ -63,7 +64,7 @@ enum PumpParameter
// REACTIONS
// 定义对应于管网中与化学成分反应的参数。
struct
Reactions
{
Str
name
;
};
// [REPORT]
...
...
@@ -159,6 +160,22 @@ struct CurvesFields {
Str
Type
=
"类型"
;
};
// 参数选项表
struct
ParameterFileds
{
Str
name
=
"参数名"
;
Str
val
=
"参数值"
;
Str
type
=
"参数类型"
;
/*
[REACTIONS]
[SOURCES]
[MIXING]
[OPTIONS]
[TIMES]
[REPORT]
*/
Str
netName
=
"管网名"
;
};
// 水池
//[TANKS] ;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
struct
TanksFields
{
...
...
建模文档/水力模型.docx
View file @
47d69698
No preview for this file type
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