Skip to content

Commit 0e5d07f

Browse files
committed
Fix missing case for power pu.
1 parent e25eda8 commit 0e5d07f

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

openstudiocore/src/bec/ForwardTranslator.cpp

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,20 +1478,34 @@ void ForwardTranslator::DoSupply(std::vector<model::ModelObject>& supplys
14781478

14791479
for(size_t i=0;i<supplys.size();i++){
14801480
model::ModelObject & hvac = supplys.at(i);
1481+
14811482
if(isSkip(hvac)){
14821483
continue;
14831484
}
14841485

1485-
qDebug() << QString("[%5]--------------- supply:'%1', name:'%2', listname:'%3', relation[%4]")
1486+
qDebug() << QString("[==]--------------- iddobj:'%1', name:'%2', listname:'%3', relation[%4], supply:%5")
14861487
.arg(hvac.iddObject().name().c_str())
14871488
.arg(hvac.name().get().c_str())
14881489
.arg(listName.c_str())
1489-
.arg(i);
1490+
.arg(i)
1491+
.arg(supplys.size());
1492+
1493+
//"[==]--------------- iddobj:'OS:Coil:Cooling:Water', name:'1AHU-01', listname:'Thai Chilled Water Loop', relation[3], supply:22"
1494+
// case openstudio::IddObjectType::OS_Coil_Cooling_Water:
1495+
1496+
if(hvac.iddObject().type().value() == openstudio::IddObjectType::OS_Coil_Cooling_Water
1497+
&& listName.find("Air Loop") == std::string::npos){
1498+
qDebug() << "NOTE:Coil Cooling Water is on " << listName.c_str();
1499+
continue;
1500+
}
14901501

14911502
QString cname = hvac.name().get().c_str();
1492-
if(subitemDuplicate.contains(cname))
1503+
if(subitemDuplicate.contains(cname)){
1504+
qDebug() << "IS DUPLATEED:" << cname;
14931505
continue;
1506+
}
14941507
else{
1508+
qDebug() << "ADD DUPLATE:" << cname;
14951509
subitemDuplicate.insert(cname, true);
14961510
}
14971511

@@ -1603,32 +1617,32 @@ void ForwardTranslator::DoSupply(std::vector<model::ModelObject>& supplys
16031617
}
16041618
case openstudio::IddObjectType::OS_Coil_Cooling_Water:
16051619
{
1606-
// TODO 004 COOLING TOWER
1620+
1621+
// TODO 004 COOLING TOWER
16071622
model::CoilCoolingWater coolw = hvac.cast<model::CoilCoolingWater>();
16081623
QString name = coolw.name().get().c_str();
1609-
size_t inx = i+1;
1624+
size_t inx = 0;
16101625
double power=0.0;
16111626
while(inx < supplys.size()){
1612-
model::ModelObject & nextItem = supplys.at(inx);
1627+
model::ModelObject & nextItem = supplys.at(inx);
1628+
qDebug() << "---------------- loop on supply:" << coolw.name().get().c_str() << ":" << nextItem.name().get().c_str() << "----------------" << QString::number(inx) << "\n";
16131629
if(isSkip(nextItem)){
1614-
inx++;
1630+
16151631
}else{
16161632
if(nextItem.iddObject().type().value() == openstudio::IddObjectType::OS_Fan_VariableVolume){
1633+
qDebug() << "!!! FOUND FOUND !!!! >> " << nextItem.name().get().c_str() << "\n";
16171634
model::FanVariableVolume fanv = nextItem.cast<model::FanVariableVolume>();
16181635
//name = QString("%1 And %2").arg(name).arg(fanv.name().get().c_str());
16191636
double maximumFlowRate = fanv.maximumFlowRate().get_value_or(1.0f);
16201637
double rfanv = fanv.fanEfficiency();
16211638

1622-
if(rfanv==0.0)
1623-
continue;
1624-
1625-
power = (maximumFlowRate*fanv.pressureRise())/(rfanv*1000);
1626-
i = inx;
1627-
}else{
1628-
i = inx-1;
1639+
if (rfanv != 0.0){
1640+
power += (maximumFlowRate*fanv.pressureRise()) / (rfanv * 1000);
1641+
qDebug() << "!!! POWER >>>>> " << QString::number(power) << "\n";
1642+
}
16291643
}
1630-
break;
16311644
}
1645+
inx++;
16321646
}
16331647

16341648
qDebug() << "\n\n\n\nname:" << coolw.name().get().c_str();
@@ -1671,7 +1685,7 @@ void ForwardTranslator::DoSupply(std::vector<model::ModelObject>& supplys
16711685
boost::optional<model::PlantLoop> attLoop = coolw.plantLoop();
16721686
if(attLoop){
16731687
std::string strname = attLoop.get().name().get();
1674-
qDebug() << "ccc Do air loop at ccc " << QString("%1:%2").arg(loopName.c_str()).arg(strname.c_str()) << ":" <<__LINE__;
1688+
qDebug() << "ccc Do air loop at ccc " << QString("%1:%2").arg(attLoop->name().get().c_str()).arg(strname.c_str()) << ":" << __LINE__;
16751689
nextPlantLoopHavc.push_back(attLoop);
16761690
}
16771691

@@ -1897,9 +1911,9 @@ void ForwardTranslator::doAirLoop(QDomElement& CentralACList
18971911
, QHash<QString, bool>& duplicate
18981912
, QHash<QString, bool>& subitemDuplicate)
18991913
{
1900-
qDebug() << "SSSSSSSSSSSSSSSSSSS start imcomming to ForwardTranslator::doAirLoop";
19011914
QString listName = loop->name().get().c_str();
19021915
QString baseLoop = listName;
1916+
qDebug() << "SSSSSSSSSSSSSSSSSSS start doAirLoop:" << baseLoop;
19031917

19041918
if(listName.indexOf("Condenser") >= 0){
19051919
qDebug() << "Break here..." << listName << ", baseloop:" << baseLoop;
@@ -1910,6 +1924,7 @@ void ForwardTranslator::doAirLoop(QDomElement& CentralACList
19101924
}
19111925
else{
19121926
duplicate.insert(listName, true);
1927+
qDebug() << "Add duplicate list name:" << listName << ", baseloop:" << baseLoop;
19131928
if(listName.indexOf("Chilled ")>=0){
19141929
QDomElement CentralACL = createTagWithText(CentralACList, "CentralACL");
19151930
createTagWithText(CentralACL, "CentralACListName", GenParantLoopName(listName));

0 commit comments

Comments
 (0)