void SiteWaterMainsTemperature_Impl::populateValidityReport(ValidityReport& report,bool checkNames) const {
    // Inherit lower-level errors
    ModelObject_Impl::populateValidityReport(report,checkNames);

    if (report.level() > StrictnessLevel::Draft) {
        boost::optional<IddKey> key = iddObject().getField(OS_Site_WaterMainsTemperatureFields::CalculationMethod).get().getKey(calculationMethod());
        OS_ASSERT(key);
        if (key->name() == "Schedule") {
            if (!temperatureSchedule()) {
                report.insertError(DataError(OS_Site_WaterMainsTemperatureFields::TemperatureScheduleName,
                                             getObject<ModelObject>(),
                                             DataErrorType::NullAndRequired));
            }
        }
        else {
            // Correlation
            if (!annualAverageOutdoorAirTemperature()) {
                report.insertError(DataError(OS_Site_WaterMainsTemperatureFields::AnnualAverageOutdoorAirTemperature,
                                             getObject<ModelObject>(),
                                             DataErrorType::NullAndRequired));
            }
            if (!maximumDifferenceInMonthlyAverageOutdoorAirTemperatures()) {
                report.insertError(DataError(OS_Site_WaterMainsTemperatureFields::MaximumDifferenceInMonthlyAverageOutdoorAirTemperatures,
                                             getObject<ModelObject>(),
                                             DataErrorType::NullAndRequired));
            }
        }
    }
}
Beispiel #2
0
  void GasMixture_Impl::populateValidityReport(ValidityReport& report,bool checkNames) const {
    // Inherit lower-level errors
    ModelObject_Impl::populateValidityReport(report,checkNames);

    if (report.level() == StrictnessLevel::Final) {
      // all gases must be defined
      for (unsigned i = 0, n = numGases(); i < n; ++i) {
        try {
          std::string type = getGasType(i);
        }
        catch (...) {
          report.insertError(DataError(mf_getGasTypeFieldIndex(i),
                                       getObject<GasMixture>(),
                                       DataErrorType::NullAndRequired));
        }
        try {
          /* double fraction =*/ getGasFraction(i);
        }
        catch (...) {
          report.insertError(DataError(mf_getGasFractionFieldIndex(i),
                                       getObject<GasMixture>(),
                                       DataErrorType::NullAndRequired));
        }
      }
    }
  }