Exemplo n.º 1
0
  void EnergyPlusJob::startHandlerImpl()
  {
    getFiles(allInputFiles(), params());

    if (!m_idf)
    {
      throw std::runtime_error("No IDF file found in input files");
    } 

    if (!m_idf->hasRequiredFile(toPath("Energy+.idd")))
    {
      // We did not have an idd set, so we should find one
      m_idf->addRequiredFile( toPath("Energy+.idd"), toPath("Energy+.idd"));
    }

    if (!m_idf->hasRequiredFile(toPath("in.epw")))
    {
      openstudio::path epw = WeatherFileFinder::find(allParams(), m_filelocationname, m_weatherfilename);

      if (!epw.empty())
      {
        m_idf->addRequiredFile(epw, toPath("in.epw"));
      }
    }


    // And add the now fully outfited idf with required idd and such
    addRequiredFile(*m_idf, toPath("in.idf"));

  }
Exemplo n.º 2
0
  ToolVersion EnergyPlusJob::getToolVersionImpl(const std::string &t_toolName) const
  {
    if (t_toolName != "energyplus") {
      throw std::runtime_error("Invalid tool version request: " + t_toolName);
    }

    Files f = allInputFiles();
    JobParams p = params();
    getFiles(f, p);

    // start at default EnergyPlus version of 8.0
    ToolVersion tv(8,0); 
    if (m_idf){
      if (boost::filesystem::exists(m_idf->fullPath))
      {
        OptionalIdfFile idf = IdfFile::load(m_idf->fullPath);
        if (idf){
          WeatherFileFinder::extractDetails(*idf, tv, m_filelocationname, m_weatherfilename);
        } else {
          throw std::runtime_error("Unable to load IDF " + toString(m_idf->fullPath) + " file could not be parsed");
        }
      } else {
        throw std::runtime_error("Unable to load IDF " + toString(m_idf->fullPath) + " file does not exist");
      }
    }

    return tv;
  }
Exemplo n.º 3
0
  ToolVersion BasementJob::getToolVersionImpl(const std::string &t_toolName) const
  {
    if (t_toolName != "basement") {
      throw std::runtime_error("Invalid tool version request: " + t_toolName);
    }

    Files f = allInputFiles();
    getFiles(f);

    // Start at the currently configured minor version.
    ToolVersion tv(energyPlusVersionMajor(),energyPlusVersionMinor(),energyPlusVersionPatch(),energyPlusBuildSHA()); 

    if (m_expandedidf){
      if (boost::filesystem::exists(m_expandedidf->fullPath))
      {
        OptionalIdfFile idf = IdfFile::load(m_expandedidf->fullPath);
        if (idf){
          WeatherFileFinder::extractDetails(*idf, tv, m_filelocationname, m_weatherfilename);
        } else {
          throw std::runtime_error("Unable to load IDF " + toString(m_expandedidf->fullPath) + " file could not be parsed");
        }
      } else {
        throw std::runtime_error("Unable to load IDF " + toString(m_expandedidf->fullPath) + " file does not exist");
      }
    }

    return tv;
  }
Exemplo n.º 4
0
  void PreviewIESJob::startHandlerImpl()
  {
    LOG(Debug, "Starting job");
    getFiles(allInputFiles());

    openstudio::path theoutdir = boost::filesystem::complete(outdir(true));

    boost::filesystem::create_directories(theoutdir);

    addParameter("ies2rad", "-o");
    addParameter("ies2rad", "ov");
    addParameter("ies2rad", toString(theoutdir/toPath("in.ies")));

    addParameter("rad", toString(theoutdir/toPath("ov.rif")));

    addParameter("ra_image", "-z");
    addParameter("ra_image", "-b");
    addParameter("ra_image", "ov_y.hdr");

#ifdef Q_OS_WIN
    addParameter("ra_image", "out.bmp");
#else
    addParameter("ra_image", "out.tiff");
#endif

    // copy ies to "in.ies"
    addRequiredFile(*m_ies, toPath("in.ies"));


    writeSurfFile(theoutdir/toPath("surf.rad"), 24);
    writeRifFile(theoutdir/toPath("ov.rif"), theoutdir/toPath("ov.rad"), theoutdir/toPath("surf.rad"),
        "Z", "y", theoutdir/toPath("ov.oct"), "-ab 1 -ds .15");
  }
Exemplo n.º 5
0
 void ExpandObjectsJob::startHandlerImpl()
 {
   addExpectedOutputFile(openstudio::toPath("expanded.idf"));
   getFiles(allInputFiles());
   // copy idf to "in.idf"
   copyRequiredFiles(*m_idf, "idf", toPath("in.epw"));
   addRequiredFile(*m_idf, toPath("in.idf"));
 }
 FileInfo OpenStudioPostProcessJob::osmFile() const
 {
   if (!m_osm)
   {
     return allInputFiles().getLastByExtension("osm");
   } else {
     return *m_osm;
   }
 }
 FileInfo OpenStudioPostProcessJob::sqlFile() const
 {
   if (!m_sql)
   {
     return allInputFiles().getLastByFilename("eplusout.sql");
   } else {
     return *m_sql;
   }
 }
 FileInfo ParallelEnergyPlusSplitJob::inputFile() const
 {
   if (!m_input)
   {
     return allInputFiles().getLastByExtension("idf");
   } else {
     return *m_input;
   }
 }
Exemplo n.º 9
0
 FileInfo IdfToModelJob::idfFile() const
 {
   if (!m_idf)
   {
     return allInputFiles().getLastByExtension("idf");
   } else {
     return *m_idf;
   }
 }
Exemplo n.º 10
0
 FileInfo ModelToRadPreProcessJob::osmFile() const
 {
   if (!m_osm)
   {
     return allInputFiles().getLastByExtension("osm");
   } else {
     return *m_osm;
   }
 }
Exemplo n.º 11
0
 FileInfo EnergyPlusPreProcessJob::idfFile() const
 {
   if (!m_idf)
   {
     return allInputFiles().getLastByExtension("idf");
   } else {
     return *m_idf;
   }
 }
Exemplo n.º 12
0
 FileInfo ModelInModelOutJob::modelFile() const
 {
   if (!m_model)
   {
     return allInputFiles().getLastByExtension("osm");
   } else {
     return *m_model;
   }
 }
Exemplo n.º 13
0
 FileInfo ModelToRadJob::sqlFile() const
 {
   if (!m_sql)
   {
     return allInputFiles().getLastByExtension("sql");
   } else {
     return *m_sql;
   }
 }
Exemplo n.º 14
0
  ToolVersion DakotaJob::getToolVersionImpl(const std::string &t_toolName) const
  {
    if (t_toolName != "dakota") {
      throw std::runtime_error("Invalid tool version request: " + t_toolName);
    }

    Files f = allInputFiles();
    JobParams p = params();
    getFiles(f, p);

    // minimum required version
    ToolVersion tv(5,3,1);

    return tv;
  }
Exemplo n.º 15
0
  void ReadVarsJob::startHandlerImpl()
  {
    getFiles(allInputFiles());

    if (m_eso)
    {

      // copy m_eso to "eplusout.eso"
      addRequiredFile(*m_eso, toPath("eplusout.eso"));

      // if have an rvi file
      if (m_rvi){

        // how can I add a parameter now?
        //m_params.append(JobParams("in.rvi"));

        // DLM@20100909: I would rather this just be named whatever it was...
        addRequiredFile(*m_rvi, toPath("in.rvi"));
      }
    }
  }
Exemplo n.º 16
0
  void BasementJob::startHandlerImpl()
  {
    addExpectedOutputFile(openstudio::toPath("basementmerged.idf"));

    getFiles(allInputFiles());

    if (!m_idf)
    {
      throw std::runtime_error("No IDF file found in input files");
    } 

    if (!m_expandedidf)
    {
      throw std::runtime_error("No expanded IDF file found in input files");
    } 

    try {
      m_idf->getRequiredFile(toPath("BasementGHT.idd"));
    } catch (const std::runtime_error &) {
      // We did not have an idd set, so we should find one
      m_idf->addRequiredFile( toPath("BasementGHT.idd"), toPath("BasementGHT.idd"));
    }

    copyRequiredFiles(*m_idf, "idf", toPath("in.epw"));

    try {
      m_idf->getRequiredFile(toPath("in.epw")); 
    } catch (const std::runtime_error &) {
      openstudio::path epw = WeatherFileFinder::find(allParams(), m_filelocationname, m_weatherfilename);

      if (!epw.empty())
      {
        m_idf->addRequiredFile(epw, toPath("in.epw"));
      }
    }


    // And add the now fully outfited idf with required idd and such
    addRequiredFile(*m_idf, toPath("BasementGHTIn.idf"));
  }
Exemplo n.º 17
0
  FileInfo ModelToRadJob::modelFile() const
  {
    if (!m_model)
    {
      boost::shared_ptr<Job_Impl> p = parent();
      while (p)
      {
        if (p->jobType() == JobType::ModelToRadPreProcess)
        {
          // We have a parent that is a ModelToRadPreProcess job - so we want the
          // radiance job that *it* started with, which has not been pared down
          return p->allInputFiles().getLastByExtension("osm");
        }

        p = p->parent();
      }

      // if we make it through the above loop, we just want to return the last osm
      // in the input list
      return allInputFiles().getLastByExtension("osm");
    } else {
      return *m_model;
    }
  }
Exemplo n.º 18
0
  void DakotaJob::startHandlerImpl() {
    getFiles(allInputFiles(), params());

    if (!m_inFile)
    {
      throw std::runtime_error("No .in file found in input files");
    }

    LOG(Debug,"Starting DakotaJob with in file '" << toString(m_inFile->fullPath) << "'.");
    addRequiredFile(*m_inFile, toPath("dakota.in"));
    addParameter("dakota","-i");
    addParameter("dakota","dakota.in");

    // add additional parameters
    for (const JobParam& param : params().params()) {
      std::string val = param.value;
      if (val.find("-",0) == 0) {
        unsigned pos = val.find(" ",0);
        if (pos < val.size()) {
          std::string::iterator it = val.begin();
          for (unsigned i = 0; i < pos; ++i,++it);
          std::string temp(val.begin(),it);
          LOG(Debug,"Adding dakota parameter: " << temp);
          addParameter("dakota",temp);
          ++it;
          temp = std::string(it,val.end());
          LOG(Debug,"Adding dakota parameter: " << temp);
          addParameter("dakota",temp);
        }
        else {
          LOG(Debug,"Adding dakota parameter: " << val);
          addParameter("dakota",val);
        }
      }
    }
  }
Exemplo n.º 19
0
 void XMLPreprocessorJob::startHandlerImpl()
 {
   getFiles(allInputFiles());
   addRequiredFile(*m_xml, toPath("in.xml"));
   copyRequiredFiles(*m_xml, "idf", toPath("in.epw"));
 }