コード例 #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"));

  }
コード例 #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;
  }
コード例 #3
0
ファイル: BasementJob.cpp プロジェクト: Anto-F/OpenStudio
  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;
  }
コード例 #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");
  }
コード例 #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"));
 }
コード例 #6
0
 FileInfo OpenStudioPostProcessJob::osmFile() const
 {
   if (!m_osm)
   {
     return allInputFiles().getLastByExtension("osm");
   } else {
     return *m_osm;
   }
 }
コード例 #7
0
 FileInfo OpenStudioPostProcessJob::sqlFile() const
 {
   if (!m_sql)
   {
     return allInputFiles().getLastByFilename("eplusout.sql");
   } else {
     return *m_sql;
   }
 }
コード例 #8
0
 FileInfo ParallelEnergyPlusSplitJob::inputFile() const
 {
   if (!m_input)
   {
     return allInputFiles().getLastByExtension("idf");
   } else {
     return *m_input;
   }
 }
コード例 #9
0
 FileInfo IdfToModelJob::idfFile() const
 {
   if (!m_idf)
   {
     return allInputFiles().getLastByExtension("idf");
   } else {
     return *m_idf;
   }
 }
コード例 #10
0
 FileInfo ModelToRadPreProcessJob::osmFile() const
 {
   if (!m_osm)
   {
     return allInputFiles().getLastByExtension("osm");
   } else {
     return *m_osm;
   }
 }
コード例 #11
0
 FileInfo EnergyPlusPreProcessJob::idfFile() const
 {
   if (!m_idf)
   {
     return allInputFiles().getLastByExtension("idf");
   } else {
     return *m_idf;
   }
 }
コード例 #12
0
 FileInfo ModelInModelOutJob::modelFile() const
 {
   if (!m_model)
   {
     return allInputFiles().getLastByExtension("osm");
   } else {
     return *m_model;
   }
 }
コード例 #13
0
 FileInfo ModelToRadJob::sqlFile() const
 {
   if (!m_sql)
   {
     return allInputFiles().getLastByExtension("sql");
   } else {
     return *m_sql;
   }
 }
コード例 #14
0
ファイル: DakotaJob.cpp プロジェクト: ChengXinDL/OpenStudio
  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;
  }
コード例 #15
0
ファイル: ReadVarsJob.cpp プロジェクト: ChengXinDL/OpenStudio
  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"));
      }
    }
  }
コード例 #16
0
ファイル: BasementJob.cpp プロジェクト: Anto-F/OpenStudio
  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"));
  }
コード例 #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;
    }
  }
コード例 #18
0
ファイル: DakotaJob.cpp プロジェクト: ChengXinDL/OpenStudio
  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);
        }
      }
    }
  }
コード例 #19
0
 void XMLPreprocessorJob::startHandlerImpl()
 {
   getFiles(allInputFiles());
   addRequiredFile(*m_xml, toPath("in.xml"));
   copyRequiredFiles(*m_xml, "idf", toPath("in.epw"));
 }