From 352f939e5ae137e9add45864befae365cd86b51e Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Mon, 25 Nov 2013 16:02:07 -0500 Subject: [PATCH] Minor changes for merge --- openstudiocore/src/contam/Contam.i | 2 +- .../src/contam/ForwardTranslator.cpp | 29 ++---------------- .../src/contam/ForwardTranslator.hpp | 30 +++++++++---------- 3 files changed, 17 insertions(+), 44 deletions(-) diff --git a/openstudiocore/src/contam/Contam.i b/openstudiocore/src/contam/Contam.i index e97ffac9b87..0f4e5e7b507 100644 --- a/openstudiocore/src/contam/Contam.i +++ b/openstudiocore/src/contam/Contam.i @@ -37,7 +37,7 @@ // fatal error C1061: compiler limit : blocks nested too deeply %ignore RunControl(std::string name=std::string(),std::string version=std::string(),int echo=0,std::string prjdesc=std::string(),int skheight=0,int skwidth=0,int def_units=0,int def_flows=0,RX def_T=RX_INIT(0),int udefT=0,RX rel_N=RX_INIT(0),RX wind_H=RX_INIT(0),int uwH=0,RX wind_Ao=RX_INIT(0),RX wind_a=RX_INIT(0),RX scale=RX_INIT(0),int uScale=0,int orgRow=0,int orgCol=0,int invYaxis=0,int showGeom=0,WeatherData ssWeather=WeatherData(),WeatherData wptWeather=WeatherData(),std::string WTHpath=std::string(),std::string CTMpath=std::string(),std::string CVFpath=std::string(),std::string DVFpath=std::string(),std::string WPCfile=std::string(),std::string EWCfile=std::string(),std::string WPCdesc=std::string(),RX X0=RX_INIT(0),RX Y0=RX_INIT(0),RX Z0=RX_INIT(0),RX angle=RX_INIT(0),int u_XYZ=0,RX epsPath=RX_INIT(0),RX epsSpcs=RX_INIT(0),std::string tShift=std::string(),std::string dStart=std::string(),std::string dEnd=std::string(),int useWPCwp=0,int useWPCmf=0,int wpctrig=0,RX latd=RX_INIT(0),RX lgtd=RX_INIT(0),RX Tznr=RX_INIT(0),RX altd=RX_INIT(0),RX Tgrnd=RX_INIT(0),int utg=0,int u_a=0,int sim_af=0,int afcalc=0,int afmaxi=0,RX afrcnvg=RX_INIT(0),RX afacnvg=RX_INIT(0),RX afrelax=RX_INIT(0),int uac2=0,RX Pres=RX_INIT(0),int uPres=0,int afslae=0,int afrseq=0,int aflmaxi=0,RX aflcnvg=RX_INIT(0),int aflinit=0,int Tadj=0,int sim_mf=0,int ccmaxi=0,RX ccrcnvg=RX_INIT(0),RX ccacnvg=RX_INIT(0),RX ccrelax=RX_INIT(0),int uccc=0,int mfnmthd=0,int mfnrseq=0,int mfnmaxi=0,RX mfnrcnvg=RX_INIT(0),RX mfnacnvg=RX_INIT(0),RX mfnrelax=RX_INIT(0),RX mfngamma=RX_INIT(0),int uccn=0,int mftmthd=0,int mftrseq=0,int mftmaxi=0,RX mftrcnvg=RX_INIT(0),RX mftacnvg=RX_INIT(0),RX mftrelax=RX_INIT(0),RX mftgamma=RX_INIT(0),int ucct=0,int mfvmthd=0,int mfvrseq=0,int mfvmaxi=0,RX mfvrcnvg=RX_INIT(0),RX mfvacnvg=RX_INIT(0),RX mfvrelax=RX_INIT(0),int uccv=0,int mf_solver=0,int sim_1dz=0,int sim_1dd=0,RX celldx=RX_INIT(0),int sim_vjt=0,int udx=0,int cvode_mth=0,RX cvode_rcnvg=RX_INIT(0),RX cvode_acnvg=RX_INIT(0),RX cvode_dtmax=RX_INIT(0),int tsdens=0,RX tsrelax=RX_INIT(0),int tsmaxi=0,int cnvgSS=0,int densZP=0,int stackD=0,int dodMdt=0,std::string date_st=std::string(),std::string time_st=std::string(),std::string date_0=std::string(),std::string time_0=std::string(),std::string date_1=std::string(),std::string time_1=std::string(),std::string time_step=std::string(),std::string time_list=std::string(),std::string time_scrn=std::string(),int restart=0,std::string rstdate=std::string(),std::string rsttime=std::string(),int list=0,int doDlg=0,int pfsave=0,int zfsave=0,int zcsave=0,int achvol=0,int achsave=0,int abwsave=0,int cbwsave=0,int expsave=0,int ebwsave=0,int zaasave=0,int zbwsave=0,int rzfsave=0,int rzmsave=0,int rz1save=0,int csmsave=0,int srfsave=0,int logsave=0,std::vector save=std::vector(),std::vector rvals=std::vector(),int BldgFlowZ=0,int BldgFlowD=0,int BldgFlowC=0,int cfd_ctype=0,RX cfd_convcpl=RX_INIT(0),int cfd_var=0,int cfd_zref=0,int cfd_imax=0,int cfd_dtcmo=0); %include -%ignore Model(Reader &input); +%ignore PrjModel(Reader &input); %include //%include %include diff --git a/openstudiocore/src/contam/ForwardTranslator.cpp b/openstudiocore/src/contam/ForwardTranslator.cpp index a03c59f4a76..0d8b0f90b7e 100644 --- a/openstudiocore/src/contam/ForwardTranslator.cpp +++ b/openstudiocore/src/contam/ForwardTranslator.cpp @@ -400,7 +400,7 @@ bool ForwardTranslator::modelToPrj(const openstudio::model::Model& model, const translator.setTranslateHVAC(translateHVAC); translator.setAirtightnessLevel(leakageDescriptor); - boost::optional prjModel = translator.translate(model); + boost::optional prjModel = translator.translateModel(model); if(prjModel) { boost::optional output = prjModel->toString(); @@ -429,7 +429,7 @@ bool compareElevation(openstudio::model::BuildingStory a, openstudio::model::Bui // This function is altogether too long and needs to be broken up into smaller functions. // This is particularly true for the HVAC translation. -boost::optional ForwardTranslator::translate(model::Model model) +boost::optional ForwardTranslator::translateModel(model::Model model) { m_logSink.setThreadId(QThread::currentThread()); m_logSink.resetStringStream(); @@ -1112,31 +1112,6 @@ boost::optional ForwardTranslator::translate(model::Model mode } -boost::optional ForwardTranslator::translateEpw(openstudio::path epwpath, openstudio::path outpath) -{ - boost::optional epw; - try - { - EpwFile epwFile(epwpath,true); - try - { - epwFile.translateToWth(outpath); - } - catch(...) // Is this going to work? - { - LOG(Error,"Translation of EPW file failed, weather will be steady state"); - return false; - } - epw = boost::optional(epwFile); - } - catch(...) - { - LOG(Error,"Failed to correctly load EPW file, weather will be steady state"); - return false; - } - return epw; -} - static double laminarCoefficient(double Ct, double x) { // Ct turbulent flow coefficient diff --git a/openstudiocore/src/contam/ForwardTranslator.hpp b/openstudiocore/src/contam/ForwardTranslator.hpp index e2e0b6597dc..3212d4499fb 100644 --- a/openstudiocore/src/contam/ForwardTranslator.hpp +++ b/openstudiocore/src/contam/ForwardTranslator.hpp @@ -47,7 +47,8 @@ namespace contam{ * www.bfrl.nist.gov/IAQanalysis/CONTAM/manual/Content/html/IDH_UsingControls_CVF.htm * * Data is input as TimeSeries that should cover the entire time period to - * be simulated. + * be simulated. TimeSeries with Celcius units will be converted to Kelvin + * on output. All other TimeSeries should be in the units CONTAM expects. * */ class CONTAM_API CvFile @@ -75,7 +76,7 @@ class CONTAM_API CvFile * * ForwardTranslator translates an OpenStudio energy model into a CONTAM * airflow model using a streamlined approach. Each wall is assigned an - * overall leakage rate, and individual components are not presently + * overall leakage rate and individual components are not presently * represented. * */ @@ -84,25 +85,18 @@ class CONTAM_API ForwardTranslator public: ForwardTranslator(); - // Clear out the translator and reset to the defaults - void clear(); - - // Translator - boost::optional translate(model::Model model); + // Translation function + boost::optional translateModel(model::Model model); // Static translation function static bool modelToPrj(const openstudio::model::Model& model, const openstudio::path& path, bool translateHVAC=true, std::string leakageDescriptor="Average", ProgressBar* progressBar=NULL); - // Secondary translation functions - this doesn't really fit here any more, so maybe it needs - // to be moved elsewhere, could be made static - boost::optional translateEpw(openstudio::path epwpath, openstudio::path outpath); - // Accessors to the element maps std::map surfaceMap() const {return m_surfaceMap;} std::map zoneMap() const {return m_zoneMap;} - // Getters and setters - the setters modify how translation + // Getters and setters - the setters modify how translation is done // Setters that could fail return a boolean boost::optional airtightnessLevel() const; void setAirtightnessLevel(std::string level); @@ -119,9 +113,6 @@ class CONTAM_API ForwardTranslator boost::optional startDateTime() const; boost::optional endDateTime() const; - // We may need more functions like this that modify the CONTAM model - int addNewAirflowElement(contam::PrjModel prjModel,std::string name,double flow,double n=0.65,double deltaP=75.0); - // Write control files bool writeCvFile(openstudio::path filepath); @@ -132,9 +123,16 @@ class CONTAM_API ForwardTranslator std::vector errors() const; private: + // Do the work to set up the leakage paths bool applyExteriorFlowRate(contam::PrjModel prjModel); bool applyAirtightnessLevel(contam::PrjModel prjModel); + // Convenience function to add a new one-point test airflow element to the model + int addNewAirflowElement(contam::PrjModel prjModel,std::string name,double flow,double n=0.65,double deltaP=75.0); + + // Clear out the translator and reset to the defaults + void clear(); + // Really need to look at these and determine if they are really needed int tableLookup(QMap map, std::string str, const char *name); int tableLookup(QMap map, Handle handle, const char *name); @@ -142,7 +140,7 @@ class CONTAM_API ForwardTranslator std::string reverseLookup(QMap map, int nr, const char *name); Handle reverseLookup(QMap map, int nr, const char *name); - // Maps - will be populated after a call of translateToPrj + // Maps - will be populated after a call of translateModel // All map to the CONTAM index (1,2,...,nElement) std::map m_afeMap; // Map from descriptor ("exterior", "floor", etc.) to CONTAM airflow element index QMap m_levelMap; // Building story to level map by handle