Commit 3f06f4e3 authored by 刘乐's avatar 刘乐
parents 728da546 94f736d7
......@@ -18,21 +18,21 @@ int main(int argc, char* argv[])
char net[128];
char flag[128];
const char* file = "test.inp";
const char netName[128] = "管网水力模型";
const char netName[128] = "水力模型管网";
strcpy_s(net, "管网水力模型");
strcpy_s(flag, "HDY");
strcpy_s(net, "水力模型管网");
strcpy_s(flag, "QUALITY");
bool msg = simulation(findUri, net, flag);
std::cout << msg << std::endl;
/*bool msg = simulation(findUri, net, flag);
std::cout << msg << std::endl;*/
/*const char* date = "2020-6-29";
const char* date = "2020-07-01";
char* dates = const_cast<char*>(date);
const char* interval = "13";
const char* interval = "3";
char* intervals = const_cast<char*>(interval);
bool isSucces = getDataByInterval(findUri, dates, intervals);
std::cout << isSucces << std::endl;*/
std::cout << isSucces << std::endl;
getchar();
return 0;
......
......@@ -84,7 +84,7 @@ void CivInpBuilder::buildEmitter()
CivNewInp* CivInpBuilder::getNewInp()
{
return mNewInp;
}
void CivInpBuilder::buildPatterns()
......
......@@ -311,6 +311,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
CivItem civItem;
if(id==""||id.empty())
id = "GD" + comp.find("id")->second;
civItem.push_back(id);
civItem.push_back(startNode);
civItem.push_back(endNode);
......@@ -335,6 +336,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
Civitems jounItems;
Civitems nodeCoordItems;
Civitems patternItems;
Civitems initQaulityItems;
int total = comps.size();
std::set<Str> patterNams;
......@@ -370,6 +372,13 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
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);
......@@ -390,6 +399,7 @@ void CivHydrCalc::assemble(const std::string& table, CivInp& inp)
inp.writeComponet(jounItems,_JUNCTIONS);
inp.writeComponet(nodeCoordItems, _COORDS);
inp.writeComponet(patternItems, _PATTERNS);
inp.writeComponet(initQaulityItems, _QUALITY);
}
else if (RESIVOIR == table) // 水源
{
......@@ -704,27 +714,24 @@ void CivHydrCalc::getLinkQuality(short time)
{
int nLinkCount;
ENgetcount(EN_LINKCOUNT, &nLinkCount);
int* typeCode = (int*)malloc(sizeof(int));
float* quality = (float*)malloc(sizeof(float));
for (int i = 1; i <= nLinkCount; i++)
{
int* typeCode = (int*)malloc(sizeof(int));
ENgetlinktype(i, typeCode);
if (*typeCode != EN_PIPE)
{
free(typeCode);
continue;
}
free(typeCode);
char lnkNo[35];
// 编号
ENgetlinkid(i, lnkNo);
float* quality =(float*) malloc(sizeof(float));
// 水质
ENgetlinkvalue(i, EN_LINKQUAL, quality);
mResultCache.addLinkQuality(*quality, time, lnkNo);
free(quality);
}
free(typeCode);
free(quality);
}
......@@ -255,8 +255,8 @@ bool CivDbConnection::updateNodeByInterval(StrQuote currDate, StrQuote interval)
<< ")=( "
<< "tb2." << TransUTFCoding(filedNames.dHead) << ","
<< "tb2." << TransUTFCoding(filedNames.dPressure) << ","
<< "tb2." << TransUTFCoding(filedNames.dQuality) << ","
<< "tb2." << TransUTFCoding(filedNames.dDemand) << ")" << " from "
<< "tb2." << TransUTFCoding(filedNames.dDemand) << ","
<< "tb2." << TransUTFCoding(filedNames.dQuality) << ")" << " from "
<< TransUTFCoding(NODERESULTTABLE) << " AS tb2 where tb1."
<< TransUTFCoding(filedNames.Number) << "= 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