void EnergyPlusPreProcessJob::startImpl(const boost::shared_ptr<ProcessCreator> &) { openstudio::path outpath = outdir(); QWriteLocker l(&m_mutex); JobErrors errors; errors.result = ruleset::OSResultValue::Success; try { m_idf = idfFile(); resetFiles(m_files, m_idf); } catch (const std::runtime_error &e) { errors.result = ruleset::OSResultValue::Fail; errors.addError(ErrorType::Error, e.what()); } LOG(Info, "EnergyPlusPreProcess starting, outdir: " << toString(outpath)); l.unlock(); emitStatusChanged(AdvancedStatus(AdvancedStatusEnum::Starting)); emitStarted(); emitStatusChanged(AdvancedStatus(AdvancedStatusEnum::Processing)); if (errors.result == ruleset::OSResultValue::Fail) { setErrors(errors); return; } try { boost::filesystem::create_directories(outdir(true)); bool needssqlobj = false; bool needsmonthlyoutput = false; { boost::optional<openstudio::Workspace> ws = openstudio::Workspace::load(m_idf->fullPath); if (!ws){ LOG_AND_THROW("Unable to load idf into workspace"); } std::vector<openstudio::WorkspaceObject> sqliteobjs = ws->getObjectsByType(IddObjectType::Output_SQLite); if (sqliteobjs.empty()) { // ws->addObject(IdfObject(IddObjectType::Output_SQLite)); needssqlobj = true; // sqliteobjs = ws->getObjectsByType(IddObjectType::Output_SQLite); } if (ws->getObjectsByName("Building Energy Performance - Natural Gas").empty() || ws->getObjectsByName("Building Energy Performance - Electricity").empty() || ws->getObjectsByName("Building Energy Performance - District Heating").empty() || ws->getObjectsByName("Building Energy Performance - District Cooling").empty() ) { needsmonthlyoutput = true; } } if (needssqlobj || needsmonthlyoutput) { openstudio::path outfile = outdir(true)/openstudio::toPath("out.idf"); if (boost::filesystem::exists(outfile)) { try { boost::filesystem::remove(outfile); } catch (const boost::filesystem::basic_filesystem_error<openstudio::path> &e) { LOG(Error, "Error removing existing out.idf file: " + std::string(e.what()) + " continuing with run, if copy_file errors, the process will fail"); } } boost::filesystem::copy_file(m_idf->fullPath, outfile, boost::filesystem::copy_option::overwrite_if_exists); std::ofstream ofs(openstudio::toString(outfile).c_str(), std::ios::app); if (needssqlobj) { ofs << "Output:SQLite," << std::endl; ofs << " SimpleAndTabular; ! Option Type" << std::endl; } if (needsmonthlyoutput) { //energy consumption ofs << "Output:Table:Monthly," << std::endl; ofs << " Building Energy Performance - Electricity, !- Name" << std::endl; ofs << " 2, !- Digits After Decimal" << std::endl; ofs << " InteriorLights:Electricity, !- Variable or Meter 1 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " ExteriorLights:Electricity, !- Variable or Meter 2 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 2" << std::endl; ofs << " InteriorEquipment:Electricity, !- Variable or Meter 3 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 3" << std::endl; ofs << " ExteriorEquipment:Electricity, !- Variable or Meter 4 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 4" << std::endl; ofs << " Fans:Electricity, !- Variable or Meter 5 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 5" << std::endl; ofs << " Pumps:Electricity, !- Variable or Meter 6 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 6" << std::endl; ofs << " Heating:Electricity, !- Variable or Meter 7 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 7" << std::endl; ofs << " Cooling:Electricity, !- Variable or Meter 8 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 8" << std::endl; ofs << " HeatRejection:Electricity, !- Variable or Meter 9 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 9" << std::endl; ofs << " Humidifier:Electricity, !- Variable or Meter 10 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 10" << std::endl; ofs << " HeatRecovery:Electricity,!- Variable or Meter 11 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 11" << std::endl; ofs << " WaterSystems:Electricity,!- Variable or Meter 12 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 12" << std::endl; ofs << " Cogeneration:Electricity,!- Variable or Meter 13 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 13" << std::endl; ofs << " Refrigeration:Electricity,!- Variable or Meter 14 Name" << std::endl; ofs << " SumOrAverage; !- Aggregation Type for Variable or Meter 14" << std::endl; ofs << "Output:Table:Monthly," << std::endl; ofs << " Building Energy Performance - Natural Gas, !- Name" << std::endl; ofs << " 2, !- Digits After Decimal" << std::endl; ofs << " InteriorEquipment:Gas, !- Variable or Meter 1 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " ExteriorEquipment:Gas, !- Variable or Meter 2 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 2" << std::endl; ofs << " Heating:Gas, !- Variable or Meter 3 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 3" << std::endl; ofs << " Cooling:Gas, !- Variable or Meter 4 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 4" << std::endl; ofs << " WaterSystems:Gas, !- Variable or Meter 5 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 5" << std::endl; ofs << " Cogeneration:Gas, !- Variable or Meter 6 Name" << std::endl; ofs << " SumOrAverage; !- Aggregation Type for Variable or Meter 6" << std::endl; ofs << "Output:Table:Monthly," << std::endl; ofs << " Building Energy Performance - District Heating, !- Name" << std::endl; ofs << " 2, !- Digits After Decimal" << std::endl; ofs << " InteriorLights:DistrictHeating, !- Variable or Meter 1 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " ExteriorLights:DistrictHeating, !- Variable or Meter 2 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 2" << std::endl; ofs << " InteriorEquipment:DistrictHeating, !- Variable or Meter 3 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 3" << std::endl; ofs << " ExteriorEquipment:DistrictHeating, !- Variable or Meter 4 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 4" << std::endl; ofs << " Fans:DistrictHeating, !- Variable or Meter 5 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 5" << std::endl; ofs << " Pumps:DistrictHeating, !- Variable or Meter 6 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 6" << std::endl; ofs << " Heating:DistrictHeating, !- Variable or Meter 7 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 7" << std::endl; ofs << " Cooling:DistrictHeating, !- Variable or Meter 8 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 8" << std::endl; ofs << " HeatRejection:DistrictHeating, !- Variable or Meter 9 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 9" << std::endl; ofs << " Humidifier:DistrictHeating, !- Variable or Meter 10 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 10" << std::endl; ofs << " HeatRecovery:DistrictHeating,!- Variable or Meter 11 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 11" << std::endl; ofs << " WaterSystems:DistrictHeating,!- Variable or Meter 12 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 12" << std::endl; ofs << " Cogeneration:DistrictHeating,!- Variable or Meter 13 Name" << std::endl; ofs << " SumOrAverage; !- Aggregation Type for Variable or Meter 13" << std::endl; ofs << "Output:Table:Monthly," << std::endl; ofs << " Building Energy Performance - District Cooling, !- Name" << std::endl; ofs << " 2, !- Digits After Decimal" << std::endl; ofs << " InteriorLights:DistrictCooling, !- Variable or Meter 1 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " ExteriorLights:DistrictCooling, !- Variable or Meter 2 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 2" << std::endl; ofs << " InteriorEquipment:DistrictCooling, !- Variable or Meter 3 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 3" << std::endl; ofs << " ExteriorEquipment:DistrictCooling, !- Variable or Meter 4 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 4" << std::endl; ofs << " Fans:DistrictCooling, !- Variable or Meter 5 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 5" << std::endl; ofs << " Pumps:DistrictCooling, !- Variable or Meter 6 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 6" << std::endl; ofs << " Heating:DistrictCooling, !- Variable or Meter 7 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 7" << std::endl; ofs << " Cooling:DistrictCooling, !- Variable or Meter 8 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 8" << std::endl; ofs << " HeatRejection:DistrictCooling, !- Variable or Meter 9 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 9" << std::endl; ofs << " Humidifier:DistrictCooling, !- Variable or Meter 10 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 10" << std::endl; ofs << " HeatRecovery:DistrictCooling,!- Variable or Meter 11 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 11" << std::endl; ofs << " WaterSystems:DistrictCooling,!- Variable or Meter 12 Name" << std::endl; ofs << " SumOrAverage, !- Aggregation Type for Variable or Meter 12" << std::endl; ofs << " Cogeneration:DistrictCooling,!- Variable or Meter 13 Name" << std::endl; ofs << " SumOrAverage; !- Aggregation Type for Variable or Meter 13" << std::endl; //energy demand ofs << "Output:Table:Monthly," << std::endl; ofs << " Building Energy Performance - Electricity Peak Demand, !- Name" << std::endl; ofs << " 2, !- Digits After Decimal" << std::endl; ofs << " Electricity:Facility, !- Variable or Meter 1 Name" << std::endl; ofs << " Maximum, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " InteriorLights:Electricity, !- Variable or Meter 1 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " ExteriorLights:Electricity, !- Variable or Meter 2 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 2" << std::endl; ofs << " InteriorEquipment:Electricity, !- Variable or Meter 3 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 3" << std::endl; ofs << " ExteriorEquipment:Electricity, !- Variable or Meter 4 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 4" << std::endl; ofs << " Fans:Electricity, !- Variable or Meter 5 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 5" << std::endl; ofs << " Pumps:Electricity, !- Variable or Meter 6 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 6" << std::endl; ofs << " Heating:Electricity, !- Variable or Meter 7 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 7" << std::endl; ofs << " Cooling:Electricity, !- Variable or Meter 8 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 8" << std::endl; ofs << " HeatRejection:Electricity, !- Variable or Meter 9 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 9" << std::endl; ofs << " Humidifier:Electricity, !- Variable or Meter 10 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 10" << std::endl; ofs << " HeatRecovery:Electricity,!- Variable or Meter 11 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 11" << std::endl; ofs << " WaterSystems:Electricity,!- Variable or Meter 12 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 12" << std::endl; ofs << " Cogeneration:Electricity,!- Variable or Meter 13 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum; !- Aggregation Type for Variable or Meter 13" << std::endl; ofs << "Output:Table:Monthly," << std::endl; ofs << " Building Energy Performance - Natural Gas Peak Demand, !- Name" << std::endl; ofs << " 2, !- Digits After Decimal" << std::endl; ofs << " Gas:Facility, !- Variable or Meter 1 Name" << std::endl; ofs << " Maximum, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " InteriorEquipment:Gas, !- Variable or Meter 1 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " ExteriorEquipment:Gas, !- Variable or Meter 2 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 2" << std::endl; ofs << " Heating:Gas, !- Variable or Meter 3 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 3" << std::endl; ofs << " Cooling:Gas, !- Variable or Meter 4 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 4" << std::endl; ofs << " WaterSystems:Gas, !- Variable or Meter 5 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 5" << std::endl; ofs << " Cogeneration:Gas, !- Variable or Meter 6 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum; !- Aggregation Type for Variable or Meter 6" << std::endl; ofs << "Output:Table:Monthly," << std::endl; ofs << " Building Energy Performance - District Heating Peak Demand, !- Name" << std::endl; ofs << " 2, !- Digits After Decimal" << std::endl; ofs << " DistrictHeating:Facility, !- Variable or Meter 1 Name" << std::endl; ofs << " Maximum, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " InteriorLights:DistrictHeating, !- Variable or Meter 1 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " ExteriorLights:DistrictHeating, !- Variable or Meter 2 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 2" << std::endl; ofs << " InteriorEquipment:DistrictHeating, !- Variable or Meter 3 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 3" << std::endl; ofs << " ExteriorEquipment:DistrictHeating, !- Variable or Meter 4 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 4" << std::endl; ofs << " Fans:DistrictHeating, !- Variable or Meter 5 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 5" << std::endl; ofs << " Pumps:DistrictHeating, !- Variable or Meter 6 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 6" << std::endl; ofs << " Heating:DistrictHeating, !- Variable or Meter 7 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 7" << std::endl; ofs << " Cooling:DistrictHeating, !- Variable or Meter 8 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 8" << std::endl; ofs << " HeatRejection:DistrictHeating, !- Variable or Meter 9 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 9" << std::endl; ofs << " Humidifier:DistrictHeating, !- Variable or Meter 10 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 10" << std::endl; ofs << " HeatRecovery:DistrictHeating,!- Variable or Meter 11 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 11" << std::endl; ofs << " WaterSystems:DistrictHeating,!- Variable or Meter 12 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 12" << std::endl; ofs << " Cogeneration:DistrictHeating,!- Variable or Meter 13 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum; !- Aggregation Type for Variable or Meter 13" << std::endl; ofs << "Output:Table:Monthly," << std::endl; ofs << " Building Energy Performance - District Cooling Peak Demand, !- Name" << std::endl; ofs << " 2, !- Digits After Decimal" << std::endl; ofs << " DistrictCooling:Facility, !- Variable or Meter 1 Name" << std::endl; ofs << " Maximum, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " InteriorLights:DistrictCooling, !- Variable or Meter 1 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 1" << std::endl; ofs << " ExteriorLights:DistrictCooling, !- Variable or Meter 2 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 2" << std::endl; ofs << " InteriorEquipment:DistrictCooling, !- Variable or Meter 3 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 3" << std::endl; ofs << " ExteriorEquipment:DistrictCooling, !- Variable or Meter 4 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 4" << std::endl; ofs << " Fans:DistrictCooling, !- Variable or Meter 5 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 5" << std::endl; ofs << " Pumps:DistrictCooling, !- Variable or Meter 6 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 6" << std::endl; ofs << " Heating:DistrictCooling, !- Variable or Meter 7 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 7" << std::endl; ofs << " Cooling:DistrictCooling, !- Variable or Meter 8 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 8" << std::endl; ofs << " HeatRejection:DistrictCooling, !- Variable or Meter 9 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 9" << std::endl; ofs << " Humidifier:DistrictCooling, !- Variable or Meter 10 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 10" << std::endl; ofs << " HeatRecovery:DistrictCooling,!- Variable or Meter 11 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 11" << std::endl; ofs << " WaterSystems:DistrictCooling,!- Variable or Meter 12 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 12" << std::endl; ofs << " Cogeneration:DistrictCooling,!- Variable or Meter 13 Name" << std::endl; ofs << " ValueWhenMaximumOrMinimum; !- Aggregation Type for Variable or Meter 13" << std::endl; } //timestep-level utility demand by fuel type to calculate demand ofs << " Output:Meter,Electricity:Facility,Timestep; !- [J]" << std::endl; ofs << " Output:Meter,Gas:Facility,Timestep; !- [J]" << std::endl; ofs << " Output:Meter,DistrictCooling:Facility,Timestep; !- [J]" << std::endl; ofs << " Output:Meter,DistrictHeating:Facility,Timestep; !- [J]" << std::endl; ofs.flush(); ofs.close(); } } catch (const std::exception &e) { LOG(Error, "Error with EnergyPlusPreProcessJob: " + std::string(e.what())); errors.addError(ErrorType::Error, "Error with EnergyPlusPreProcessJob: " + std::string(e.what())); errors.result = ruleset::OSResultValue::Fail; } emitOutputFileChanged(RunManager_Util::dirFile(outpath / openstudio::toPath("out.idf"))); setErrors(errors); }
void IdfToModelJob::startImpl(const std::shared_ptr<ProcessCreator> &) { openstudio::path outpath = outdir(true); QWriteLocker l(&m_mutex); if (!m_idf) { m_idf = idfFile(); resetFiles(m_files, m_idf); } LOG(Info, "IdfToModel starting, filename: " << toString(m_idf->fullPath)); LOG(Info, "IdfToModel starting, outdir: " << toString(outpath)); JobErrors errors; errors.result = ruleset::OSResultValue::Success; l.unlock(); emitStatusChanged(AdvancedStatus(AdvancedStatusEnum::Starting)); emitStarted(); emitStatusChanged(AdvancedStatus(AdvancedStatusEnum::Processing)); openstudio::energyplus::ReverseTranslator rt; try { boost::filesystem::create_directories(outpath); LOG(Debug, "Loading input file: " + toString(m_idf->fullPath)); boost::optional<openstudio::model::Model> model; boost::optional<openstudio::Workspace> workspace = openstudio::Workspace::load(m_idf->fullPath); if (workspace){ model = rt.translateWorkspace(*workspace); } OS_ASSERT(model); openstudio::path outfile = outpath / openstudio::toPath("out.osm"); LOG(Debug, "Saving to path: " + toString(outfile)); model->save(outfile, true); emitOutputFileChanged(RunManager_Util::dirFile(outfile)); } catch (const std::exception &e) { LOG(Error, std::string("Error with IdfToModel translation: ") + e.what()); errors.addError(ErrorType::Error, "Error with conversion: " + std::string(e.what())); errors.result = ruleset::OSResultValue::Fail; } std::vector<openstudio::LogMessage> logwarnings = rt.warnings(); std::vector<openstudio::LogMessage> logerrors = rt.errors(); for (std::vector<openstudio::LogMessage>::const_iterator itr = logwarnings.begin(); itr != logwarnings.end(); ++itr) { errors.addError(ErrorType::Warning, itr->logMessage()); } for (std::vector<openstudio::LogMessage>::const_iterator itr = logerrors.begin(); itr != logerrors.end(); ++itr) { errors.addError(ErrorType::Error, itr->logMessage()); } setErrors(errors); }