@@ -424,7 +424,7 @@ class doTableOnPath : public IDoTable
424424 QDomNode nd = nodes.at (idx);
425425 QDomElement element = nd.toElement ();
426426
427- if (element.tagName () == " WholeNetEnergyConsumptionRefPerArea " ){
427+ if (element.tagName () == " WholeNetEnergyConsumptionPerArea " ){
428428 bool isOK = false ;
429429 WholeNetEnergyConsumptionPerArea = element.text ().toDouble (&isOK);
430430 if (!isOK){
@@ -625,7 +625,17 @@ static openstudio::path resourcesPath()
625625 }
626626}
627627
628- static bool doBecReport (const QString &path, QString& outpath, QString &err){
628+ static QDomElement createTagWithText (QDomDocument* doc, QDomElement &parent, const QString &tag, const QString &text)
629+ {
630+ QDomElement elm = doc->createElement (tag);
631+ if (!text.isEmpty ())
632+ elm.appendChild (doc->createTextNode (text.toUtf8 ()));
633+
634+ parent.appendChild (elm);
635+ return elm;
636+ }
637+
638+ static bool doBecReport (const QString &path, QString& outpath, QString &err, float wwr_total){
629639 QDomDocument doc (" becreport" );
630640
631641 QFileInfo fi (path);
@@ -714,6 +724,15 @@ background-color: #ffff99;\n\
714724
715725 QDomElement docElem = doc.documentElement ();
716726 // doTable(docElem.tagName(), docElem, file, 0);
727+
728+ QDomElement ottvReport = findElementOnPath (docElem, QStringList () << " EnvelopeSystem" << " BuildingOTTVReport" );
729+ if (!ottvReport.isNull ()){
730+ QString str = ottvReport.toDocument ().toString ();
731+ str = str + " xxxx" ;
732+ createTagWithText (&doc, ottvReport, " WWR" , QString::number (wwr_total));
733+ createTagWithText (&doc, ottvReport, " WWRUnit" , " A/C" );
734+ }
735+
717736 QString tables = doTableV2 (docElem);
718737 file.write (tables.toUtf8 ());
719738
@@ -1015,7 +1034,7 @@ bool RunView::doBecInput(const QString &path, const model::Model &model, QString
10151034 m_outputWindow->appendPlainText (QString (" Create input.xml at %1" ).arg (path));
10161035
10171036 std::string bvn;
1018- bool success = trans.modelTobec (model, path.toStdString ().c_str (), NULL , &bvn, &sunlits);
1037+ bool success = trans.modelTobec (model, path.toStdString ().c_str (), NULL , &bvn, &sunlits, wwr_totoal );
10191038 bvName = bvn.c_str ();
10201039
10211040 std::string bvsdefault = resourcesPath ().string () + " /" + " default_building_standard.bvs" ;
@@ -1653,11 +1672,13 @@ void RunView::playButtonClicked(bool t_checked)
16531672 // ////////////////////////
16541673 QFile file (outpath+" ../5-EnergyPlus-0/eplustbl.htm" );
16551674 sunlits.clear ();
1675+ wwr_totoal = 0 .0f ;
16561676 if (file.open (QIODevice::ReadOnly | QIODevice::Text))
16571677 {
16581678 m_outputWindow->appendHtml (QString (" <font color=\" blue\" >Start read eblustbl.htm</font>" ));
16591679 QTextStream in (&file);
16601680 QString str = in.readAll ();
1681+ QString gwstr = str;
16611682 int start = str.indexOf (" <b>Sunlit Fraction</b>" );
16621683 int table_start_idx = str.indexOf (" <table" , start);
16631684 int table_end_idx = str.indexOf (" </table>" , table_start_idx+6 );
@@ -1691,6 +1712,30 @@ void RunView::playButtonClicked(bool t_checked)
16911712 m_outputWindow->appendHtml (QString (" <font color=\" green\" >%1</font>\n " ).arg (msg));
16921713 }
16931714 m_outputWindow->appendHtml (QString (" <font color=\" blue\" >SF:%1</font>" ).arg (QString::number (sunlits.size ())));
1715+
1716+ // Read Conditioned Window-Wall Ratio --> Gross Window-Wall Ratio [%] --> <td align="right"> 35.20</td>
1717+ int idx_of_wwrAll = gwstr.indexOf (" Conditioned Window-Wall Ratio" );
1718+ int idx_of_wwrAll_end = -1 ;
1719+ if (idx_of_wwrAll > -1 ){
1720+ idx_of_wwrAll = gwstr.indexOf (" Gross Window-Wall Ratio [%]" , idx_of_wwrAll);
1721+ const QString tdBegin (" <td align=\" right\" > " );
1722+ const QString tdEnd (" </td>" );
1723+ idx_of_wwrAll = gwstr.indexOf (tdBegin, idx_of_wwrAll);
1724+ if (idx_of_wwrAll > -1 ){
1725+ idx_of_wwrAll += tdBegin.length ();
1726+ idx_of_wwrAll_end = gwstr.indexOf (tdEnd, idx_of_wwrAll);
1727+ m_outputWindow->appendHtml (QString (" idx0:%1, idx1:%2" ).arg (idx_of_wwrAll).arg (idx_of_wwrAll_end));
1728+ if (idx_of_wwrAll_end > -1 ){
1729+ gwstr = gwstr.mid (idx_of_wwrAll, idx_of_wwrAll_end - idx_of_wwrAll);
1730+ m_outputWindow->appendHtml (QString (" gwstr:[%1]" ).arg (gwstr));
1731+ gwstr = gwstr.trimmed ();
1732+ wwr_totoal = gwstr.toFloat ();
1733+ wwr_totoal = wwr_totoal/100 .0f ;
1734+ m_outputWindow->appendHtml (QString (" wwr_totoal:[%1]" ).arg (wwr_totoal));
1735+ m_outputWindow->appendHtml (QString (" <font color=\" blue\" ><b>wwr totoal:%1</b></font>" ).arg (gwstr));
1736+ }
1737+ }
1738+ }
16941739 }else {
16951740 m_outputWindow->appendHtml (QString (" <font color=\" red\" >ERROR:Can't read eblustbl.htm</font>" ));
16961741 }
@@ -1848,7 +1893,7 @@ void RunView::becFinished(int exitCode, QProcess::ExitStatus exitStatus)
18481893 m_outputWindow->appendPlainText (" BEC Finished." );
18491894 m_outputWindow->appendPlainText (" Generate Report." );
18501895 QString outpath, err;
1851- if (!doBecReport (becoutputPath, outpath, err)){
1896+ if (!doBecReport (becoutputPath, outpath, err, wwr_totoal )){
18521897 m_outputWindow->appendPlainText (" Error BEC Report." );
18531898 m_outputWindow->appendPlainText (err);
18541899 }
0 commit comments