| 581 | } |
| 582 | |
| 583 | boost::optional<double> Surface_Impl::uFactor() const { |
| 584 | OptionalConstructionBase oConstruction = construction(); |
| 585 | OptionalDouble result; |
| 586 | |
| 587 | if (oConstruction) { |
| 588 | // from input |
| 589 | OptionalDouble inputResult = oConstruction->uFactor(filmResistance()); |
| 590 | |
| 591 | // from output |
| 592 | OptionalSqlFile sqlFile = model().sqlFile(); |
| 593 | OptionalString constructionName = oConstruction->name(); |
| 594 | OptionalDouble outputResult; |
| 595 | OptionalString surfaceName = name(); |
| 596 | |
| 597 | // opaque exterior |
| 598 | if (sqlFile && constructionName && oConstruction->isOpaque()) { |
| 599 | std::string query = R"(SELECT Value from TabularDataWithStrings |
| 600 | WHERE ReportName = 'EnvelopeSummary' |
| 601 | AND ReportForString = 'Entire Facility' |
| 602 | AND TableName = 'Opaque Exterior' |
| 603 | AND ColumnName = 'U-Factor with Film' |
| 604 | AND Units='W/m2-K' |
| 605 | AND RowName = ?;)"; |
| 606 | outputResult = sqlFile->execAndReturnFirstDouble(query, to_upper_copy(*surfaceName)); |
| 607 | } |
| 608 | |
| 609 | // fenestration |
| 610 | if (sqlFile && constructionName && oConstruction->isFenestration()) { |
| 611 | std::string query = R"(SELECT Value from TabularDataWithStrings |
| 612 | WHERE ReportName = 'EnvelopeSummary' |
| 613 | AND ReportForString = 'Entire Facility' |
| 614 | AND TableName = 'Exterior Fenestration' |
| 615 | AND ColumnName = 'Glass U-Factor' |
| 616 | AND Units='W/m2-K' |
| 617 | AND RowName = ?;)"; |
| 618 | outputResult = sqlFile->execAndReturnFirstDouble(query, to_upper_copy(*surfaceName)); |
| 619 | } |
| 620 | |
| 621 | if (inputResult) { |
| 622 | result = inputResult; |
| 623 | if (outputResult) { |
| 624 | compareInputAndOutput(*oConstruction, "uFactor", *inputResult, *outputResult, 1.0E-3); |
| 625 | } |
| 626 | } else { |
| 627 | result = outputResult; |
| 628 | } |
| 629 | } |
| 630 | |
| 631 | return result; |
| 632 | } |
| 633 | |
| 634 | boost::optional<double> Surface_Impl::thermalConductance() const { |
| 635 | OptionalConstructionBase oConstruction = construction(); |