File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
openstudiocore/src/openstudio_lib Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -295,9 +295,12 @@ LocationView::LocationView(const model::Model & model,
295295
296296 // Set weather Thailand as default
297297 boost::optional<model::WeatherFile> weaterFile = m_model.getOptionalUniqueModelObject <model::WeatherFile>();
298- if (!weaterFile){
299- setDefaultWeather (m_resourceDir + " /weather/THA_Bangkok.484560_IWEC.epw" );
300- setDefaultDDY (m_resourceDir + " /weather/THA_Bangkok.484560_IWEC.ddy" );
298+ if (!weaterFile || !boost::filesystem::exists (weaterFile->path ()->filename ())){
299+ setDefaultWeather (m_resourceDir + " /weather/THA_Bangkok.484560_IWEC.epw" );
300+ }
301+ boost::optional<model::DesignDay> designDay = m_model.getOptionalUniqueModelObject <model::DesignDay>();
302+ if (!designDay){
303+ setDefaultDDY (m_resourceDir + " /weather/THA_Bangkok.484560_IWEC.ddy" );
301304 }
302305 update ();
303306}
@@ -705,12 +708,16 @@ void LocationView::onDesignDayBtnClicked()
705708}
706709
707710void LocationView::setDefaultDDY (const QString fileName){
711+
712+ openstudio::path epwPath = toPath (fileName);
713+ openstudio::path newPath = toPath (m_modelTempDir) / toPath (" resources/files" ) / epwPath.filename ();
708714
709715 if (!fileName.isEmpty ()){
710716
711717 boost::optional<IdfFile> ddyIdfFile = openstudio::IdfFile::load (toPath (fileName));
712- if (ddyIdfFile){
713718
719+ if (ddyIdfFile){
720+ boost::filesystem::copy_file (epwPath, newPath, boost::filesystem::copy_option::overwrite_if_exists);
714721 openstudio::Workspace ddyWorkspace (StrictnessLevel::None, IddFileType::EnergyPlus);
715722 for (IdfObject idfObject : ddyIdfFile->objects ()){
716723 IddObjectType iddObjectType = idfObject.iddObject ().type ();
You can’t perform that action at this time.
0 commit comments