Commit 94f736d7 authored by 刘乐's avatar 刘乐

1,水质模拟数据处理

parent 4db5b9f4
...@@ -18,21 +18,21 @@ int main(int argc, char* argv[]) ...@@ -18,21 +18,21 @@ int main(int argc, char* argv[])
char net[128]; char net[128];
char flag[128]; char flag[128];
const char* file = "test.inp"; const char* file = "test.inp";
const char netName[128] = "管网水力模型"; const char netName[128] = "水力模型管网";
strcpy_s(net, "管网水力模型"); strcpy_s(net, "水力模型管网");
strcpy_s(flag, "HDY"); strcpy_s(flag, "QUALITY");
bool msg = simulation(findUri, net, flag); /*bool msg = simulation(findUri, net, flag);
std::cout << msg << std::endl; std::cout << msg << std::endl;*/
/*const char* date = "2020-6-29"; const char* date = "2020-07-01";
char* dates = const_cast<char*>(date); char* dates = const_cast<char*>(date);
const char* interval = "13"; const char* interval = "3";
char* intervals = const_cast<char*>(interval); char* intervals = const_cast<char*>(interval);
bool isSucces = getDataByInterval(findUri, dates, intervals); bool isSucces = getDataByInterval(findUri, dates, intervals);
std::cout << isSucces << std::endl;*/ std::cout << isSucces << std::endl;
getchar(); getchar();
return 0; return 0;
......
...@@ -81,7 +81,7 @@ void CivInpBuilder::buildEmitter() ...@@ -81,7 +81,7 @@ void CivInpBuilder::buildEmitter()
CivNewInp* CivInpBuilder::getNewInp() CivNewInp* CivInpBuilder::getNewInp()
{ {
return mNewInp;
} }
void CivInpBuilder::buildPatterns() void CivInpBuilder::buildPatterns()
......
...@@ -311,6 +311,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp) ...@@ -311,6 +311,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
CivItem civItem; CivItem civItem;
if(id==""||id.empty()) if(id==""||id.empty())
id = "GD" + comp.find("id")->second; id = "GD" + comp.find("id")->second;
civItem.push_back(id); civItem.push_back(id);
civItem.push_back(startNode); civItem.push_back(startNode);
civItem.push_back(endNode); civItem.push_back(endNode);
...@@ -335,6 +336,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp) ...@@ -335,6 +336,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
Civitems jounItems; Civitems jounItems;
Civitems nodeCoordItems; Civitems nodeCoordItems;
Civitems patternItems; Civitems patternItems;
Civitems initQaulityItems;
int total = comps.size(); int total = comps.size();
std::set<Str> patterNams; std::set<Str> patterNams;
...@@ -369,7 +371,14 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp) ...@@ -369,7 +371,14 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
{ {
patterNams.insert(pattern); patterNams.insert(pattern);
} }
// 初始水质
Str initQual = comp.find(jontionFields.InitQual)->second;
CivItem initQualItem;
initQualItem.push_back(id);
initQualItem.push_back(initQual);
initQaulityItems.push_back(initQualItem);
} }
Componets patterns = mDbConn->getComponets(PATTERNTABLE); Componets patterns = mDbConn->getComponets(PATTERNTABLE);
...@@ -390,6 +399,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp) ...@@ -390,6 +399,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
inp.writeComponet(jounItems,_JUNCTIONS); inp.writeComponet(jounItems,_JUNCTIONS);
inp.writeComponet(nodeCoordItems, _COORDS); inp.writeComponet(nodeCoordItems, _COORDS);
inp.writeComponet(patternItems, _PATTERNS); inp.writeComponet(patternItems, _PATTERNS);
inp.writeComponet(initQaulityItems, _QUALITY);
} }
else if (RESIVOIR == table) // 水源 else if (RESIVOIR == table) // 水源
{ {
...@@ -704,27 +714,24 @@ void CivHydrCalc::getLinkQuality(short time) ...@@ -704,27 +714,24 @@ void CivHydrCalc::getLinkQuality(short time)
{ {
int nLinkCount; int nLinkCount;
ENgetcount(EN_LINKCOUNT, &nLinkCount); ENgetcount(EN_LINKCOUNT, &nLinkCount);
int* typeCode = (int*)malloc(sizeof(int));
float* quality = (float*)malloc(sizeof(float));
for (int i = 1; i <= nLinkCount; i++) for (int i = 1; i <= nLinkCount; i++)
{ {
int* typeCode = (int*)malloc(sizeof(int));
ENgetlinktype(i, typeCode); ENgetlinktype(i, typeCode);
if (*typeCode != EN_PIPE) if (*typeCode != EN_PIPE)
{ {
free(typeCode);
continue; continue;
} }
free(typeCode);
char lnkNo[35]; char lnkNo[35];
// 编号 // 编号
ENgetlinkid(i, lnkNo); ENgetlinkid(i, lnkNo);
float* quality =(float*) malloc(sizeof(float));
// 水质
ENgetlinkvalue(i, EN_LINKQUAL, quality);
mResultCache.addLinkQuality(*quality, time, lnkNo); // 水质
free(quality); ENgetlinkvalue(i, EN_LINKQUAL, quality);
mResultCache.addLinkQuality(*quality, time, lnkNo);
} }
free(typeCode);
free(quality);
} }
...@@ -255,8 +255,8 @@ bool CivDbConnection::updateNodeByInterval(StrQuote currDate, StrQuote interval) ...@@ -255,8 +255,8 @@ bool CivDbConnection::updateNodeByInterval(StrQuote currDate, StrQuote interval)
<< ")=( " << ")=( "
<< "tb2." << TransUTFCoding(filedNames.dHead) << "," << "tb2." << TransUTFCoding(filedNames.dHead) << ","
<< "tb2." << TransUTFCoding(filedNames.dPressure) << "," << "tb2." << TransUTFCoding(filedNames.dPressure) << ","
<< "tb2." << TransUTFCoding(filedNames.dQuality) << "," << "tb2." << TransUTFCoding(filedNames.dDemand) << ","
<< "tb2." << TransUTFCoding(filedNames.dDemand) << ")" << " from " << "tb2." << TransUTFCoding(filedNames.dQuality) << ")" << " from "
<< TransUTFCoding(NODERESULTTABLE) << " AS tb2 where tb1." << TransUTFCoding(NODERESULTTABLE) << " AS tb2 where tb1."
<< TransUTFCoding(filedNames.Number) << "= tb2." << TransUTFCoding(filedNames.Number) << "= tb2."
<< TransUTFCoding(filedNames.Number) << " AND tb2." << TransUTFCoding(filedNames.Number) << " AND tb2."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment