Exemple #1
0
  Job JobFactory::createEnergyPlusJob(
      ToolInfo t_energyPlusTool,
      const openstudio::path &t_idd,
      const openstudio::path &t_idf,
      const openstudio::path &t_epw,
      const openstudio::path &t_outdir,
      const boost::optional<openstudio::UUID> &t_uuid)
  {
    JobParams params;
    params.append("outdir", toString(t_outdir));

    Tools tools;
    t_energyPlusTool.name = "energyplus";
    tools.append(t_energyPlusTool);

    Files files;
    FileInfo idf(t_idf, "idf");

    if (!t_idd.empty())
    {
      idf.addRequiredFile(t_idd,toPath("Energy+.idd"));
    }

    idf.addRequiredFile(t_epw, toPath("in.epw"));
    files.append(idf);

    return createEnergyPlusJob(tools, params, files, std::vector<openstudio::URLSearchPath>(), t_uuid);
  }
  void EnergyPlusJob::getFiles(const Files &t_files, const JobParams &t_params) const
  {
    // This function works with mutable local objects
    // because it's used to cache looked up variables
    if (!m_idf)
    {
      if (t_params.has("filename") && !t_params.get("filename").children.empty())
      {
        // first, see if we can get a filename that was specifically requested by the job creation
        std::string filename = t_params.get("filename").children[0].value;

        LOG(Info, "Looking for filename: " << filename); 

        std::vector<FileInfo> files = t_files.getAllByFilename(filename).files();
        if (!files.empty())
        {
          m_idf = files.back();
        } else {
          // a filename param was provided, but the file hasn't been generated ... yet
        }
      } else {
        // if not, try to get any old IDF that was passed in
        std::vector<FileInfo> files = t_files.getAllByExtension("idf").files();
        if (!files.empty())
        {
          m_idf = files.back();
        } else {
          // there are not any idf files at all
        }
      }
    }
  }
Exemple #3
0
TEST_F(RunManagerTestFixture, Workflow_ToWorkItems)
{
  ToolInfo ti("tool", openstudio::toPath("somepath"));
  Tools tis;
  tis.append(ti);

  JobParam param("param1");
  JobParams params;
  params.append(param);

  FileInfo fi(openstudio::toPath("somefile.txt"), "txt");
  Files fis;
  fis.append(fi);

  Workflow wf("null->energyplus");
  wf.add(params);
  wf.add(tis);
  wf.add(fis);

  std::vector<WorkItem> wis = wf.toWorkItems();

  ASSERT_EQ(2u, wis.size());
  EXPECT_EQ(JobType(JobType::Null), wis[0].type);
  EXPECT_EQ(JobType(JobType::EnergyPlus), wis[1].type);

  EXPECT_EQ(params, wis[0].params);
  EXPECT_EQ(fis, wis[0].files);
  EXPECT_EQ(tis, wis[0].tools);

  EXPECT_TRUE(wis[1].params.params().empty());
  EXPECT_TRUE(wis[1].files.files().empty());
  EXPECT_TRUE(wis[1].tools.tools().empty());
} 
Exemple #4
0
  Job JobFactory::createEnergyPlusJob(
      const openstudio::runmanager::Tools &t_tools,
      const openstudio::path &t_idd,
      const openstudio::path &t_idf,
      const openstudio::path &t_epw,
      const openstudio::path &t_outdir,
      const boost::optional<openstudio::UUID> &t_uuid)
  {
    JobParams params;
    params.append("outdir", toString(t_outdir));

    Files files;
    FileInfo idf(t_idf, "idf");

    if (!t_idd.empty())
    {
      idf.addRequiredFile(t_idd,toPath("Energy+.idd"));
    }

    if (boost::filesystem::is_directory(t_epw))
    {
      params.append("epwdir", toString(t_epw));
    } else {
      idf.addRequiredFile(t_epw, toPath("in.epw"));
    }

    files.append(idf);

    return createEnergyPlusJob(t_tools, params, files, std::vector<openstudio::URLSearchPath>(), t_uuid);
  }
Exemple #5
0
  Job JobFactory::createIdfToModelJob(
      const openstudio::path &t_idf,
      const openstudio::path &t_outdir,
      const boost::optional<openstudio::UUID> &t_uuid)
  {
    JobParams params;
    params.append("outdir", toString(t_outdir));

    Files files;
    files.append(FileInfo(t_idf, "idf"));

    return createIdfToModelJob(Tools(), params, files, std::vector<openstudio::URLSearchPath>(), t_uuid);
  }
Exemple #6
0
  Job JobFactory::createRubyJob(
      const openstudio::path &t_rubyfile,
      const std::string &t_infileregex,
      const openstudio::path &t_outdir,
      const boost::optional<openstudio::UUID> &t_uuid)
  {
    JobParams params;
    params.append("outdir", toString(t_outdir));
    params.append("input_file_regex", t_infileregex);

    Files files;
    files.append(FileInfo(t_rubyfile, "rb"));


    return createRubyJob(Tools(), params, files, std::vector<openstudio::URLSearchPath>(), t_uuid);
  }
  ParallelEnergyPlusSplitJob::ParallelEnergyPlusSplitJob(const UUID &t_uuid,
          const Tools &tools,
          const JobParams &params,
          const Files &files,
      const JobState &t_restoreData)
    : Job_Impl(t_uuid, JobType::ParallelEnergyPlusSplit, tools, params, files, t_restoreData),
      m_numSplits(boost::lexical_cast<int>(params.get("numsplits").children.at(0).value)),
      m_offset(boost::lexical_cast<int>(params.get("offset").children.at(0).value))
  {
    try {
      m_input = files.getLastByExtension("idf");
      resetFiles(m_files, m_input);
    } catch (const std::runtime_error &) {
    }

    m_description = buildDescription("idf");
  }
TEST_F(RunManagerTestFixture, JSON_workItem)
{
  Tools tools;
  tools.tools().push_back(ToolInfo("tool", ToolVersion(1,5,6, "TAG"), 
        openstudio::toPath("path1"),
        boost::regex(".*")
        ));

  Files files;
  files.files().push_back(FileInfo("filename",
        openstudio::DateTime::now(),
        "key",
        openstudio::toPath("fullpath"),
        true));

  files.files()[0].addRequiredFile(QUrl("url"), openstudio::toPath("target"));

  JobParams params;
  params.append("key", "value");


  WorkItem wi(JobType::EnergyPlus,
      tools,
      params,
      files,
      "keyname");

  std::string json = wi.toJSON();

  EXPECT_FALSE(json.empty());

  openstudio::runmanager::WorkItem wi2 = WorkItem::fromJSON(json);

  EXPECT_EQ(wi2.type, JobType::EnergyPlus);
  EXPECT_EQ(wi2.tools, tools);
  EXPECT_EQ(wi2.params, params);
  EXPECT_EQ(wi2.files, files);
  EXPECT_EQ(wi2.jobkeyname, "keyname");


  std::string json2 = wi2.toJSON();

  EXPECT_EQ(json, json2);

}
void populateJobs(RunManager &rm, bool bulkadd, const openstudio::path &t_model, int number)
{
  std::vector<openstudio::runmanager::Job> jobs;

  openstudio::runmanager::ConfigOptions co;
  co.fastFindEnergyPlus();

  for (int i = 0; i < number; ++i)
  {
    boost::timer t;
    Workflow wf("Null->Null->ModelToIdf->ExpandObjects->EnergyPlusPreProcess->EnergyPlus->EnergyPlusPostProcess");

    
    // keep filepaths short enough for Windows
    JobParams params;
    std::stringstream ss;
    ss << i;
    params.append("jobnumber", ss.str());
    params.append(JobParam("flatoutdir"));

    wf.add(co.getTools());
    wf.add(params);

    openstudio::runmanager::Job j = wf.create(openstudio::toPath("ClearJobsPerformanceTest"), t_model);
    LOG_FREE(Info, "RunManagerTiming", "Time to create job: " << t.elapsed());

    if (!bulkadd)
    {
      rm.enqueue(j, true);
    } else {
      jobs.push_back(j);
    }

    LOG_FREE(Info, "RunManagerTiming", "Total Time to crate Job: " << t.elapsed());
  }

  if (bulkadd)
  {
    rm.enqueue(jobs, true);
  }
}
Exemple #10
0
TEST_F(RunManagerTestFixture, Workflow_FromWorkItems)
{
  ToolInfo ti("tool", openstudio::toPath("somepath"));
  Tools tis;
  tis.append(ti);

  JobParam param("param1");
  JobParams params;
  params.append(param);

  FileInfo fi(openstudio::toPath("somefile.txt"), "txt");
  Files fis;
  fis.append(fi);

  std::vector<WorkItem> wi;
  wi.push_back(WorkItem(JobType::Null, tis, params, fis));
  wi.push_back(WorkItem(JobType::EnergyPlus));

  Workflow wf(wi);

  EXPECT_EQ(tis, wf.tools());
  EXPECT_EQ(params, wf.params());
  EXPECT_EQ(fis, wf.files());
} 
Exemple #11
0
 void DakotaJob::getFiles(const Files &t_files, const JobParams &t_params) const
 {
   // This function works with mutable local objects
   // because it's used to cache looked up variables
   if (!m_inFile) {
     try {
       // first, see if we can get a filename that was specifically requested by the job creation
       m_inFile = t_files.getLastByFilename(t_params.get("filename").value);
     } catch (const std::runtime_error &) {
       // if not, try to get any old .in that was passed in
       try {
         m_inFile = t_files.getLastByExtension("in");
       } 
       catch (const std::runtime_error &) {}
     }
   }
 }
openstudio::analysis::Analysis AnalysisFixture::analysis1(AnalysisState state) {
  // Create problem and analysis
  Problem problem("My Problem");

  BCLMeasure bclMeasure(resourcesPath() / toPath("utilities/BCL/Measures/SetWindowToWallRatioByFacade"));
  RubyMeasure measure(bclMeasure);

  // Measure Group
  StringVector choices;
  choices.push_back("North");
  choices.push_back("South");
  choices.push_back("East");
  choices.push_back("West");
  OSArgument facade = OSArgument::makeChoiceArgument("facade",choices);
  OSArgument arg = facade.clone();
  arg.setValue("South");
  measure.setArgument(arg);
  OSArgument wwr = OSArgument::makeDoubleArgument("wwr");
  MeasureVector measures(1u,NullMeasure());
  measures.push_back(measure.clone().cast<Measure>());
  arg = wwr.clone();
  arg.setValue(0.1);
  measures.back().cast<RubyMeasure>().setArgument(arg);
  measures.push_back(measure.clone().cast<Measure>());
  arg = wwr.clone();
  arg.setValue(0.2);
  measures.back().cast<RubyMeasure>().setArgument(arg);
  measures.push_back(measure.clone().cast<Measure>());
  arg = wwr.clone();
  arg.setValue(0.3);
  measures.back().cast<RubyMeasure>().setArgument(arg);
  problem.push(MeasureGroup("South Windows",measures));

  // Continuous Variables Attached to Arguments
  arg = facade.clone();
  arg.setValue("North");
  measure.setArgument(arg);
  arg = wwr.clone();
  RubyContinuousVariable wwrCV("Window to Wall Ratio",arg,measure);
  wwrCV.setMinimum(0.0);
  wwrCV.setMaximum(1.0);
  TriangularDistribution td(0.2,0.0,0.5);
  wwrCV.setUncertaintyDescription(td);
  problem.push(wwrCV);
  OSArgument offset = OSArgument::makeDoubleArgument("offset");
  RubyContinuousVariable offsetCV("Offset",offset,measure);
  offsetCV.setMinimum(0.0);
  offsetCV.setMaximum(1.5);
  NormalDistribution nd(0.9,0.05);
  offsetCV.setUncertaintyDescription(nd);
  problem.push(offsetCV);

  // Simulation
  problem.push(WorkItem(JobType::ModelToIdf));
  problem.push(WorkItem(JobType::EnergyPlusPreProcess));
  problem.push(WorkItem(JobType::EnergyPlus));
  problem.push(WorkItem(JobType::OpenStudioPostProcess));

  // Responses
  LinearFunction response1("Energy Use Intensity",
                           VariableVector(1u,OutputAttributeVariable("EUI","site.eui")));
  problem.pushResponse(response1);
  VariableVector vars;
  vars.push_back(OutputAttributeVariable("Heating Energy","heating.energy.gas"));
  vars.push_back(OutputAttributeVariable("Cooling Energy","cooling.energy.elec"));
  DoubleVector coeffs;
  coeffs.push_back(1.0); // approx. source factor
  coeffs.push_back(2.5); // approx. source factor
  LinearFunction response2("Approximate Source Energy",vars,coeffs);
  problem.pushResponse(response2);
  LinearFunction response3("North WWR",VariableVector(1u,wwrCV)); // input variable as output
  problem.pushResponse(response3);

  Analysis analysis("My Analysis",problem,FileReferenceType::OSM);

  if (state == PreRun) {
    // Add three DataPoints
    std::vector<QVariant> values;
    values.push_back(0);
    values.push_back(0.2);
    values.push_back(0.9);
    OptionalDataPoint dataPoint = problem.createDataPoint(values);
    analysis.addDataPoint(*dataPoint);
    values[0] = 1; values[1] = 0.21851789; values[2] = 1.1681938;
    dataPoint = problem.createDataPoint(values);
    analysis.addDataPoint(*dataPoint);
    values[0] = 2; values[1] = 0.0; values[2] = 0.581563892;
    dataPoint = problem.createDataPoint(values);
    analysis.addDataPoint(*dataPoint);
  }
  else {
    // state == PostRun
    // Add one complete DataPoint
    std::vector<QVariant> values;
    values.push_back(1);
    values.push_back(0.3);
    values.push_back(0.9);
    DoubleVector responseValues;
    responseValues.push_back(58.281967);
    responseValues.push_back(718952.281);
    responseValues.push_back(0.3);
    TagVector tags;
    tags.push_back(Tag("custom"));
    tags.push_back(Tag("faked"));
    // attributes
    AttributeVector attributes;
    attributes.push_back(Attribute("electricity.Cooling",281.281567,"kWh"));
    attributes.push_back(Attribute("electricity.Lighting",19206.291876,"kWh"));
    attributes.push_back(Attribute("electricity.Equipment",5112.125718,"kWh"));
    attributes = AttributeVector(1u,Attribute("enduses.electric",attributes));
    attributes.push_back(Attribute("eui",createQuantity(128.21689,"kBtu/ft^2").get()));
    // complete job
    // 1. get vector of work items
    std::vector<WorkItem> workItems;
    // 0
    workItems.push_back(problem.variables()[0].cast<MeasureGroup>().createWorkItem(QVariant(1),
                                                                                   toPath(rubyOpenStudioDir())));
    RubyContinuousVariable rcv = problem.variables()[1].cast<RubyContinuousVariable>();
    RubyMeasure rm = rcv.measure();
    OSArgument arg = rcv.argument().clone();
    arg.setValue(values[1].toDouble());
    rm.setArgument(arg);
    rcv = problem.variables()[2].cast<RubyContinuousVariable>();
    arg = rcv.argument().clone();
    arg.setValue(values[2].toDouble());
    rm.setArgument(arg);
    // 1
    workItems.push_back(rm.createWorkItem(toPath(rubyOpenStudioDir())));
    // 2
    workItems.push_back(WorkItem(JobType::ModelToIdf));
    // 3
    workItems.push_back(WorkItem(JobType::EnergyPlusPreProcess));
    // 4
    workItems.push_back(WorkItem(JobType::EnergyPlus));
    // 5
    workItems.push_back(WorkItem(JobType::OpenStudioPostProcess));
    // 2. step through work items and create jobs with results
    WorkItem wi = workItems[5];
    std::vector<FileInfo> inFiles = wi.files.files();
    inFiles.push_back(FileInfo("eplusout.sql",
                               DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,33,32)),
                               "",
                               toPath("myProject/fakeDataPoint/75-OpenStudioPostProcess-0/eplusout.sql")));                             
    Files inFilesObject(inFiles);
    std::vector<std::pair<ErrorType, std::string> > errors;
    errors.push_back(std::make_pair(ErrorType::Info,"Post-process completed successfully."));
    JobErrors errorsObject(OSResultValue::Success,errors);
    std::vector<FileInfo> outFiles;
    outFiles.push_back(FileInfo("report.xml",
                                DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,34,21)),
                                "",
                                toPath("myProject/fakeDataPoint/75-OpenStudioPostProcess-0/report.xml")));
    Files outFilesObject(outFiles);
    Job job = JobFactory::createJob(
          wi.type,
          wi.tools,
          wi.params,
          inFilesObject,
          std::vector<openstudio::URLSearchPath>(),
          false,
          createUUID(),
          JobState(
            DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,34,21)),
            errorsObject,
            outFilesObject,
            AdvancedStatus(),
            openstudio::path())

          ); // OpenStudioPostProcess

    Job jobLast = job;
    wi = workItems[4];
    inFiles = wi.files.files();
    inFiles.push_back(FileInfo("in.idf",
                                DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,23,05)),
                                "",
                                toPath("myProject/fakeDataPoint/74-EnergyPlus-0/in.idf")));
    inFilesObject = Files(inFiles);
    errors.clear();
    errors.push_back(std::make_pair(ErrorType::Warning,"ENERGYPLUS WARNING: ..."));
    errors.push_back(std::make_pair(ErrorType::Warning,"ENERGYPLUS WARNING: ..."));
    errors.push_back(std::make_pair(ErrorType::Warning,"ENERGYPLUS WARNING: ..."));
    errorsObject = JobErrors(OSResultValue::Success,errors);
    outFiles.clear();
    outFiles.push_back(FileInfo("eplusout.sql",
                                DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,33,32)),
                                "",
                                toPath("myProject/fakeDataPoint/74-EnergyPlus-0/eplusout.sql")));
    outFiles.push_back(FileInfo("eplusout.err",
                                DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,33,34)),
                                "",
                                toPath("myProject/fakeDataPoint/74-EnergyPlus-0/eplusout.err")));
    outFilesObject = Files(outFiles);
    job = JobFactory::createJob(
          wi.type,
          wi.tools,
          wi.params,
          inFilesObject,
          std::vector<openstudio::URLSearchPath>(),
          false,
          createUUID(),
          JobState(
            DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,33,42)),
            errorsObject,
            outFilesObject,
            AdvancedStatus(),
            openstudio::path())
          ); // EnergyPlus
    job.addChild(jobLast);

    jobLast = job;
    wi = workItems[3];
    inFiles = wi.files.files();
    inFiles.push_back(FileInfo("in.idf",
                                DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,22,30)),
                                "",
                                toPath("myProject/fakeDataPoint/73-EnergyPlusPreProcess-0/in.idf")));
    inFilesObject = Files(inFiles);
    errors.clear();
    errorsObject = JobErrors(OSResultValue::Success,errors);
    outFiles.clear();
    outFiles.push_back(FileInfo("out.idf",
                                DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,23,05)),
                                "",
                                toPath("myProject/fakeDataPoint/73-EnergyPlusPreProcess-0/out.idf")));
    outFilesObject = Files(outFiles);
    job = JobFactory::createJob(
          wi.type,
          wi.tools,
          wi.params,
          inFilesObject,
          std::vector<openstudio::URLSearchPath>(),
          false,
          createUUID(),
          JobState(
            DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,23,12)),
            errorsObject,
            outFilesObject,
            AdvancedStatus(),
            openstudio::path())
          ); // EnergyPlusPreProcess
    job.addChild(jobLast);

    jobLast = job;
    wi = workItems[2];
    inFiles = wi.files.files();
    inFiles.push_back(FileInfo("in.osm",
                                DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,22,01)),
                                "",
                                toPath("myProject/fakeDataPoint/72-ModelToIdf-0/in.osm")));
    inFilesObject = Files(inFiles);
    errors.clear();
    errors.push_back(std::make_pair(ErrorType::Info,"Did not find ScheduleTypeLimits for Schedule ..."));
    errors.push_back(std::make_pair(ErrorType::Warning,"Unexpectedly did not find a child object of a certain type, replaced with a default one."));
    errorsObject = JobErrors(OSResultValue::Success,errors);
    outFiles.clear();
    outFiles.push_back(FileInfo("out.idf",
                                DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,22,30)),
                                "",
                                toPath("myProject/fakeDataPoint/72-ModelToIdf-0/out.idf")));
    outFilesObject = Files(outFiles);
    job = JobFactory::createJob(
          wi.type,
          wi.tools,
          wi.params,
          inFilesObject,
          std::vector<openstudio::URLSearchPath>(),
          false,
          createUUID(),
          JobState(
            DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,22,32)),
            errorsObject,
            outFilesObject,
            AdvancedStatus(),
            openstudio::path())
          ); // ModelToIdf
    job.addChild(jobLast);

    jobLast = job;
    wi = workItems[1];
    errors.clear();
    errors.push_back(std::make_pair(ErrorType::InitialCondition,"Started with a window to wall ratio of ..."));
    errors.push_back(std::make_pair(ErrorType::FinalCondition,"Set the window to wall ratio ..."));
    errorsObject = JobErrors(OSResultValue::Success,errors);
    outFiles.clear();
    outFilesObject = Files(outFiles);
    wi.params.append("outdir","myProject/fakeDataPoint/");
    job = JobFactory::createJob(
          wi.type,
          wi.tools,
          wi.params,
          wi.files,
          std::vector<openstudio::URLSearchPath>(),
          false,
          createUUID(),
          JobState(
            DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,21,52)),
            errorsObject,
            outFilesObject,
            AdvancedStatus(),
            openstudio::path())
          ); // Variables 2 & 3
    job.addChild(jobLast);

    jobLast = job;
    wi = workItems[0];
    errors.clear();
    errors.push_back(std::make_pair(ErrorType::InitialCondition,"Started with a window to wall ratio of ..."));
    errors.push_back(std::make_pair(ErrorType::FinalCondition,"Set the window to wall ratio ..."));
    errorsObject = JobErrors(OSResultValue::Success,errors);
    outFiles.clear();
    outFilesObject = Files(outFiles);
    // add outdir job param
    JobParams params = wi.params;
    params.append("outdir","myProject/fakeDataPoint");
    job = JobFactory::createJob(
          wi.type,
          wi.tools,
          params,
          wi.files,
          std::vector<openstudio::URLSearchPath>(),
          false,
          createUUID(),
          JobState(
            DateTime(Date(MonthOfYear::Mar,21,2018),Time(0,8,21,10)),
            errorsObject,
            outFilesObject,
            AdvancedStatus(),
            openstudio::path())
          ); // Variable 1
    job.addChild(jobLast);

    DataPoint dataPoint(createUUID(),
                        createUUID(),
                        "fakeDataPoint",
                        "Fake Data Point",
                        "Demonstrating json serialization of complete DataPoint.",
                        problem,
                        true,
                        false,
                        true,
                        DataPointRunType::Local,
                        values,
                        responseValues,
                        toPath("myProject/fakeDataPoint/"),
                        FileReference(toPath("myProject/fakeDataPoint/71-Ruby-0/out.osm")),
                        FileReference(toPath("myProject/fakeDataPoint/72-ModelToIdf-0/out.idf")),
                        FileReference(toPath("myProject/fakeDataPoint/74-EnergyPlus-0/eplusout.sql")),
                        FileReferenceVector(1u,FileReference(toPath("myProject/fakeDataPoint/75-OpenStudioPostProcess-0/report.xml"))),
                        job,
                        std::vector<openstudio::path>(),
                        tags,
                        attributes);
    EXPECT_TRUE(analysis.addDataPoint(dataPoint));
  }

  return analysis;
}
  openstudio::path WeatherFileFinder::find(const JobParams &t_params,
      const boost::optional<std::string> &t_filelocationname,
      const boost::optional<std::string> &t_weatherfilename)
  {
    openstudio::path epwdir;

    try {
      if (t_params.has("epwfile"))
      {
        openstudio::path epwfile = toPath(t_params.get("epwfile").children.at(0).value);

        if (!epwfile.empty() && boost::filesystem::exists(epwfile))
        {
          LOG(Info, "Valid epwfile found, returning: " << openstudio::toString(epwfile));

          return epwfile;
        }
      } else {
        LOG(Info, "No epwfile found in params, moving on for other methods of finding weather file");
      }
    } catch (const std::exception &) {
      // No epw dir set in params
      LOG(Info, "Error with epwfile found in params, moving on for other methods of finding weather file");
    }

    try {
      if (t_params.has("epwdir"))
      {
        epwdir = toPath(t_params.get("epwdir").children.at(0).value);
      }
    } catch (const std::exception &) {
      // No epw dir set in params
      LOG(Info, "No EPWDir known finding weather file will be much harder");
    }

    if (epwdir.empty() || !boost::filesystem::exists(epwdir) || !boost::filesystem::is_directory(epwdir))
    {
      LOG(Info, "The configured EPWDir either does not exist or is not a directory: " << toString(epwdir));
    }


    if (t_weatherfilename)
    {
      openstudio::path p = toPath(*t_weatherfilename);

      if (!boost::filesystem::exists(p))
      {
        p = epwdir / toPath(*t_weatherfilename);

        if (!boost::filesystem::exists(p))
        {
          LOG(Info, "Weather file discovered from comment header cannot be found at: " << toString(p));
        } else {
          return p;
        }
        LOG(Info, "Weather file discovered from comment header cannot be found at: " << *t_weatherfilename);
      } else {
        return p;
      }

    }

    if (t_filelocationname)
    {
      LOG(Info, "attempting to find weather file from location name: " << *t_filelocationname);

      // We did not have an epw set, so let's try to find one
      try {
        QDir dir(openstudio::toQString(epwdir), "*.epw");
        QFileInfoList files = dir.entryInfoList();

        std::set<std::string> desiredname = getNameComponents(*t_filelocationname);

        openstudio::path bestmatch;
        size_t matchsize = 0;

        for (QFileInfoList::const_iterator itr = files.begin();
            itr != files.end();
            ++itr)
        {
          std::set<std::string> foundname = getNameComponents(openstudio::toString(itr->fileName()));

          std::vector<std::string> matches;
          std::set_intersection(desiredname.begin(), desiredname.end(), foundname.begin(), foundname.end(),
              std::back_inserter(matches));

          if (matches.size() > matchsize)
          {
            matchsize = matches.size();
            bestmatch = openstudio::toPath(itr->absoluteFilePath());
          }
        }

        if (matchsize > 2)
        {
          LOG(Info, "Adding best match epw from the list found: " << toString(bestmatch));
          return bestmatch;
        } else {
          LOG(Info, "No best match epw file found, continuing with no epw set");
        }

      } catch (const std::exception &) {
        LOG(Info, "No EPw file set and no epwdir provided. We are continuing, but EnergyPlus will likely fail");
      }
    } else {
      LOG(Info, "No EPw file set and no location information parsed from IDF. We are continuing, but EnergyPlus will likely fail");
    }  

    LOG(Info, "No weather file found");

    return openstudio::path();
  }