diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ed6a79c96..6517142547 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -560,11 +560,6 @@ endif() # EnergyPlus -if((DEFINED ENERGYPLUS_EXE) AND NOT (ENERGYPLUS_EXE STREQUAL "")) - get_filename_component(OLD_ENERGYPLUS_EXTRACTED_DIR "${ENERGYPLUS_EXE}" DIRECTORY) - message("OLD_ENERGYPLUS_EXTRACTED_DIR=${OLD_ENERGYPLUS_EXTRACTED_DIR}") -endif() - if(UNIX) if(APPLE) set(ENERGYPLUS_EXPECTED_HASH 0bf64f4b153a87c3a4822321bc5878e1) @@ -601,10 +596,6 @@ if(UNIX) EXPECTED_MD5 ${ENERGYPLUS_EXPECTED_HASH}) endif() - # Remove the old extracted dir if exists - if(DEFINED OLD_ENERGYPLUS_EXTRACTED_DIR) - execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${OLD_ENERGYPLUS_EXTRACTED_DIR}") - endif() execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${PROJECT_BINARY_DIR}/${ENERGYPLUS_PATH}") endif() @@ -630,16 +621,30 @@ elseif(WIN32) SHOW_PROGRESS EXPECTED_MD5 ${ENERGYPLUS_EXPECTED_HASH}) - # Remove the old extracted dir if exists - if(DEFINED OLD_ENERGYPLUS_EXTRACTED_DIR) - execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${OLD_ENERGYPLUS_EXTRACTED_DIR}") - endif() execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${PROJECT_BINARY_DIR}/${ENERGYPLUS_PATH}") endif() endif() +if((DEFINED ENERGYPLUS_EXE) AND NOT (ENERGYPLUS_EXE STREQUAL "")) + get_filename_component(OLD_ENERGYPLUS_EXTRACTED_DIR "${ENERGYPLUS_EXE}" DIRECTORY) + if(NOT "${OLD_ENERGYPLUS_EXTRACTED_DIR}" MATCHES ".*${ENERGYPLUS_PATH}.*") + + message(STATUS "Removing old extracted dir = ${OLD_ENERGYPLUS_EXTRACTED_DIR}") + # Remove the old extracted dir + execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${OLD_ENERGYPLUS_EXTRACTED_DIR}") + + # Unset variables so that FindEnergyPlus is called again + unset(ENERGYPLUS_FOUND CACHE) + unset(ENERGYPLUS_EXE CACHE) + unset(ENERGYPLUS_IDD CACHE) + unset(ENERGYPLUS_WEATHER_DIR CACHE) + + endif() +endif() + + # Allows placing the archive manually in the build dir too if (NOT EXISTS "${ENERGYPLUS_PATH}") unset(ENERGYPLUS_FOUND CACHE) diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index df95ee93f9..8554c1170b 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -88,6 +88,7 @@ set(utilities_resources_src utilities/SqlFile/1ZoneEvapCooler-V9-2-0.sql utilities/SqlFile/1ZoneEvapCooler-V9-3-0.sql utilities/SqlFile/1ZoneEvapCooler-V9-4-0.sql + utilities/SqlFile/1ZoneEvapCooler-V9-5-0.sql utilities/Zip/test1.zip ) diff --git a/resources/energyplus/5ZoneAirCooled/in.idf b/resources/energyplus/5ZoneAirCooled/in.idf index 24cb80a810..734915ac5b 100644 --- a/resources/energyplus/5ZoneAirCooled/in.idf +++ b/resources/energyplus/5ZoneAirCooled/in.idf @@ -100,7 +100,7 @@ ! Environmental Emissions: None ! Utility Tariffs: None - Version,9.4; + Version,9.5; Building, Building, !- Name diff --git a/resources/energyplus/BestestEx/in.idf b/resources/energyplus/BestestEx/in.idf index 785ceeed36..67c10ef36e 100644 --- a/resources/energyplus/BestestEx/in.idf +++ b/resources/energyplus/BestestEx/in.idf @@ -5,7 +5,7 @@ !BESTEST-EX Case L200EX-PH BASE-CASE, developed by NREL !Use EnergyPlus IDFEditor to view inputs in IP units - Version,9.4; + Version,9.5; SimulationControl, No, !- Do Zone Sizing Calculation diff --git a/resources/energyplus/Daylighting_Office/in.idf b/resources/energyplus/Daylighting_Office/in.idf index 1c183db076..dc1d1dd7e0 100644 --- a/resources/energyplus/Daylighting_Office/in.idf +++ b/resources/energyplus/Daylighting_Office/in.idf @@ -140,7 +140,7 @@ ! schedule types, always on schedule, misc ! ***GENERAL SIMULATION PARAMETERS*** - Version,9.4; + Version,9.5; SimulationControl, YES, !- Do Zone Sizing Calculation diff --git a/resources/energyplus/Daylighting_School/in.idf b/resources/energyplus/Daylighting_School/in.idf index e0cb6aa521..2cea262e21 100644 --- a/resources/energyplus/Daylighting_School/in.idf +++ b/resources/energyplus/Daylighting_School/in.idf @@ -33,7 +33,7 @@ ! WeatherFileName=USA_CO_Boulder_TMY2.epw ! End SimMetaData - Version,9.4; + Version,9.5; Timestep,6; diff --git a/resources/energyplus/HospitalBaseline/in.idf b/resources/energyplus/HospitalBaseline/in.idf index 1dfdde52e4..1c7afe374d 100644 --- a/resources/energyplus/HospitalBaseline/in.idf +++ b/resources/energyplus/HospitalBaseline/in.idf @@ -100,7 +100,7 @@ ! End SimMetaData ! Number of Zones: 130 - Version,9.4; + Version,9.5; Timestep,6; diff --git a/resources/energyplus/NewFileTemplate.idf b/resources/energyplus/NewFileTemplate.idf index 02ae2f0b08..2b889e41ff 100644 --- a/resources/energyplus/NewFileTemplate.idf +++ b/resources/energyplus/NewFileTemplate.idf @@ -1,6 +1,6 @@ !- =========== ALL OBJECTS IN CLASS: VERSION =========== - Version,9.4; + Version,9.5; !- =========== ALL OBJECTS IN CLASS: BUILDING =========== diff --git a/resources/energyplus/Office_With_Many_HVAC_Types/in.idf b/resources/energyplus/Office_With_Many_HVAC_Types/in.idf index 7cd4de5302..bd2a032f66 100644 --- a/resources/energyplus/Office_With_Many_HVAC_Types/in.idf +++ b/resources/energyplus/Office_With_Many_HVAC_Types/in.idf @@ -1,4 +1,4 @@ - Version,9.4; + Version,9.5; Building, Building 1, !- Name diff --git a/resources/energyplus/RefLargeOffice/RefBldgLargeOfficeNew2004_Chicago.idf b/resources/energyplus/RefLargeOffice/RefBldgLargeOfficeNew2004_Chicago.idf index 612af7e666..d353e7249e 100644 --- a/resources/energyplus/RefLargeOffice/RefBldgLargeOfficeNew2004_Chicago.idf +++ b/resources/energyplus/RefLargeOffice/RefBldgLargeOfficeNew2004_Chicago.idf @@ -68,7 +68,7 @@ ! ***GENERAL SIMULATION PARAMETERS*** ! Number of Zones: 19 - Version,9.4; + Version,9.5; SimulationControl, YES, !- Do Zone Sizing Calculation diff --git a/resources/energyplus/ScheduleFile/in.idf b/resources/energyplus/ScheduleFile/in.idf index 976ff88b48..0c27ffdafa 100644 --- a/resources/energyplus/ScheduleFile/in.idf +++ b/resources/energyplus/ScheduleFile/in.idf @@ -1,4 +1,4 @@ - Version,9.4; + Version,9.5; Timestep,4; diff --git a/resources/energyplus/SimpleSurfaces/4ZoneWithShading_Simple_2.idf b/resources/energyplus/SimpleSurfaces/4ZoneWithShading_Simple_2.idf index 2c1d523d81..37ae46aab1 100644 --- a/resources/energyplus/SimpleSurfaces/4ZoneWithShading_Simple_2.idf +++ b/resources/energyplus/SimpleSurfaces/4ZoneWithShading_Simple_2.idf @@ -81,7 +81,7 @@ ! Environmental Emissions: None ! Utility Tariffs: None - Version,9.4; + Version,9.5; Timestep,4; diff --git a/resources/energyplus/SimpleSurfaces/SimpleSurfaces_Reference.idf b/resources/energyplus/SimpleSurfaces/SimpleSurfaces_Reference.idf index 557995bb25..e4ab6c3081 100644 --- a/resources/energyplus/SimpleSurfaces/SimpleSurfaces_Reference.idf +++ b/resources/energyplus/SimpleSurfaces/SimpleSurfaces_Reference.idf @@ -1,7 +1,7 @@ ! Basecase reference for SimpleSurfaces_Test !- =========== ALL OBJECTS IN CLASS: VERSION =========== - Version,9.4; + Version,9.5; !- =========== ALL OBJECTS IN CLASS: BUILDING =========== diff --git a/resources/energyplus/SimpleSurfaces/SimpleSurfaces_Relative.idf b/resources/energyplus/SimpleSurfaces/SimpleSurfaces_Relative.idf index 6944305715..0a625be0f0 100644 --- a/resources/energyplus/SimpleSurfaces/SimpleSurfaces_Relative.idf +++ b/resources/energyplus/SimpleSurfaces/SimpleSurfaces_Relative.idf @@ -1,7 +1,7 @@ ! File to test the import of simple surfaces !- =========== ALL OBJECTS IN CLASS: VERSION =========== - Version,9.4; + Version,9.5; !- =========== ALL OBJECTS IN CLASS: BUILDING =========== diff --git a/resources/energyplus/SmallOffice/SmallOffice.idf b/resources/energyplus/SmallOffice/SmallOffice.idf index e91ad81a3d..2bc1dcf20d 100644 --- a/resources/energyplus/SmallOffice/SmallOffice.idf +++ b/resources/energyplus/SmallOffice/SmallOffice.idf @@ -67,7 +67,7 @@ ! ExtWallConstruction=Mass ! End SimMetaData - Version,9.4; + Version,9.5; Timestep,6; @@ -5814,7 +5814,7 @@ UtilityCost:Tariff, IN_EIAMonthlyRateGas, !- Name - NaturalGas:Facility, !- Output Meter Name + NaturalGas:Facility, !- Output Meter Name MCF, !- Conversion Factor Choice , !- Energy Conversion Factor , !- Demand Conversion Factor diff --git a/resources/energyplus/ZoneBoundaryCondition/Bug_486_zone_bdr_test.idf b/resources/energyplus/ZoneBoundaryCondition/Bug_486_zone_bdr_test.idf index 30b60094e0..b6d94d0fd4 100644 --- a/resources/energyplus/ZoneBoundaryCondition/Bug_486_zone_bdr_test.idf +++ b/resources/energyplus/ZoneBoundaryCondition/Bug_486_zone_bdr_test.idf @@ -1,6 +1,6 @@ !- =========== ALL OBJECTS IN CLASS: VERSION =========== - Version,9.4; + Version,9.5; !- =========== ALL OBJECTS IN CLASS: BUILDING =========== diff --git a/resources/model/OpenStudio.idd b/resources/model/OpenStudio.idd index 75f0127b16..8f794e841f 100644 --- a/resources/model/OpenStudio.idd +++ b/resources/model/OpenStudio.idd @@ -10198,6 +10198,7 @@ OS:AirLoopHVAC:OutdoorAirSystem, A2, \field Name \type alpha \required-field + \reference AirLoopHVACOASysNames \reference ConnectionObject A3, \field Controller Name \type object-list @@ -10229,6 +10230,54 @@ OS:AirLoopHVAC:OutdoorAirSystem, \required-field \object-list ConnectionNames +OS:AirLoopHVAC:DedicatedOutdoorAirSystem, + \extensible:1 Just duplicate last field and comments (changing numbering, please) + \min-fields 9 + \memo Defines a central forced air system to provide dedicated outdoor air to multiple + \memo AirLoopHVACs. + A1, \field Handle + \type handle + \required-field + A2, \field Name + \required-field + \type alpha + \reference DOASAirLoops + \reference ConnectionObject + A3, \field Outdoor Air System + \note Enter the name of an AirLoopHVAC:OutdoorAirSystem object. + \required-field + \type object-list + \object-list AirLoopHVACOASysNames + \object-list ConnectionObject + A4, \field Availability Schedule + \note Availability schedule name for this system. Schedule value > 0 means the system is available. + \note If this field is blank, the system is always available. + \required-field + \type object-list + \object-list ScheduleNames + N1, \field Preheat Design Temperature + \required-field + \type real + \units C + N2, \field Preheat Design Humidity Ratio + \required-field + \type real + \units kgWater/kgDryAir + N3, \field Precool Design Temperature + \required-field + \type real + \units C + N4, \field Precool Design Humidity Ratio + \required-field + \type real + \units kgWater/kgDryAir + A5; \field Air Loop 1 + \note The rest of fields are extensible. It requires AirLoopHVAC names served by + \note an AirLoopHVAC:DedicatedOutdoorAirSystem. + \begin-extensible + \type object-list + \object-list AirPrimaryLoops + OS:AirLoopHVAC:ReturnPlenum, \extensible:1 Just duplicate last field and comments (changing numbering, please) \min-fields 1 diff --git a/resources/utilities/Idf/CommentTest.idf b/resources/utilities/Idf/CommentTest.idf index 9d88ffb89f..ed58f34b49 100644 --- a/resources/utilities/Idf/CommentTest.idf +++ b/resources/utilities/Idf/CommentTest.idf @@ -2,7 +2,7 @@ ! Written by Elaine T. Hale, 15 September 2010 ! Version object should keep up with EnergyPlus version number. - Version,9.4; + Version,9.5; ! Timestep should be > 1. diff --git a/resources/utilities/Idf/DosLineEndingTest.idf b/resources/utilities/Idf/DosLineEndingTest.idf index 9d88ffb89f..ed58f34b49 100644 --- a/resources/utilities/Idf/DosLineEndingTest.idf +++ b/resources/utilities/Idf/DosLineEndingTest.idf @@ -2,7 +2,7 @@ ! Written by Elaine T. Hale, 15 September 2010 ! Version object should keep up with EnergyPlus version number. - Version,9.4; + Version,9.5; ! Timestep should be > 1. diff --git a/resources/utilities/Idf/FormatPropertyTest_Formatted.idf b/resources/utilities/Idf/FormatPropertyTest_Formatted.idf index 72a722f6fc..e829186f21 100644 --- a/resources/utilities/Idf/FormatPropertyTest_Formatted.idf +++ b/resources/utilities/Idf/FormatPropertyTest_Formatted.idf @@ -5,7 +5,7 @@ !- =========== ALL OBJECTS IN CLASS: VERSION =========== ! \format singleLine - Version,9.4; + Version,9.5; !- =========== ALL OBJECTS IN CLASS: HEATBALANCEALGORITHM =========== ! \format singleLine diff --git a/resources/utilities/Idf/FormatPropertyTest_Unformatted.idf b/resources/utilities/Idf/FormatPropertyTest_Unformatted.idf index 90c30e8eb9..a80e29a50d 100644 --- a/resources/utilities/Idf/FormatPropertyTest_Unformatted.idf +++ b/resources/utilities/Idf/FormatPropertyTest_Unformatted.idf @@ -5,7 +5,7 @@ !- =========== ALL OBJECTS IN CLASS: VERSION =========== ! \format singleLine - Version,9.4; + Version,9.5; !- =========== ALL OBJECTS IN CLASS: HEATBALANCEALGORITHM =========== ! \format singleLine diff --git a/resources/utilities/Idf/MixedLineEndingTest.idf b/resources/utilities/Idf/MixedLineEndingTest.idf index 9d88ffb89f..ed58f34b49 100644 --- a/resources/utilities/Idf/MixedLineEndingTest.idf +++ b/resources/utilities/Idf/MixedLineEndingTest.idf @@ -2,7 +2,7 @@ ! Written by Elaine T. Hale, 15 September 2010 ! Version object should keep up with EnergyPlus version number. - Version,9.4; + Version,9.5; ! Timestep should be > 1. diff --git a/resources/utilities/Idf/UnixLineEndingTest.idf b/resources/utilities/Idf/UnixLineEndingTest.idf index 9d88ffb89f..ed58f34b49 100644 --- a/resources/utilities/Idf/UnixLineEndingTest.idf +++ b/resources/utilities/Idf/UnixLineEndingTest.idf @@ -2,7 +2,7 @@ ! Written by Elaine T. Hale, 15 September 2010 ! Version object should keep up with EnergyPlus version number. - Version,9.4; + Version,9.5; ! Timestep should be > 1. diff --git a/resources/utilities/SqlFile/1ZoneEvapCooler-V9-5-0-IOFreeze.idf b/resources/utilities/SqlFile/1ZoneEvapCooler-V9-5-0-IOFreeze.idf new file mode 100644 index 0000000000..57646a0701 --- /dev/null +++ b/resources/utilities/SqlFile/1ZoneEvapCooler-V9-5-0-IOFreeze.idf @@ -0,0 +1,638 @@ +!-Generator IDFEditor 1.34 +!-Option OriginalOrderTop UseSpecialFormat +!-NOTE: All comments with '!-' are ignored by the IDFEditor and are generated automatically. +!- Use '!' comments if they need to be retained when using the IDFEditor. +! 1ZoneEvapCooler.idf +! +! Basic file description: This file models a small one-zone house with a whole-house direct evaporative cooler system. +! Because evaporative coolers cannot be controlled with the ZoneControl:Thermostat object, +! this file illustrates how an evaporative cooler system can be thermostatically controlled +! in a crude manner using the AvailabilityManager objects: +! +! AvailabilityManager:LowTemperatureTurnOff +! AvailabilityManager:HighTemperatureTurnOn +! +! Availability managers are capable of turning on or off the fan for an air system (or the pump +! for a plant system) by monitoring temperature conditions at a user-specified system node. +! In this model, the availability managers are monitoring the zone outlet air node to act as +! a crude thermostatic control for the zone. +! +! Keep in mind that availability manager control is "lagged". This means that the node +! conditions from the previous time step are used to make control decisions at the current +! time step. +! +! There are two ways to use the availability managers for controlling an evaporative cooler: +! +! Method 1. The fan is scheduled to be available at all times, meaning that the system +! is on all the time by default. This usually results in over-cooling. +! To prevent over-cooling, the LOW TEMPERATURE TURN OFF object is used to +! turn off the system fan when the temperature falls below the setpoint (23 C). +! +! Method 2. The fan is scheduled to be unavailable at all times, meaning that the system +! is off all the time by default. This usually results in under-cooling. +! To prevent under-cooling, the HIGH TEMPERATURE TURN ON object is used to +! turn on the system fan when the temperature rises above the setpoint (26 C). +! +! With either method, all other equipment is scheduled to be always available. In this file, +! for demonstration purposes only, the fan is scheduled to be available from 12 AM-12 PM to +! to demonstrate Method 1, and scheduled to be unavailable from 12 PM-12 AM for Method 2. +! +! Note that ZoneControl:Thermostat is still used in this model to control the baseboard +! heating in the winter, but it does not effect the evaporative cooler system. +! +! Highlights: Test of AvailabilityManagers for controlling an air system. +! +! Simulation Location/Run: DENVER_STAPLETON_CO_USA_WMO_724690, 2 design days, 1 run period, +! Run Control executes two design days (see RUN PERIOD object) +! +! Location: Denver, CO +! +! Design Days: DENVER_STAPLETON_CO_USA Annual Heating 99%, MaxDB=-16°C +! DENVER_STAPLETON_CO_USA Annual Cooling (DB=>MWB) 1%, MaxDB=32.6°C MWB=15.5°C +! +! Run Period (Weather File): Full Annual Simulation, DENVER_STAPLETON_CO_USA_WMO_724690 +! +! Run Control: No zone or system sizing, design day run control (no weather file simulation) +! +! Building: Fictional 1 zone building with resistive walls based on 1ZoneUncontrolled example. +! No windows. No internal gains. No internal mass. The building is oriented due north. +! +! Floor Area: 232.25 m2 +! Number of Stories: 1 + + Version,9.5; + + Timestep,6; + + Building, + Bldg, !- Name + 0.0, !- North Axis {deg} + Suburbs, !- Terrain + 0.05, !- Loads Convergence Tolerance Value {W} + 0.05, !- Temperature Convergence Tolerance Value {deltaC} + MinimalShadowing, !- Solar Distribution + 30, !- Maximum Number of Warmup Days + 6; !- Minimum Number of Warmup Days + + HeatBalanceAlgorithm,ConductionTransferFunction; + + SurfaceConvectionAlgorithm:Inside,TARP; + + SurfaceConvectionAlgorithm:Outside,DOE-2; + + SimulationControl, + No, !- Do Zone Sizing Calculation + No, !- Do System Sizing Calculation + No, !- Do Plant Sizing Calculation + Yes, !- Run Simulation for Sizing Periods + Yes, !- Run Simulation for Weather File Run Periods + No, !- Do HVAC Sizing Simulation for Sizing Periods + 1; !- Maximum Number of HVAC Sizing Simulation Passes + + RunPeriod, + Run Period 1, !- Name + 1, !- Begin Month + 1, !- Begin Day of Month + , !- Begin Year + 12, !- End Month + 31, !- End Day of Month + , !- End Year + Tuesday, !- Day of Week for Start Day + Yes, !- Use Weather File Holidays and Special Days + Yes, !- Use Weather File Daylight Saving Period + No, !- Apply Weekend Holiday Rule + Yes, !- Use Weather File Rain Indicators + Yes; !- Use Weather File Snow Indicators + + Site:Location, + Denver Centennial CO USA WMO=724666, !- Name + 39.74, !- Latitude {deg} + -105.18, !- Longitude {deg} + -7.00, !- Time Zone {hr} + 1793.00; !- Elevation {m} + + ! WMO=724666 Time Zone=NAM (GMT-07:00) Mountain Time (US & Canada) + ! Data Source=ASHRAE 2009 Annual Design Conditions + ! Using Design Conditions from "Climate Design Data 2009 ASHRAE Handbook" + ! Denver Centennial CO USA Extreme Annual Wind Speeds, 1%=11.1m/s, 2.5%=9.5m/s, 5%=8.4m/s + ! Denver Centennial CO USA Extreme Annual Temperatures, Max Drybulb=-22.9°C Min Drybulb=36.1°C + ! Denver Centennial CO USA Annual Heating Design Conditions Wind Speed=3m/s Wind Dir=340 + ! Coldest Month=December + ! Denver Centennial CO USA Annual Heating 99.6%, MaxDB=-18.8°C + + SizingPeriod:DesignDay, + Denver Centennial Ann Htg 99.6% Condns DB, !- Name + 12, !- Month + 21, !- Day of Month + WinterDesignDay, !- Day Type + -18.8, !- Maximum Dry-Bulb Temperature {C} + 0.0, !- Daily Dry-Bulb Temperature Range {deltaC} + , !- Dry-Bulb Temperature Range Modifier Type + , !- Dry-Bulb Temperature Range Modifier Day Schedule Name + Wetbulb, !- Humidity Condition Type + -18.8, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C} + , !- Humidity Condition Day Schedule Name + , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir} + , !- Enthalpy at Maximum Dry-Bulb {J/kg} + , !- Daily Wet-Bulb Temperature Range {deltaC} + 81560., !- Barometric Pressure {Pa} + 3, !- Wind Speed {m/s} + 340, !- Wind Direction {deg} + No, !- Rain Indicator + No, !- Snow Indicator + No, !- Daylight Saving Time Indicator + ASHRAEClearSky, !- Solar Model Indicator + , !- Beam Solar Day Schedule Name + , !- Diffuse Solar Day Schedule Name + , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless} + , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless} + 0.00; !- Sky Clearness + + ! Denver Centennial Annual Cooling Design Conditions Wind Speed=4.9m/s Wind Dir=0 + ! Hottest Month=July + ! Denver Centennial CO USA Annual Cooling (DB=>MWB) 1%, MaxDB=32°C MWB=15.5°C + + SizingPeriod:DesignDay, + Denver Centennial Ann Clg 1% Condns DB=>MWB, !- Name + 7, !- Month + 21, !- Day of Month + SummerDesignDay, !- Day Type + 32, !- Maximum Dry-Bulb Temperature {C} + 15.2, !- Daily Dry-Bulb Temperature Range {deltaC} + , !- Dry-Bulb Temperature Range Modifier Type + , !- Dry-Bulb Temperature Range Modifier Day Schedule Name + Wetbulb, !- Humidity Condition Type + 15.5, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C} + , !- Humidity Condition Day Schedule Name + , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir} + , !- Enthalpy at Maximum Dry-Bulb {J/kg} + , !- Daily Wet-Bulb Temperature Range {deltaC} + 81560., !- Barometric Pressure {Pa} + 4.9, !- Wind Speed {m/s} + 0, !- Wind Direction {deg} + No, !- Rain Indicator + No, !- Snow Indicator + No, !- Daylight Saving Time Indicator + ASHRAEClearSky, !- Solar Model Indicator + , !- Beam Solar Day Schedule Name + , !- Diffuse Solar Day Schedule Name + , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless} + , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless} + 1.00; !- Sky Clearness + + Material:NoMass, + R13LAYER, !- Name + Rough, !- Roughness + 2.290965, !- Thermal Resistance {m2-K/W} + 0.9000000, !- Thermal Absorptance + 0.7500000, !- Solar Absorptance + 0.7500000; !- Visible Absorptance + + Material:NoMass, + R31LAYER, !- Name + Rough, !- Roughness + 5.456, !- Thermal Resistance {m2-K/W} + 0.9000000, !- Thermal Absorptance + 0.7500000, !- Solar Absorptance + 0.7500000; !- Visible Absorptance + + Material, + C5 - 4 IN HW CONCRETE, !- Name + MediumRough, !- Roughness + 0.1014984, !- Thickness {m} + 1.729577, !- Conductivity {W/m-K} + 2242.585, !- Density {kg/m3} + 836.8000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.6500000, !- Solar Absorptance + 0.6500000; !- Visible Absorptance + + Construction, + R13WALL, !- Name + R13LAYER; !- Outside Layer + + Construction, + FLOOR, !- Name + C5 - 4 IN HW CONCRETE; !- Outside Layer + + Construction, + ROOF31, !- Name + R31LAYER; !- Outside Layer + + Site:GroundTemperature:BuildingSurface,18.89,18.92,19.02,19.12,19.21,19.23,19.07,19.32,19.09,19.21,19.13,18.96; + + Zone, + Main Zone, !- Name + 0, !- Direction of Relative North {deg} + 0, !- X Origin {m} + 0, !- Y Origin {m} + 0, !- Z Origin {m} + 1, !- Type + 1, !- Multiplier + autocalculate, !- Ceiling Height {m} + autocalculate; !- Volume {m3} + + ScheduleTypeLimits, + Fraction, !- Name + 0.0, !- Lower Limit Value + 1.0, !- Upper Limit Value + CONTINUOUS; !- Numeric Type + + GlobalGeometryRules, + UpperLeftCorner, !- Starting Vertex Position + CounterClockWise, !- Vertex Entry Direction + World; !- Coordinate System + + BuildingSurface:Detailed, + Zn001:Wall001, !- Name + Wall, !- Surface Type + R13WALL, !- Construction Name + Main Zone, !- Zone Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.5000000, !- View Factor to Ground + 4, !- Number of Vertices + 0,0,4.572000, !- X,Y,Z ==> Vertex 1 {m} + 0,0,0, !- X,Y,Z ==> Vertex 2 {m} + 15.24000,0,0, !- X,Y,Z ==> Vertex 3 {m} + 15.24000,0,4.572000; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + Zn001:Wall002, !- Name + Wall, !- Surface Type + R13WALL, !- Construction Name + Main Zone, !- Zone Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.5000000, !- View Factor to Ground + 4, !- Number of Vertices + 15.24000,0,4.572000, !- X,Y,Z ==> Vertex 1 {m} + 15.24000,0,0, !- X,Y,Z ==> Vertex 2 {m} + 15.24000,15.24000,0, !- X,Y,Z ==> Vertex 3 {m} + 15.24000,15.24000,4.572000; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + Zn001:Wall003, !- Name + Wall, !- Surface Type + R13WALL, !- Construction Name + Main Zone, !- Zone Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.5000000, !- View Factor to Ground + 4, !- Number of Vertices + 15.24000,15.24000,4.572000, !- X,Y,Z ==> Vertex 1 {m} + 15.24000,15.24000,0, !- X,Y,Z ==> Vertex 2 {m} + 0,15.24000,0, !- X,Y,Z ==> Vertex 3 {m} + 0,15.24000,4.572000; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + Zn001:Wall004, !- Name + Wall, !- Surface Type + R13WALL, !- Construction Name + Main Zone, !- Zone Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.5000000, !- View Factor to Ground + 4, !- Number of Vertices + 0,15.24000,4.572000, !- X,Y,Z ==> Vertex 1 {m} + 0,15.24000,0, !- X,Y,Z ==> Vertex 2 {m} + 0,0,0, !- X,Y,Z ==> Vertex 3 {m} + 0,0,4.572000; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + Zn001:Flr001, !- Name + Floor, !- Surface Type + FLOOR, !- Construction Name + Main Zone, !- Zone Name + Surface, !- Outside Boundary Condition + Zn001:Flr001, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 1.000000, !- View Factor to Ground + 4, !- Number of Vertices + 15.24000,0.000000,0.0, !- X,Y,Z ==> Vertex 1 {m} + 0.000000,0.000000,0.0, !- X,Y,Z ==> Vertex 2 {m} + 0.000000,15.24000,0.0, !- X,Y,Z ==> Vertex 3 {m} + 15.24000,15.24000,0.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + Zn001:Roof001, !- Name + Roof, !- Surface Type + ROOF31, !- Construction Name + Main Zone, !- Zone Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0, !- View Factor to Ground + 4, !- Number of Vertices + 0.000000,15.24000,4.572, !- X,Y,Z ==> Vertex 1 {m} + 0.000000,0.000000,4.572, !- X,Y,Z ==> Vertex 2 {m} + 15.24000,0.000000,4.572, !- X,Y,Z ==> Vertex 3 {m} + 15.24000,15.24000,4.572; !- X,Y,Z ==> Vertex 4 {m} + + ZoneInfiltration:DesignFlowRate, + Main Zone Infiltration, !- Name + Main Zone, !- Zone or ZoneList Name + System Availability Schedule, !- Schedule Name + Flow/Zone, !- Design Flow Rate Calculation Method + 0.02, !- Design Flow Rate {m3/s} + , !- Flow per Zone Floor Area {m3/s-m2} + , !- Flow per Exterior Surface Area {m3/s-m2} + , !- Air Changes per Hour {1/hr} + 1.0000, !- Constant Term Coefficient + 0.0000, !- Temperature Term Coefficient + 0.0000, !- Velocity Term Coefficient + 0.0000; !- Velocity Squared Term Coefficient + + ScheduleTypeLimits, + Any Number; !- Name + + Schedule:Compact, + System Availability Schedule, !- Name + Any Number, !- Schedule Type Limits Name + THROUGH: 12/31, !- Field 1 + FOR: AllDays, !- Field 2 + UNTIL: 24:00,1; !- Field 3 + + Schedule:Compact, + Fan Availability Schedule, !- Name + Any Number, !- Schedule Type Limits Name + THROUGH: 12/31, !- Field 1 + FOR: AllDays, !- Field 2 + UNTIL: 12:00,1, !- Field 3 + UNTIL: 24:00,0; !- Field 5 + + AirLoopHVAC, + Evap Cooler System, !- Name + , !- Controller List Name + Evap Cooler Availability List, !- Availability Manager List Name + 2.0, !- Design Supply Air Flow Rate {m3/s} + Air Loop Branches, !- Branch List Name + , !- Connector List Name + Supply Inlet Node, !- Supply Side Inlet Node Name + Zone Equipment Outlet Node, !- Demand Side Outlet Node Name + Zone Equipment Inlet Node, !- Demand Side Inlet Node Names + Supply Outlet Node; !- Supply Side Outlet Node Names + + AvailabilityManagerAssignmentList, + Evap Cooler Availability List, !- Name + AvailabilityManager:LowTemperatureTurnOff, !- Availability Manager 1 Object Type + Low Temperature Turn Off Availability Manager, !- Availability Manager 1 Name + AvailabilityManager:HighTemperatureTurnOn, !- Availability Manager 2 Object Type + High Temperature Turn On Availability Manager; !- Availability Manager 2 Name + + AvailabilityManager:LowTemperatureTurnOff, + Low Temperature Turn Off Availability Manager, !- Name + Main Zone Outlet Node, !- Sensor Node Name + 23.0; !- Temperature {C} + + AvailabilityManager:HighTemperatureTurnOn, + High Temperature Turn On Availability Manager, !- Name + Main Zone Outlet Node, !- Sensor Node Name + 27.0; !- Temperature {C} + + BranchList, + Air Loop Branches, !- Name + Air Loop Main Branch; !- Branch 1 Name + + Branch, + Air Loop Main Branch, !- Name + , !- Pressure Drop Curve Name + AirLoopHVAC:OutdoorAirSystem, !- Component 1 Object Type + Outside Air System, !- Component 1 Name + Supply Inlet Node, !- Component 1 Inlet Node Name + Fan Inlet Node, !- Component 1 Outlet Node Name + Fan:ConstantVolume, !- Component 2 Object Type + Supply Fan, !- Component 2 Name + Fan Inlet Node, !- Component 2 Inlet Node Name + Evap Cooler Inlet Node, !- Component 2 Outlet Node Name + EvaporativeCooler:Direct:CelDekPad, !- Component 3 Object Type + Evaporative Cooler, !- Component 3 Name + Evap Cooler Inlet Node, !- Component 3 Inlet Node Name + Supply Outlet Node; !- Component 3 Outlet Node Name + + AirLoopHVAC:OutdoorAirSystem, + Outside Air System, !- Name + Outside Air System Controllers, !- Controller List Name + Outside Air System Equipment, !- Outdoor Air Equipment List Name + Evap Cooler Availability List; !- Availability Manager List Name + + OutdoorAir:Node, + Outside Air Inlet Node; !- Name + + AirLoopHVAC:ControllerList, + Outside Air System Controllers, !- Name + Controller:OutdoorAir, !- Controller 1 Object Type + Outside Air Controller; !- Controller 1 Name + + Controller:OutdoorAir, + Outside Air Controller, !- Name + Relief Air Outlet Node, !- Relief Air Outlet Node Name + Supply Inlet Node, !- Return Air Node Name + Fan Inlet Node, !- Mixed Air Node Name + Outside Air Inlet Node, !- Actuator Node Name + 2.0, !- Minimum Outdoor Air Flow Rate {m3/s} + 2.0, !- Maximum Outdoor Air Flow Rate {m3/s} + NoEconomizer, !- Economizer Control Type + ModulateFlow, !- Economizer Control Action Type + 19., !- Economizer Maximum Limit Dry-Bulb Temperature {C} + , !- Economizer Maximum Limit Enthalpy {J/kg} + , !- Economizer Maximum Limit Dewpoint Temperature {C} + , !- Electronic Enthalpy Limit Curve Name + 4., !- Economizer Minimum Limit Dry-Bulb Temperature {C} + NoLockout, !- Lockout Type + FixedMinimum; !- Minimum Limit Type + + AirLoopHVAC:OutdoorAirSystem:EquipmentList, + Outside Air System Equipment, !- Name + OutdoorAir:Mixer, !- Component 1 Object Type + Outside Air Mixing Box; !- Component 1 Name + + OutdoorAir:Mixer, + Outside Air Mixing Box, !- Name + Fan Inlet Node, !- Mixed Air Node Name + Outside Air Inlet Node, !- Outdoor Air Stream Node Name + Relief Air Outlet Node, !- Relief Air Stream Node Name + Supply Inlet Node; !- Return Air Stream Node Name + + Fan:ConstantVolume, + Supply Fan, !- Name + Fan Availability Schedule, !- Availability Schedule Name + 0.7, !- Fan Total Efficiency + 600.0, !- Pressure Rise {Pa} + 2.0, !- Maximum Flow Rate {m3/s} + 0.9, !- Motor Efficiency + 1.0, !- Motor In Airstream Fraction + Fan Inlet Node, !- Air Inlet Node Name + Evap Cooler Inlet Node; !- Air Outlet Node Name + + EvaporativeCooler:Direct:CelDekPad, + Evaporative Cooler, !- Name + System Availability Schedule, !- Availability Schedule Name + 0.6, !- Direct Pad Area {m2} + 0.2, !- Direct Pad Depth {m} + 225, !- Recirculating Water Pump Power Consumption {W} + Evap Cooler Inlet Node, !- Air Inlet Node Name + Supply Outlet Node, !- Air Outlet Node Name + CONSTANT; !- Control Type + + AirLoopHVAC:SupplyPath, + Zone Supply Air Path, !- Name + Zone Equipment Inlet Node, !- Supply Air Path Inlet Node Name + AirLoopHVAC:ZoneSplitter,!- Component 1 Object Type + Zone Supply Air Splitter;!- Component 1 Name + + AirLoopHVAC:ZoneSplitter, + Zone Supply Air Splitter,!- Name + Zone Equipment Inlet Node, !- Inlet Node Name + Main Zone Inlet Node ATInlet; !- Outlet 1 Node Name + + AirLoopHVAC:ReturnPath, + Zone Return Air Path, !- Name + Zone Equipment Outlet Node, !- Return Air Path Outlet Node Name + AirLoopHVAC:ZoneMixer, !- Component 1 Object Type + Zone Return Air Mixer; !- Component 1 Name + + AirLoopHVAC:ZoneMixer, + Zone Return Air Mixer, !- Name + Zone Equipment Outlet Node, !- Outlet Node Name + Main Zone Outlet Node; !- Inlet 1 Node Name + + ZoneHVAC:EquipmentConnections, + Main Zone, !- Zone Name + Main Zone Equipment, !- Zone Conditioning Equipment List Name + Main Zone Inlet Node, !- Zone Air Inlet Node or NodeList Name + , !- Zone Air Exhaust Node or NodeList Name + Main Zone Node, !- Zone Air Node Name + Main Zone Outlet Node; !- Zone Return Air Node or NodeList Name + + ZoneHVAC:EquipmentList, + Main Zone Equipment, !- Name + SequentialLoad, !- Load Distribution Scheme + ZoneHVAC:AirDistributionUnit, !- Zone Equipment 1 Object Type + Main Zone Direct Air ADU,!- Zone Equipment 1 Name + 1, !- Zone Equipment 1 Cooling Sequence + 2, !- Zone Equipment 1 Heating or No-Load Sequence + , !- Zone Equipment 1 Sequential Cooling Fraction Schedule Name + , !- Zone Equipment 1 Sequential Heating Fraction Schedule Name + ZoneHVAC:Baseboard:Convective:Electric, !- Zone Equipment 2 Object Type + Main Zone Baseboard, !- Zone Equipment 2 Name + 2, !- Zone Equipment 2 Cooling Sequence + 1, !- Zone Equipment 2 Heating or No-Load Sequence + , !- Zone Equipment 2 Sequential Cooling Fraction Schedule Name + ; !- Zone Equipment 2 Sequential Heating Fraction Schedule Name + + AirTerminal:SingleDuct:ConstantVolume:NoReheat, + Main Zone Direct Air, !- Name + System Availability Schedule, !- Availability Schedule Name + Main Zone Inlet Node ATInlet, !- Air Inlet Node Name + Main Zone Inlet Node, !- Air Outlet Node Name + 1.5, !- Maximum Air Flow Rate {m3/s} + , !- Design Specification Outdoor Air Object Name + ; !- Per Person Ventilation Rate Mode + + ZoneHVAC:AirDistributionUnit, + Main Zone Direct Air ADU,!- Name + Main Zone Inlet Node, !- Air Distribution Unit Outlet Node Name + AirTerminal:SingleDuct:ConstantVolume:NoReheat, !- Air Terminal Object Type + Main Zone Direct Air, !- Air Terminal Name + , !- Nominal Upstream Leakage Fraction + , !- Constant Downstream Leakage Fraction + ; !- Design Specification Air Terminal Sizing Object Name + + ZoneHVAC:Baseboard:Convective:Electric, + Main Zone Baseboard, !- Name + System Availability Schedule, !- Availability Schedule Name + HeatingDesignCapacity, !- Heating Design Capacity Method + 8000, !- Heating Design Capacity {W} + , !- Heating Design Capacity Per Floor Area {W/m2} + , !- Fraction of Autosized Heating Design Capacity + 0.97; !- Efficiency + + ZoneControl:Thermostat, + Main Zone Thermostat, !- Name + Main Zone, !- Zone or ZoneList Name + Zone Control Type Sched, !- Control Type Schedule Name + ThermostatSetpoint:SingleHeating, !- Control 1 Object Type + Heating Setpoint; !- Control 1 Name + + Schedule:Compact, + Zone Control Type Sched, !- Name + Any Number, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: AllDays, !- Field 2 + Until: 24:00,1; !- Field 3 + + ThermostatSetpoint:SingleHeating, + Heating Setpoint, !- Name + Heating Setpoint Schedule; !- Setpoint Temperature Schedule Name + + Schedule:Compact, + Heating Setpoint Schedule, !- Name + Any Number, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: AllDays, !- Field 2 + Until: 24:00,20.0; !- Field 3 + + Output:VariableDictionary,Regular; + + Output:Surfaces:Drawing,DXF; + + Output:Constructions,Constructions; + + Output:Variable,*,Site Outdoor Air Drybulb Temperature,hourly; + + Output:Variable,*,Site Outdoor Air Wetbulb Temperature,hourly; + + Output:Variable,*,Site Outdoor Air Humidity Ratio,hourly; + + Output:Variable,*,Site Outdoor Air Relative Humidity,hourly; + + Output:Variable,*,Zone Mean Air Temperature,Annual; + + Output:Variable,*,Zone Mean Air Temperature,RunPeriod; + + Output:Variable,*,Zone Mean Air Temperature,Environment; + + Output:Variable,*,Zone Mean Air Temperature,Monthly; + + Output:Variable,*,Zone Mean Air Temperature,Daily; + + Output:Variable,*,Zone Mean Air Temperature,Hourly; + + Output:Variable,*,Zone Mean Air Temperature,Timestep; + + Output:Variable,*,Zone Mean Air Temperature,Detailed; + + Output:Variable,Supply Outlet Node,System Node Mass Flow Rate,hourly; + + Output:Variable,*,System Node Temperature,hourly; + + Output:Variable,*,Baseboard Electricity Rate,hourly; + + Output:Meter:MeterFileOnly,Electricity:Facility,monthly; + + Output:Meter:MeterFileOnly,Electricity:HVAC,monthly; + + Output:Meter:MeterFileOnly,Electricity:Facility,runperiod; + + Output:Meter:MeterFileOnly,Electricity:HVAC,runperiod; + + OutputControl:Table:Style, + TabAndHTML; !- Column Separator + + Output:Table:SummaryReports, + AllSummary; !- Report 1 Name + + Output:SQLite, + SimpleAndTabular; !- Option Type + diff --git a/resources/utilities/SqlFile/1ZoneEvapCooler-V9-5-0.sql b/resources/utilities/SqlFile/1ZoneEvapCooler-V9-5-0.sql new file mode 100644 index 0000000000..f75d67c0b0 Binary files /dev/null and b/resources/utilities/SqlFile/1ZoneEvapCooler-V9-5-0.sql differ diff --git a/resources/utilities/SqlFile/update_all.sh b/resources/utilities/SqlFile/update_all.sh index ba0cf68626..159ada9e1b 100755 --- a/resources/utilities/SqlFile/update_all.sh +++ b/resources/utilities/SqlFile/update_all.sh @@ -6,7 +6,7 @@ curl_token="-H \"Authorization: token $token\"" # All versions you want to run # declare -a all_versions=("8.5.0" "8.6.0" "8.7.0" "8.8.0" "8.9.0" "9.0.1" "9.1.0" "9.2.0" "9.3.0", "9.4.0") -declare -a all_versions=("9.4.0") +declare -a all_versions=("9.5.0-IOFreeze") # DO NOT RERUN IF SQL ALREADY THERE rerun_if_already_there=false diff --git a/ruby/test/epJSON_Test.rb b/ruby/test/epJSON_Test.rb index 0b1f5c69d3..87a4dd6abb 100644 --- a/ruby/test/epJSON_Test.rb +++ b/ruby/test/epJSON_Test.rb @@ -33,28 +33,41 @@ class EpJSON_Test < MiniTest::Unit::TestCase - # def setup - # end + def setup + + @idfFile = OpenStudio::IdfFile.new("EnergyPlus".to_IddFileType) + building = OpenStudio::IdfObject.new("Building".to_IddObjectType) + building.setName("Building 1") + building.setDouble(1, 0.0) # North Axis + @idfFile.addObject(building) + + @ep_version = Gem::Version.new(OpenStudio::energyPlusVersion) + end # def teardown # end - def test_epJSON - # load IdfFile - idfPath = OpenStudio::Path.new(File.join(File.dirname(__FILE__), "../../resources/energyplus/5ZoneAirCooled/in.idf")) - puts idfPath - assert(OpenStudio::exists(idfPath)) + def common_asserts(json, ep_version) + assert(json["Version"]) + assert(Gem::Version.new(json["Version"]["Version 1"]["version_identifier"]) == ep_version) + assert(json["Building"]) + assert(json["Building"]["Building 1"]["north_axis"] == 0.0) + end - oIdfFile = OpenStudio::IdfFile.load(idfPath,"EnergyPlus".to_IddFileType) - assert(oIdfFile.empty? == false) - idfFile = oIdfFile.get - assert(idfFile.objects().size() > 0) + def test_epJSON_String + + json_str = OpenStudio::EPJSON::toJSONString(@idfFile); + json = JSON.parse(json_str) + + common_asserts(json, @ep_version) + end + + def test_epJSON - json = OpenStudio::EPJSON::toJSONString(idfFile); - obj = JSON.parse(json) - #puts(json) - assert(obj["Version"]["Version 1"]["version_identifier"] == "9.4") + # This should directly convert it to a a hash + json = OpenStudio::EPJSON::toJSON(@idfFile); + common_asserts(json, @ep_version) end end diff --git a/src/energyplus/CMakeLists.txt b/src/energyplus/CMakeLists.txt index 7bb2dab297..9d9a21dc3c 100644 --- a/src/energyplus/CMakeLists.txt +++ b/src/energyplus/CMakeLists.txt @@ -17,6 +17,7 @@ set(${target_name}_src ForwardTranslator/ForwardTranslateAirGap.cpp ForwardTranslator/ForwardTranslateAirLoopHVAC.cpp ForwardTranslator/ForwardTranslateAirLoopHVACOutdoorAirSystem.cpp + ForwardTranslator/ForwardTranslateAirLoopHVACDedicatedOutdoorAirSystem.cpp ForwardTranslator/ForwardTranslateAirLoopHVACReturnPlenum.cpp ForwardTranslator/ForwardTranslateAirLoopHVACSupplyPlenum.cpp ForwardTranslator/ForwardTranslateAirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.cpp @@ -419,6 +420,7 @@ set(${target_name}_src ReverseTranslator.cpp ReverseTranslator/ReverseTranslateAirLoopHVAC.cpp ReverseTranslator/ReverseTranslateAirLoopHVACOutdoorAirSystem.cpp + ReverseTranslator/ReverseTranslateAirLoopHVACDedicatedOutdoorAirSystem.cpp ReverseTranslator/ReverseTranslateAirTerminalSingleDuctConstantVolumeReheat.cpp ReverseTranslator/ReverseTranslateAirTerminalSingleDuctConstantVolumeNoReheat.cpp ReverseTranslator/ReverseTranslateAirTerminalSingleDuctVAVNoReheat.cpp @@ -593,6 +595,7 @@ set(${target_name}_test_src Test/AirWallMaterial_GTest.cpp Test/AirLoopHVAC_GTest.cpp + Test/AirLoopHVACDedicatedOutdoorAirSystem_GTest.cpp Test/PlantLoop_GTest.cpp # Test/AvailabilityManagerAssignmentList_GTest.cpp diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index 927dc5ff10..06e862357d 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -502,6 +502,13 @@ namespace energyplus { idfObject.setName(node.name().get()); } + // get AirLoopHVACDedicatedOutdoorAirSystem in sorted order + std::vector doass = model.getConcreteModelObjects(); + std::sort(doass.begin(), doass.end(), WorkspaceObjectNameLess()); + for (AirLoopHVACDedicatedOutdoorAirSystem doas : doass) { + translateAndMapModelObject(doas); + } + // get air loops in sorted order std::vector airLoops = model.getConcreteModelObjects(); std::sort(airLoops.begin(), airLoops.end(), WorkspaceObjectNameLess()); @@ -716,6 +723,11 @@ namespace energyplus { retVal = translateAirLoopHVACOutdoorAirSystem(oaSystem); break; } + case openstudio::IddObjectType::OS_AirLoopHVAC_DedicatedOutdoorAirSystem: { + model::AirLoopHVACDedicatedOutdoorAirSystem doaSystem = modelObject.cast(); + retVal = translateAirLoopHVACDedicatedOutdoorAirSystem(doaSystem); + break; + } case openstudio::IddObjectType::OS_AirLoopHVAC_UnitaryHeatPump_AirToAir: { model::AirLoopHVACUnitaryHeatPumpAirToAir unitary = modelObject.cast(); retVal = translateAirLoopHVACUnitaryHeatPumpAirToAir(unitary); @@ -3101,8 +3113,8 @@ namespace energyplus { result.push_back(IddObjectType::OS_AirLoopHVAC); result.push_back(IddObjectType::OS_AirLoopHVAC_ControllerList); - // Translated by AirLoopHVAC (and AirLoopHVAC:DedicatedOutdoorAirSystem but not wrapped) - // result.push_back(IddObjectType::OS_AirLoopHVAC_OutdoorAirSystem) + // Translated by AirLoopHVAC + // result.push_back(IddObjectType::OS_AirLoopHVAC_OutdoorAirSystem); result.push_back(IddObjectType::OS_AirLoopHVAC_UnitaryHeatCool_VAVChangeoverBypass); result.push_back(IddObjectType::OS_AirLoopHVAC_UnitaryCoolOnly); diff --git a/src/energyplus/ForwardTranslator.hpp b/src/energyplus/ForwardTranslator.hpp index 55a91e4807..06d3ae2856 100644 --- a/src/energyplus/ForwardTranslator.hpp +++ b/src/energyplus/ForwardTranslator.hpp @@ -94,6 +94,7 @@ namespace model { class AirTerminalSingleDuctVAVHeatAndCoolReheat; class AirLoopHVACZoneMixer; class AirLoopHVACOutdoorAirSystem; + class AirLoopHVACDedicatedOutdoorAirSystem; class AirWallMaterial; class AvailabilityManagerAssignmentList; class AvailabilityManagerHybridVentilation; @@ -597,6 +598,8 @@ namespace energyplus { boost::optional translateAirLoopHVACOutdoorAirSystem(model::AirLoopHVACOutdoorAirSystem& modelObject); + boost::optional translateAirLoopHVACDedicatedOutdoorAirSystem(model::AirLoopHVACDedicatedOutdoorAirSystem& modelObject); + boost::optional translateAirLoopHVACUnitaryHeatCoolVAVChangeoverBypass(model::AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass& modelObject); diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACDedicatedOutdoorAirSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACDedicatedOutdoorAirSystem.cpp new file mode 100644 index 0000000000..147ef0e8be --- /dev/null +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACDedicatedOutdoorAirSystem.cpp @@ -0,0 +1,140 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +* following conditions are met: +* +* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following +* disclaimer. +* +* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the distribution. +* +* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission from the respective party. +* +* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works +* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior +* written permission from Alliance for Sustainable Energy, LLC. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED +* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +***********************************************************************************************************************/ + +#include "../ForwardTranslator.hpp" + +#include "../../model/Model.hpp" +#include "../../model/AirLoopHVACDedicatedOutdoorAirSystem.hpp" +#include "../../model/AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" +#include "../../model/AirLoopHVACOutdoorAirSystem.hpp" +#include "../../model/Schedule.hpp" +#include "../../model/AirLoopHVAC.hpp" +#include "../../model/Node.hpp" +#include "../../model/AirLoopHVACZoneMixer.hpp" +#include "../../model/AirLoopHVACZoneSplitter.hpp" + +#include +#include +#include +#include +#include "../../utilities/idf/IdfExtensibleGroup.hpp" + +using namespace openstudio::model; + +namespace openstudio { + +namespace energyplus { + + boost::optional + ForwardTranslator::translateAirLoopHVACDedicatedOutdoorAirSystem(model::AirLoopHVACDedicatedOutdoorAirSystem& modelObject) { + boost::optional value; + IdfObject idfObject(IddObjectType::AirLoopHVAC_DedicatedOutdoorAirSystem); + + m_idfObjects.push_back(idfObject); + + // Name + std::string name = modelObject.name().get(); + idfObject.setString(openstudio::AirLoopHVAC_DedicatedOutdoorAirSystemFields::Name, name); + + // Availability Schedule Name + Schedule schedule = modelObject.availabilitySchedule(); + if (boost::optional _schedule = translateAndMapModelObject(schedule)) { + idfObject.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AvailabilityScheduleName, _schedule->name().get()); + } + + // AirLoopHVAC:OutdoorAirSystem Name + AirLoopHVACOutdoorAirSystem oaSystem = modelObject.airLoopHVACOutdoorAirSystem(); + if (boost::optional _oaSystem = translateAndMapModelObject(oaSystem)) { + idfObject.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_OutdoorAirSystemName, _oaSystem->name().get()); + } + + // AirLoopHVAC:Mixer Name + std::string mixerName(modelObject.nameString() + " Mixer"); + idfObject.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_MixerName, mixerName); + IdfObject idfMixer(openstudio::IddObjectType::AirLoopHVAC_Mixer); + idfMixer.setString(AirLoopHVAC_MixerFields::Name, mixerName); + idfMixer.setString(AirLoopHVAC_MixerFields::OutletNodeName, idfMixer.name().get() + " Outlet"); + + // AirLoopHVAC:Splitter Name + std::string splitterName(modelObject.nameString() + " Splitter"); + idfObject.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_SplitterName, splitterName); + IdfObject idfSplitter(openstudio::IddObjectType::AirLoopHVAC_Splitter); + idfSplitter.setString(AirLoopHVAC_SplitterFields::Name, splitterName); + idfSplitter.setString(AirLoopHVAC_SplitterFields::InletNodeName, oaSystem.outdoorAirModelObject().get().nameString()); + + // Preheat Design Temperature + if ((value = modelObject.preheatDesignTemperature())) { + idfObject.setDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignTemperature, value.get()); + } + + // Preheat Design Humidity Ratio + if ((value = modelObject.preheatDesignHumidityRatio())) { + idfObject.setDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignHumidityRatio, value.get()); + } + + // Precool Design Temperature + if ((value = modelObject.precoolDesignTemperature())) { + idfObject.setDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignTemperature, value.get()); + } + + // Precool Design Humidity Ratio + if ((value = modelObject.precoolDesignHumidityRatio())) { + idfObject.setDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignHumidityRatio, value.get()); + } + + // Number of AirLoopHVAC + idfObject.setInt(AirLoopHVAC_DedicatedOutdoorAirSystemFields::NumberofAirLoopHVAC, modelObject.numberofAirLoops()); + + // AirLoopHVAC x Name + boost::optional oas; + for (auto airLoop : modelObject.airLoops()) { + auto eg = idfObject.pushExtensibleGroup(); + eg.setString(AirLoopHVAC_DedicatedOutdoorAirSystemExtensibleFields::AirLoopHVACName, airLoop.nameString()); + + oas = airLoop.airLoopHVACOutdoorAirSystem(); + OS_ASSERT(oas); + + // AirLoopHVAC:Mixer Name + auto egMixer = idfMixer.pushExtensibleGroup(); + egMixer.setString(AirLoopHVAC_MixerExtensibleFields::InletNodeName, oas->outboardReliefNode().get().nameString()); + + // AirLoopHVAC:Splitter Name + auto egSplitter = idfSplitter.pushExtensibleGroup(); + egSplitter.setString(AirLoopHVAC_SplitterExtensibleFields::OutletNodeName, oas->outboardOANode().get().nameString()); + } + + m_idfObjects.push_back(idfMixer); + m_idfObjects.push_back(idfSplitter); + + return boost::optional(idfObject); + } + +} // namespace energyplus + +} // namespace openstudio diff --git a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACOutdoorAirSystem.cpp b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACOutdoorAirSystem.cpp index a9176f1eb5..a0aa99a031 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACOutdoorAirSystem.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACOutdoorAirSystem.cpp @@ -32,6 +32,8 @@ #include "../../model/AirToAirComponent_Impl.hpp" #include "../../model/AirLoopHVACOutdoorAirSystem.hpp" #include "../../model/AirLoopHVACOutdoorAirSystem_Impl.hpp" +#include "../../model/AirLoopHVACDedicatedOutdoorAirSystem.hpp" +#include "../../model/AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" #include "../../model/ControllerOutdoorAir.hpp" #include "../../model/ControllerOutdoorAir_Impl.hpp" #include "../../model/ControllerWaterCoil.hpp" @@ -72,6 +74,11 @@ namespace energyplus { m_idfObjects.push_back(idfObject); + boost::optional mixedAirModelObject = modelObject.mixedAirModelObject(); + boost::optional outdoorAirModelObject = modelObject.outdoorAirModelObject(); + boost::optional reliefAirModelObject = modelObject.reliefAirModelObject(); + boost::optional returnAirModelObject = modelObject.returnAirModelObject(); + // Name std::string name = modelObject.name().get(); idfObject.setString(openstudio::AirLoopHVAC_OutdoorAirSystemFields::Name, name); @@ -81,16 +88,18 @@ namespace energyplus { _controllerList.setName(name + " Controller List"); _controllerList.clearExtensibleGroups(); m_idfObjects.push_back(_controllerList); + idfObject.setString(openstudio::AirLoopHVAC_OutdoorAirSystemFields::ControllerListName, _controllerList.name().get()); ControllerOutdoorAir controllerOutdoorAir = modelObject.getControllerOutdoorAir(); - boost::optional _controllerOutdoorAir = translateAndMapModelObject(controllerOutdoorAir); - OS_ASSERT(_controllerOutdoorAir); - idfObject.setString(openstudio::AirLoopHVAC_OutdoorAirSystemFields::ControllerListName, _controllerList.name().get()); + if (!modelObject.airLoopHVACDedicatedOutdoorAirSystem()) { + boost::optional _controllerOutdoorAir = translateAndMapModelObject(controllerOutdoorAir); + OS_ASSERT(_controllerOutdoorAir); - IdfExtensibleGroup eg = _controllerList.pushExtensibleGroup(); - eg.setString(AirLoopHVAC_ControllerListExtensibleFields::ControllerObjectType, _controllerOutdoorAir->iddObject().name()); - eg.setString(AirLoopHVAC_ControllerListExtensibleFields::ControllerName, _controllerOutdoorAir->name().get()); + IdfExtensibleGroup eg = _controllerList.pushExtensibleGroup(); + eg.setString(AirLoopHVAC_ControllerListExtensibleFields::ControllerObjectType, _controllerOutdoorAir->iddObject().name()); + eg.setString(AirLoopHVAC_ControllerListExtensibleFields::ControllerName, _controllerOutdoorAir->name().get()); + } std::vector controllers; auto components = modelObject.components(); @@ -155,30 +164,39 @@ namespace energyplus { m_idfObjects.push_back(equipmentListIdf); - IdfObject outdoorAirMixerIdf(IddObjectType::OutdoorAir_Mixer); - outdoorAirMixerIdf.setName(name + " Outdoor Air Mixer"); - m_idfObjects.push_back(outdoorAirMixerIdf); + unsigned i = 1; + if (!modelObject.airLoopHVACDedicatedOutdoorAirSystem()) { + IdfObject outdoorAirMixerIdf(IddObjectType::OutdoorAir_Mixer); + outdoorAirMixerIdf.setName(name + " Outdoor Air Mixer"); + m_idfObjects.push_back(outdoorAirMixerIdf); + + s = mixedAirModelObject->name(); + if (s) { + outdoorAirMixerIdf.setString(OutdoorAir_MixerFields::MixedAirNodeName, *s); + } + s = outdoorAirModelObject->name(); + if (s) { + outdoorAirMixerIdf.setString(OutdoorAir_MixerFields::OutdoorAirStreamNodeName, *s); + } - s = modelObject.mixedAirModelObject()->name(); - if (s) { - outdoorAirMixerIdf.setString(OutdoorAir_MixerFields::MixedAirNodeName, *s); - } - s = modelObject.outdoorAirModelObject()->name(); - if (s) { - outdoorAirMixerIdf.setString(OutdoorAir_MixerFields::OutdoorAirStreamNodeName, *s); - } + s = reliefAirModelObject->name(); + if (s) { + outdoorAirMixerIdf.setString(OutdoorAir_MixerFields::ReliefAirStreamNodeName, *s); + } - s = modelObject.reliefAirModelObject()->name(); - if (s) { - outdoorAirMixerIdf.setString(OutdoorAir_MixerFields::ReliefAirStreamNodeName, *s); - } + s = returnAirModelObject->name(); + if (s) { + outdoorAirMixerIdf.setString(OutdoorAir_MixerFields::ReturnAirStreamNodeName, *s); + } - s = modelObject.returnAirModelObject()->name(); - if (s) { - outdoorAirMixerIdf.setString(OutdoorAir_MixerFields::ReturnAirStreamNodeName, *s); + s = outdoorAirMixerIdf.iddObject().name(); + equipmentListIdf.setString(i, *s); + ++i; + s = outdoorAirMixerIdf.name(); + equipmentListIdf.setString(i, *s); + ++i; } - unsigned i = 1; ModelObjectVector oaModelObjects = modelObject.oaComponents(); for (auto oaIt = oaModelObjects.begin(); oaIt != oaModelObjects.end(); ++oaIt) { if (boost::optional idfObject = translateAndMapModelObject(*oaIt)) { @@ -204,12 +222,6 @@ namespace energyplus { } } - s = outdoorAirMixerIdf.iddObject().name(); - equipmentListIdf.setString(i, *s); - ++i; - s = outdoorAirMixerIdf.name(); - equipmentListIdf.setString(i, *s); - s = equipmentListIdf.name(); if (s) { idfObject.setString(openstudio::AirLoopHVAC_OutdoorAirSystemFields::OutdoorAirEquipmentListName, *s); diff --git a/src/energyplus/Resources/LCCusePriceEscalationDataSet2011.idf b/src/energyplus/Resources/LCCusePriceEscalationDataSet2011.idf index 6f0ff3f8a9..57785ff26b 100644 --- a/src/energyplus/Resources/LCCusePriceEscalationDataSet2011.idf +++ b/src/energyplus/Resources/LCCusePriceEscalationDataSet2011.idf @@ -23,7 +23,7 @@ ! converted into EnergyPlus objects using a spreadsheet called ConvertENCOSTtoEnergyPlusLifeCycleCost.xls ! which is available upon request. - Version,9.4; + Version,9.5; LifeCycleCost:UsePriceEscalation, NorthEast Residential-Electricity, !- LCC Price Escalation Name diff --git a/src/energyplus/ReverseTranslator.cpp b/src/energyplus/ReverseTranslator.cpp index ec5c50a3f4..6ef93b607d 100644 --- a/src/energyplus/ReverseTranslator.cpp +++ b/src/energyplus/ReverseTranslator.cpp @@ -284,7 +284,11 @@ namespace energyplus { break; // no-op } case openstudio::IddObjectType::AirLoopHVAC_OutdoorAirSystem: { - //modelObject = translateAirLoopHVACOutdoorAirSystem(workspaceObject ); + //modelObject = translateAirLoopHVACOutdoorAirSystem(workspaceObject); + break; + } + case openstudio::IddObjectType::AirLoopHVAC_DedicatedOutdoorAirSystem: { + //modelObject = translateAirLoopHVACDedicatedOutdoorAirSystem(workspaceObject); break; } case openstudio::IddObjectType::AirLoopHVAC_OutdoorAirSystem_EquipmentList: { diff --git a/src/energyplus/ReverseTranslator.hpp b/src/energyplus/ReverseTranslator.hpp index c2e77a519f..ea0665c8d9 100644 --- a/src/energyplus/ReverseTranslator.hpp +++ b/src/energyplus/ReverseTranslator.hpp @@ -81,6 +81,8 @@ namespace energyplus { boost::optional translateAirLoopHVACOutdoorAirSystem(const WorkspaceObject& workspaceObject); + boost::optional translateAirLoopHVACDedicatedOutdoorAirSystem(const WorkspaceObject& workspaceObject); + boost::optional translateAirTerminalSingleDuctConstantVolumeReheat(const WorkspaceObject& workspaceObject); boost::optional translateAirTerminalSingleDuctConstantVolumeNoReheat(const WorkspaceObject& workspaceObject); diff --git a/src/energyplus/ReverseTranslator/ReverseTranslateAirLoopHVACDedicatedOutdoorAirSystem.cpp b/src/energyplus/ReverseTranslator/ReverseTranslateAirLoopHVACDedicatedOutdoorAirSystem.cpp new file mode 100644 index 0000000000..2af7f61959 --- /dev/null +++ b/src/energyplus/ReverseTranslator/ReverseTranslateAirLoopHVACDedicatedOutdoorAirSystem.cpp @@ -0,0 +1,129 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +* following conditions are met: +* +* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following +* disclaimer. +* +* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the distribution. +* +* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission from the respective party. +* +* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works +* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior +* written permission from Alliance for Sustainable Energy, LLC. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED +* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +***********************************************************************************************************************/ + +#include "../ReverseTranslator.hpp" + +#include "../../model/AirLoopHVACDedicatedOutdoorAirSystem.hpp" +#include "../../model/AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" + +#include "../../model/AirLoopHVACOutdoorAirSystem.hpp" +#include "../../model/AirLoopHVACOutdoorAirSystem_Impl.hpp" +#include "../../model/Schedule.hpp" +#include "../../model/Schedule_Impl.hpp" +#include "../../model/AirLoopHVAC.hpp" +#include "../../model/AirLoopHVAC_Impl.hpp" + +#include "../../utilities/idf/WorkspaceExtensibleGroup.hpp" + +#include +#include "../../utilities/idd/IddEnums.hpp" +#include + +#include "../../utilities/core/Assert.hpp" + +using namespace openstudio::model; + +namespace openstudio { + +namespace energyplus { + + OptionalModelObject ReverseTranslator::translateAirLoopHVACDedicatedOutdoorAirSystem(const WorkspaceObject& workspaceObject) { + if (workspaceObject.iddObject().type() != IddObjectType::AirLoopHVAC_DedicatedOutdoorAirSystem) { + LOG(Error, "WorkspaceObject is not IddObjectType: AirLoopHVACDedicatedOutdoorAirSystem"); + return boost::none; + } + + OptionalString s; + OptionalDouble d; + OptionalWorkspaceObject target; + + boost::optional outdoorAirSystem; + if ((target = workspaceObject.getTarget(openstudio::AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_OutdoorAirSystemName))) { + OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); + if (modelObject) { + if (modelObject->optionalCast()) { + outdoorAirSystem = modelObject->cast(); + } + } + } else { + LOG(Error, "Could not find outdoor air system attached to AirLoopHVACDedicatedOutdoorAirSystem object"); + return boost::none; + } + + openstudio::model::AirLoopHVACDedicatedOutdoorAirSystem doas(*outdoorAirSystem); + + s = workspaceObject.name(); + if (s) { + doas.setName(*s); + } + + if ((target = workspaceObject.getTarget(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AvailabilityScheduleName))) { + OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); + if (modelObject) { + if (auto optSch = modelObject->optionalCast()) { + doas.setAvailabilitySchedule(optSch.get()); + } + } + } + + d = workspaceObject.getDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignTemperature); + if (d) { + doas.setPreheatDesignTemperature(*d); + } + + d = workspaceObject.getDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignHumidityRatio); + if (d) { + doas.setPreheatDesignTemperature(*d); + } + + d = workspaceObject.getDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignTemperature); + if (d) { + doas.setPrecoolDesignTemperature(*d); + } + + d = workspaceObject.getDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignHumidityRatio); + if (d) { + doas.setPrecoolDesignHumidityRatio(*d); + } + + for (const IdfExtensibleGroup& idfGroup : workspaceObject.extensibleGroups()) { + WorkspaceExtensibleGroup workspaceGroup = idfGroup.cast(); + OptionalWorkspaceObject target = workspaceGroup.getTarget(AirLoopHVAC_DedicatedOutdoorAirSystemExtensibleFields::AirLoopHVACName); + OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); + + // add the air loop + doas.addAirLoop(modelObject->cast()); + } + + return doas; + } + +} // namespace energyplus + +} // namespace openstudio diff --git a/src/energyplus/Test/AirLoopHVACDedicatedOutdoorAirSystem_GTest.cpp b/src/energyplus/Test/AirLoopHVACDedicatedOutdoorAirSystem_GTest.cpp new file mode 100644 index 0000000000..5b6e353f88 --- /dev/null +++ b/src/energyplus/Test/AirLoopHVACDedicatedOutdoorAirSystem_GTest.cpp @@ -0,0 +1,196 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +* following conditions are met: +* +* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following +* disclaimer. +* +* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the distribution. +* +* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission from the respective party. +* +* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works +* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior +* written permission from Alliance for Sustainable Energy, LLC. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED +* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +***********************************************************************************************************************/ + +#include +#include "EnergyPlusFixture.hpp" + +#include "../ForwardTranslator.hpp" +#include "../ReverseTranslator.hpp" + +#include "../../model/Model.hpp" +#include "../../model/AirLoopHVACDedicatedOutdoorAirSystem.hpp" +#include "../../model/AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" +#include "../../model/AirLoopHVACOutdoorAirSystem.hpp" +#include "../../model/AirLoopHVACOutdoorAirSystem_Impl.hpp" +#include "../../model/ControllerOutdoorAir.hpp" +#include "../../model/ControllerOutdoorAir_Impl.hpp" +#include "../../model/AirLoopHVAC.hpp" +#include "../../model/AirLoopHVAC_Impl.hpp" +#include "../../model/Node.hpp" +#include "../../model/Node_Impl.hpp" +#include "../../model/AirLoopHVACZoneMixer.hpp" +#include "../../model/AirLoopHVACZoneMixer_Impl.hpp" +#include "../../model/AirLoopHVACZoneSplitter.hpp" +#include "../../model/AirLoopHVACZoneSplitter_Impl.hpp" +#include "../../model/PlantLoop.hpp" +#include "../../model/PlantLoop_Impl.hpp" +#include "../../model/CoilCoolingWater.hpp" +#include "../../model/CoilCoolingWater_Impl.hpp" + +#include "../../utilities/idf/IdfExtensibleGroup.hpp" +#include "../../utilities/idf/WorkspaceExtensibleGroup.hpp" + +#include +#include +#include +#include +#include +#include +#include + +using namespace openstudio::energyplus; +using namespace openstudio::model; +using namespace openstudio; + +TEST_F(EnergyPlusFixture, ForwardTranslator_AirLoopHVACDedicatedOutdoorAirSystem) { + Model m; + + AirLoopHVAC airLoop(m); + airLoop.setName("Air Loop 1"); + + ControllerOutdoorAir controller1(m); + AirLoopHVACOutdoorAirSystem oaSystem1(m, controller1); + oaSystem1.setName("Outdoor Air System 1"); + Node supplyOutlet = airLoop.supplyOutletNode(); + oaSystem1.addToNode(supplyOutlet); + + ControllerOutdoorAir controller2(m); + AirLoopHVACOutdoorAirSystem oaSystem2(m, controller2); + oaSystem2.setName("Outdoor Air System 2"); + CoilCoolingWater coil(m); + AirLoopHVACDedicatedOutdoorAirSystem doaSystem(oaSystem2); + doaSystem.setName("Dedicated Outdoor Air System 1"); + doaSystem.addAirLoop(airLoop); + EXPECT_EQ(2u, oaSystem2.components().size()); + EXPECT_TRUE(coil.addToNode(oaSystem2.outboardOANode().get())); + EXPECT_EQ(4u, oaSystem2.components().size()); + PlantLoop pl(m); + EXPECT_TRUE(pl.addDemandBranchForComponent(coil)); + + ForwardTranslator ft; + Workspace w = ft.translateModel(m); + + WorkspaceObjectVector idfContrlLists(w.getObjectsByType(IddObjectType::AirLoopHVAC_ControllerList)); + ASSERT_EQ(2u, idfContrlLists.size()); + + WorkspaceObjectVector idfContrlOAs(w.getObjectsByType(IddObjectType::Controller_OutdoorAir)); + ASSERT_EQ(1u, idfContrlOAs.size()); + WorkspaceObject idfContrlOA(idfContrlOAs[0]); + + WorkspaceObjectVector idfCoils(w.getObjectsByType(IddObjectType::Coil_Cooling_Water)); + ASSERT_EQ(1u, idfCoils.size()); + + WorkspaceObjectVector idfContrlWCs(w.getObjectsByType(IddObjectType::Controller_WaterCoil)); + ASSERT_EQ(1u, idfContrlWCs.size()); + + WorkspaceObjectVector idfOASs(w.getObjectsByType(IddObjectType::AirLoopHVAC_OutdoorAirSystem)); + ASSERT_EQ(2u, idfOASs.size()); + + WorkspaceObjectVector idfOAMixers(w.getObjectsByType(IddObjectType::OutdoorAir_Mixer)); + ASSERT_EQ(1u, idfOAMixers.size()); + + WorkspaceObjectVector idfAirLoops(w.getObjectsByType(IddObjectType::AirLoopHVAC)); + ASSERT_EQ(1u, idfAirLoops.size()); + + WorkspaceObjectVector idfDOASs(w.getObjectsByType(IddObjectType::AirLoopHVAC_DedicatedOutdoorAirSystem)); + ASSERT_EQ(1u, idfDOASs.size()); + WorkspaceObject idfDOAS(idfDOASs[0]); + + EXPECT_EQ("Outdoor Air System 2", idfDOAS.getString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_OutdoorAirSystemName, false).get()); + EXPECT_EQ("Always On Discrete", idfDOAS.getString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AvailabilityScheduleName, false).get()); + EXPECT_EQ("Dedicated Outdoor Air System 1 Mixer", + idfDOAS.getString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_MixerName, false).get()); + EXPECT_EQ("Dedicated Outdoor Air System 1 Splitter", + idfDOAS.getString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_SplitterName, false).get()); + EXPECT_EQ(4.5, idfDOAS.getDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignTemperature, false).get()); + EXPECT_EQ(0.004, idfDOAS.getDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignHumidityRatio, false).get()); + EXPECT_EQ(17.5, idfDOAS.getDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignTemperature, false).get()); + EXPECT_EQ(0.012, idfDOAS.getDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignHumidityRatio, false).get()); + EXPECT_EQ(1, idfDOAS.getInt(AirLoopHVAC_DedicatedOutdoorAirSystemFields::NumberofAirLoopHVAC, false).get()); + EXPECT_EQ(1u, idfDOAS.numExtensibleGroups()); + WorkspaceExtensibleGroup w_eg = idfDOAS.extensibleGroups()[0].cast(); + EXPECT_EQ("Air Loop 1", w_eg.getString(AirLoopHVAC_DedicatedOutdoorAirSystemExtensibleFields::AirLoopHVACName, false).get()); + + WorkspaceObjectVector idfMixers(w.getObjectsByType(IddObjectType::AirLoopHVAC_Mixer)); + ASSERT_EQ(1u, idfMixers.size()); + WorkspaceObject idfMixer(idfMixers[0]); + + EXPECT_EQ("Dedicated Outdoor Air System 1 Mixer", idfMixer.getString(AirLoopHVAC_MixerFields::Name, false).get()); + EXPECT_EQ("Dedicated Outdoor Air System 1 Mixer Outlet", idfMixer.getString(AirLoopHVAC_MixerFields::OutletNodeName, false).get()); + EXPECT_EQ(1u, idfMixer.numExtensibleGroups()); + WorkspaceExtensibleGroup w_egMixer = idfMixer.extensibleGroups()[0].cast(); + EXPECT_EQ(idfContrlOA.getString(Controller_OutdoorAirFields::ReliefAirOutletNodeName, false).get(), + w_egMixer.getString(AirLoopHVAC_MixerExtensibleFields::InletNodeName, false).get()); + + WorkspaceObjectVector idfSplitters(w.getObjectsByType(IddObjectType::AirLoopHVAC_Splitter)); + ASSERT_EQ(1u, idfSplitters.size()); + WorkspaceObject idfSplitter(idfSplitters[0]); + + EXPECT_EQ("Dedicated Outdoor Air System 1 Splitter", idfSplitter.getString(AirLoopHVAC_SplitterFields::Name, false).get()); + EXPECT_EQ(coil.airOutletModelObject().get().nameString(), idfSplitter.getString(AirLoopHVAC_SplitterFields::InletNodeName, false).get()); + EXPECT_EQ(1u, idfSplitter.numExtensibleGroups()); + WorkspaceExtensibleGroup w_egSplitter = idfSplitter.extensibleGroups()[0].cast(); + EXPECT_EQ(idfContrlOA.getString(Controller_OutdoorAirFields::ActuatorNodeName, false).get(), + w_egSplitter.getString(AirLoopHVAC_SplitterExtensibleFields::OutletNodeName, false).get()); +} + +/* TEST_F(EnergyPlusFixture, ReverseTranslator_AirLoopHVACDedicatedOutdoorAirSystem) { + openstudio::Workspace workspace(openstudio::StrictnessLevel::None, openstudio::IddFileType::EnergyPlus); + + openstudio::IdfObject idf_controller(openstudio::IddObjectType::Controller_OutdoorAir); + idf_controller.setString(Controller_OutdoorAirFields::Name, "Controller Outdoor Air 1"); + + openstudio::WorkspaceObject epControllerOA = workspace.addObject(idf_controller).get(); + + openstudio::IdfObject idf_controllerlist(openstudio::IddObjectType::AirLoopHVAC_ControllerList); + idf_controllerlist.setString(AirLoopHVAC_ControllerListFields::Name, "Controller List 1"); + idf_controllerlist.setString(1, "Controller:OutdoorAir"); + idf_controllerlist.setString(2, "Controller Outdoor Air 1"); + + openstudio::WorkspaceObject epControllerList = workspace.addObject(idf_controllerlist).get(); + + openstudio::IdfObject idf_oas(openstudio::IddObjectType::AirLoopHVAC_OutdoorAirSystem); + idf_oas.setString(AirLoopHVAC_OutdoorAirSystemFields::Name, "Outdoor Air System 1"); + idf_oas.setString(AirLoopHVAC_OutdoorAirSystemFields::ControllerListName, "Controller List 1"); + + openstudio::WorkspaceObject epOAS = workspace.addObject(idf_oas).get(); + + openstudio::IdfObject idf_doas(openstudio::IddObjectType::AirLoopHVAC_DedicatedOutdoorAirSystem); + idf_doas.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::Name, "Dedicated Outdoor Air System 1"); + idf_doas.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_OutdoorAirSystemName, "Outdoor Air System 1"); + + openstudio::WorkspaceObject epDOAS = workspace.addObject(idf_doas).get(); + + ReverseTranslator trans; + ASSERT_NO_THROW(trans.translateWorkspace(workspace)); + Model model = trans.translateWorkspace(workspace); + + std::vector doass = model.getModelObjects(); + ASSERT_EQ(1u, doass.size()); +} */ diff --git a/src/epjson/test/epJSONTranslator_GTest.cpp b/src/epjson/test/epJSONTranslator_GTest.cpp index bad6b45226..ae6ab97ddb 100644 --- a/src/epjson/test/epJSONTranslator_GTest.cpp +++ b/src/epjson/test/epJSONTranslator_GTest.cpp @@ -30,7 +30,9 @@ #include #include "epJSONFixture.hpp" #include "../epJSONTranslator.hpp" +#include "../../energyplus/ForwardTranslator.hpp" #include "../../utilities/idf/IdfFile.hpp" +#include "../../utilities/idf/Workspace.hpp" #include "../../utilities/core/ApplicationPathHelpers.hpp" #include "../../utilities/core/PathHelpers.hpp" #include "../../model/Model.hpp" @@ -378,8 +380,12 @@ TEST_F(epJSONFixture, toStringUilityWorksAsExpected) { EXPECT_EQ(str1, str2); } -TEST_F(epJSONFixture, canTranslateModelToJSON) { - const auto str1 = openstudio::epJSON::toJSON(openstudio::model::exampleModel()).toStyledString(); +TEST_F(epJSONFixture, canTranslateWorkspaceToJSON) { + auto m = openstudio::model::exampleModel(); + openstudio::energyplus::ForwardTranslator ft; + openstudio::Workspace w = ft.translateModel(m); + + const auto str1 = openstudio::epJSON::toJSON(w).toStyledString(); EXPECT_TRUE(str1.size() > 100); } diff --git a/src/model/AirLoopHVAC.cpp b/src/model/AirLoopHVAC.cpp index 4ad067a04b..0b18c3c04d 100644 --- a/src/model/AirLoopHVAC.cpp +++ b/src/model/AirLoopHVAC.cpp @@ -63,6 +63,8 @@ #include "ThermalZone_Impl.hpp" #include "AirLoopHVACOutdoorAirSystem.hpp" #include "AirLoopHVACOutdoorAirSystem_Impl.hpp" +#include "AirLoopHVACDedicatedOutdoorAirSystem.hpp" +#include "AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" #include "AirLoopHVACZoneSplitter.hpp" #include "AirLoopHVACZoneSplitter_Impl.hpp" #include "AirLoopHVACZoneMixer.hpp" @@ -267,6 +269,19 @@ namespace model { return result; } + boost::optional AirLoopHVAC_Impl::airLoopHVACDedicatedOutdoorAirSystem() const { + std::vector airLoopHVACDedicatedOutdoorAirSystems = + getObject().getModelObjectSources(AirLoopHVACDedicatedOutdoorAirSystem::iddObjectType()); + if (airLoopHVACDedicatedOutdoorAirSystems.empty()) { + // no error + } else if (airLoopHVACDedicatedOutdoorAirSystems.size() == 1) { + return airLoopHVACDedicatedOutdoorAirSystems[0]; + } else { + // error + } + return boost::none; + } + boost::optional AirLoopHVAC_Impl::zoneForLastBranch(Mixer& mixer) { if (auto node = mixer.lastInletModelObject()->optionalCast()) { auto nodeinlet = node->inletModelObject(); @@ -1970,6 +1985,10 @@ namespace model { return getImpl()->airLoopHVACOutdoorAirSystem(); } + boost::optional AirLoopHVAC::airLoopHVACDedicatedOutdoorAirSystem() const { + return getImpl()->airLoopHVACDedicatedOutdoorAirSystem(); + } + AirLoopHVACZoneMixer AirLoopHVAC::zoneMixer() const { return getImpl()->zoneMixer(); } diff --git a/src/model/AirLoopHVAC.hpp b/src/model/AirLoopHVAC.hpp index 9f25ed0885..9554b422e0 100644 --- a/src/model/AirLoopHVAC.hpp +++ b/src/model/AirLoopHVAC.hpp @@ -44,6 +44,7 @@ namespace model { class Node; class AirLoopHVACOutdoorAirSystem; + class AirLoopHVACDedicatedOutdoorAirSystem; class AirLoopHVACZoneSplitter; class AirLoopHVACZoneMixer; class AirLoopHVACSupplyPlenum; @@ -220,6 +221,12 @@ namespace model { */ boost::optional airLoopHVACOutdoorAirSystem() const; + /** Returns the AirLoopHVACDedicatedOutdoorAirSystem object associated with the air loop. + * A freshly constructed AirLoopHVAC object will not have a dedicated outdoor air system + * and this method will return a false optional. + */ + boost::optional airLoopHVACDedicatedOutdoorAirSystem() const; + /** Returns the fan in the mixed air stream (after outdoor air system) of the air system. * If there is no outdoor air system or there are multiple fans in the mixed air stream, * then the fan closest to the supply outlet node will be returned. diff --git a/src/model/AirLoopHVACDedicatedOutdoorAirSystem.cpp b/src/model/AirLoopHVACDedicatedOutdoorAirSystem.cpp new file mode 100644 index 0000000000..d9b416c263 --- /dev/null +++ b/src/model/AirLoopHVACDedicatedOutdoorAirSystem.cpp @@ -0,0 +1,390 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +* following conditions are met: +* +* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following +* disclaimer. +* +* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the distribution. +* +* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission from the respective party. +* +* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works +* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior +* written permission from Alliance for Sustainable Energy, LLC. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED +* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +***********************************************************************************************************************/ + +#include "AirLoopHVACDedicatedOutdoorAirSystem.hpp" +#include "AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" +#include "AirLoopHVACOutdoorAirSystem.hpp" +#include "AirLoopHVACOutdoorAirSystem_Impl.hpp" +#include "Schedule.hpp" +#include "Schedule_Impl.hpp" +#include "AirLoopHVAC.hpp" +#include "AirLoopHVAC_Impl.hpp" +#include "Model.hpp" +#include "Model_Impl.hpp" +#include "ModelExtensibleGroup.hpp" +#include "ScheduleTypeLimits.hpp" +#include "ScheduleTypeRegistry.hpp" + +#include +#include +#include + +#include "../utilities/idf/IdfExtensibleGroup.hpp" +#include "../utilities/idf/WorkspaceExtensibleGroup.hpp" + +#include "../utilities/units/Unit.hpp" + +#include "../utilities/core/Assert.hpp" + +namespace openstudio { +namespace model { + + namespace detail { + + AirLoopHVACDedicatedOutdoorAirSystem_Impl::AirLoopHVACDedicatedOutdoorAirSystem_Impl(const IdfObject& idfObject, Model_Impl* model, + bool keepHandle) + : ModelObject_Impl(idfObject, model, keepHandle) { + OS_ASSERT(idfObject.iddObject().type() == AirLoopHVACDedicatedOutdoorAirSystem::iddObjectType()); + } + + AirLoopHVACDedicatedOutdoorAirSystem_Impl::AirLoopHVACDedicatedOutdoorAirSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, + Model_Impl* model, bool keepHandle) + : ModelObject_Impl(other, model, keepHandle) { + OS_ASSERT(other.iddObject().type() == AirLoopHVACDedicatedOutdoorAirSystem::iddObjectType()); + } + + AirLoopHVACDedicatedOutdoorAirSystem_Impl::AirLoopHVACDedicatedOutdoorAirSystem_Impl(const AirLoopHVACDedicatedOutdoorAirSystem_Impl& other, + Model_Impl* model, bool keepHandle) + : ModelObject_Impl(other, model, keepHandle) {} + + ModelObject AirLoopHVACDedicatedOutdoorAirSystem_Impl::clone(Model model) const { + ModelObject result = ModelObject_Impl::clone(model); + + Model m = this->model(); + if (model == m) { + // cloned into same model, erase reference to parent + // this object is now invalid but having two objects point to same outdoor air system would also be invalid + result.setString(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::OutdoorAirSystem, ""); + LOG(Warn, "Cloning the AirLoopHVACDedicatedOutdoorAirSystem resets the Outdoor Air System attached to it while it is a required field. " + "You should call `setOutdoorAirSystem(OutdoorAirSystem&)` on the clone"); + } + + return result; + } + + // Get all output variable names that could be associated with this object. + const std::vector& AirLoopHVACDedicatedOutdoorAirSystem_Impl::outputVariableNames() const { + static const std::vector result; + // Not Appropriate: No variables available + return result; + } + + IddObjectType AirLoopHVACDedicatedOutdoorAirSystem_Impl::iddObjectType() const { + return AirLoopHVACDedicatedOutdoorAirSystem::iddObjectType(); + } + + std::vector AirLoopHVACDedicatedOutdoorAirSystem_Impl::getScheduleTypeKeys(const Schedule& schedule) const { + std::vector result; + UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); + UnsignedVector::const_iterator b(fieldIndices.begin()), e(fieldIndices.end()); + if (std::find(b, e, OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::AvailabilitySchedule) != e) { + result.push_back(ScheduleTypeKey("AirLoopHVACDedicatedOutdoorAirSystem", "Availability Schedule")); + } + return result; + } + + AirLoopHVACOutdoorAirSystem AirLoopHVACDedicatedOutdoorAirSystem_Impl::airLoopHVACOutdoorAirSystem() const { + boost::optional oaSystem = + getObject().getModelObjectTarget(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::OutdoorAirSystem); + OS_ASSERT(oaSystem); + return oaSystem.get(); + } + + Schedule AirLoopHVACDedicatedOutdoorAirSystem_Impl::availabilitySchedule() const { + boost::optional schedule = + getObject().getModelObjectTarget(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::AvailabilitySchedule); + OS_ASSERT(schedule); + return schedule.get(); + } + + double AirLoopHVACDedicatedOutdoorAirSystem_Impl::preheatDesignTemperature() const { + boost::optional value = getDouble(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignTemperature, true); + OS_ASSERT(value); + return value.get(); + } + + double AirLoopHVACDedicatedOutdoorAirSystem_Impl::preheatDesignHumidityRatio() const { + boost::optional value = getDouble(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignHumidityRatio, true); + OS_ASSERT(value); + return value.get(); + } + + double AirLoopHVACDedicatedOutdoorAirSystem_Impl::precoolDesignTemperature() const { + boost::optional value = getDouble(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignTemperature, true); + OS_ASSERT(value); + return value.get(); + } + + double AirLoopHVACDedicatedOutdoorAirSystem_Impl::precoolDesignHumidityRatio() const { + boost::optional value = getDouble(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignHumidityRatio, true); + OS_ASSERT(value); + return value.get(); + } + + unsigned int AirLoopHVACDedicatedOutdoorAirSystem_Impl::numberofAirLoops() const { + return numExtensibleGroups(); + } + + std::vector AirLoopHVACDedicatedOutdoorAirSystem_Impl::airLoops() const { + std::vector result; + auto groups = extensibleGroups(); + for (auto group : groups) { + auto target = group.cast().getTarget(OS_AirLoopHVAC_DedicatedOutdoorAirSystemExtensibleFields::AirLoop); + if (target) { + if (auto airLoop = target->optionalCast()) { + result.push_back(airLoop.get()); + } + } + } + return result; + } + + boost::optional AirLoopHVACDedicatedOutdoorAirSystem_Impl::airLoopIndex(const AirLoopHVAC& airLoopHVAC) const { + + boost::optional result; + + auto egs = castVector(extensibleGroups()); + auto h = openstudio::toString(airLoopHVAC.handle()); + auto it = std::find_if(egs.begin(), egs.end(), [&](const WorkspaceExtensibleGroup& eg) { + return (eg.getField(OS_AirLoopHVAC_DedicatedOutdoorAirSystemExtensibleFields::AirLoop).get() == h); + }); + + // If found, we compute the index by using std::distance between the start of vector and the iterator returned by std::find_if + if (it != egs.end()) { + result = std::distance(egs.begin(), it) + 1; + } + + return result; + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::setAirLoopHVACOutdoorAirSystem(const AirLoopHVACOutdoorAirSystem& airLoopHVACOutdoorAirSystem) { + boost::optional currentDOAS = airLoopHVACOutdoorAirSystem.airLoopHVACDedicatedOutdoorAirSystem(); + if (currentDOAS) { + if (currentDOAS->handle() == this->handle()) { + return true; + } + currentDOAS->remove(); + } + return setPointer(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::OutdoorAirSystem, airLoopHVACOutdoorAirSystem.handle()); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::setAvailabilitySchedule(Schedule& schedule) { + bool result = setSchedule(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::AvailabilitySchedule, "AirLoopHVACDedicatedOutdoorAirSystem", + "Availability Schedule", schedule); + return result; + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::setPreheatDesignTemperature(double preheatDesignTemperature) { + bool result = setDouble(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignTemperature, preheatDesignTemperature); + return result; + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::setPreheatDesignHumidityRatio(double preheatDesignHumidityRatio) { + bool result = setDouble(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignHumidityRatio, preheatDesignHumidityRatio); + return result; + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::setPrecoolDesignTemperature(double precoolDesignTemperature) { + bool result = setDouble(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignTemperature, precoolDesignTemperature); + return result; + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::setPrecoolDesignHumidityRatio(double precoolDesignHumidityRatio) { + bool result = setDouble(OS_AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignHumidityRatio, precoolDesignHumidityRatio); + return result; + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::addAirLoop(const AirLoopHVAC& airLoopHVAC) { + // Check if airLoopHVAC already has a doas + if (boost::optional doas = airLoopHVAC.airLoopHVACDedicatedOutdoorAirSystem()) { + LOG(Warn, "For " << airLoopHVAC.nameString() << ", " << briefDescription() << " already exists."); + return true; + } + + // Check if airLoopHVAC already exists + boost::optional _existingIndex = airLoopIndex(airLoopHVAC); + if (_existingIndex) { + LOG(Warn, "For " << briefDescription() << ", AirLoopHVAC already exists."); + return true; + } + + bool result; + + WorkspaceExtensibleGroup eg = getObject().pushExtensibleGroup().cast(); + bool airloop = eg.setPointer(OS_AirLoopHVAC_DedicatedOutdoorAirSystemExtensibleFields::AirLoop, airLoopHVAC.handle()); + if (airloop) { + result = true; + } else { + // Something went wrong + // So erase the new extensible group + getObject().eraseExtensibleGroup(eg.groupIndex()); + result = false; + } + return result; + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::removeAirLoop(const AirLoopHVAC& airLoopHVAC) { + boost::optional idx = airLoopIndex(airLoopHVAC); + if (!idx) { + LOG(Warn, "For " << briefDescription() << " cannot remove air loop " << airLoopHVAC.briefDescription() << " since it is not part of it."); + return false; + } + + return removeAirLoop(idx.get()); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::removeAirLoop(unsigned groupIndex) { + bool result = false; + if ((groupIndex > 0) && (groupIndex <= numberofAirLoops())) { + getObject().eraseExtensibleGroup(groupIndex - 1); + result = true; + } + return result; + } + + void AirLoopHVACDedicatedOutdoorAirSystem_Impl::removeAllAirLoops() { + clearExtensibleGroups(); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem_Impl::addAirLoops(const std::vector& airLoopHVACs) { + bool ok = true; + for (const AirLoopHVAC& airLoopHVAC : airLoopHVACs) { + ok &= addAirLoop(airLoopHVAC); + } + return ok; + } + + } // namespace detail + + AirLoopHVACDedicatedOutdoorAirSystem::AirLoopHVACDedicatedOutdoorAirSystem(const AirLoopHVACOutdoorAirSystem& airLoopHVACOutdoorAirSystem) + : ModelObject(AirLoopHVACDedicatedOutdoorAirSystem::iddObjectType(), airLoopHVACOutdoorAirSystem.model()) { + OS_ASSERT(getImpl()); + + setAirLoopHVACOutdoorAirSystem(airLoopHVACOutdoorAirSystem); + { + auto schedule = airLoopHVACOutdoorAirSystem.model().alwaysOnDiscreteSchedule(); + setAvailabilitySchedule(schedule); + } + setPreheatDesignTemperature(4.5); + setPreheatDesignHumidityRatio(0.004); + setPrecoolDesignTemperature(17.5); + setPrecoolDesignHumidityRatio(0.012); + } + + IddObjectType AirLoopHVACDedicatedOutdoorAirSystem::iddObjectType() { + return IddObjectType(IddObjectType::OS_AirLoopHVAC_DedicatedOutdoorAirSystem); + } + + AirLoopHVACOutdoorAirSystem AirLoopHVACDedicatedOutdoorAirSystem::airLoopHVACOutdoorAirSystem() const { + return getImpl()->airLoopHVACOutdoorAirSystem(); + } + + Schedule AirLoopHVACDedicatedOutdoorAirSystem::availabilitySchedule() const { + return getImpl()->availabilitySchedule(); + } + + double AirLoopHVACDedicatedOutdoorAirSystem::preheatDesignTemperature() const { + return getImpl()->preheatDesignTemperature(); + } + + double AirLoopHVACDedicatedOutdoorAirSystem::preheatDesignHumidityRatio() const { + return getImpl()->preheatDesignHumidityRatio(); + } + + double AirLoopHVACDedicatedOutdoorAirSystem::precoolDesignTemperature() const { + return getImpl()->precoolDesignTemperature(); + } + + double AirLoopHVACDedicatedOutdoorAirSystem::precoolDesignHumidityRatio() const { + return getImpl()->precoolDesignHumidityRatio(); + } + + unsigned int AirLoopHVACDedicatedOutdoorAirSystem::numberofAirLoops() const { + return getImpl()->numberofAirLoops(); + } + + std::vector AirLoopHVACDedicatedOutdoorAirSystem::airLoops() const { + return getImpl()->airLoops(); + } + + boost::optional AirLoopHVACDedicatedOutdoorAirSystem::airLoopIndex(const AirLoopHVAC& airLoopHVAC) const { + return getImpl()->airLoopIndex(airLoopHVAC); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::setAirLoopHVACOutdoorAirSystem(const AirLoopHVACOutdoorAirSystem& airLoopHVACOutdoorAirSystem) { + return getImpl()->setAirLoopHVACOutdoorAirSystem(airLoopHVACOutdoorAirSystem); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::setAvailabilitySchedule(Schedule& schedule) { + return getImpl()->setAvailabilitySchedule(schedule); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::setPreheatDesignTemperature(double preheatDesignTemperature) { + return getImpl()->setPreheatDesignTemperature(preheatDesignTemperature); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::setPreheatDesignHumidityRatio(double preheatDesignHumidityRatio) { + return getImpl()->setPreheatDesignHumidityRatio(preheatDesignHumidityRatio); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::setPrecoolDesignTemperature(double precoolDesignTemperature) { + return getImpl()->setPrecoolDesignTemperature(precoolDesignTemperature); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::setPrecoolDesignHumidityRatio(double precoolDesignHumidityRatio) { + return getImpl()->setPrecoolDesignHumidityRatio(precoolDesignHumidityRatio); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::addAirLoop(const AirLoopHVAC& airLoopHVAC) { + return getImpl()->addAirLoop(airLoopHVAC); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::removeAirLoop(const AirLoopHVAC& airLoopHVAC) { + return getImpl()->removeAirLoop(airLoopHVAC); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::removeAirLoop(unsigned groupIndex) { + return getImpl()->removeAirLoop(groupIndex); + } + + void AirLoopHVACDedicatedOutdoorAirSystem::removeAllAirLoops() { + getImpl()->removeAllAirLoops(); + } + + bool AirLoopHVACDedicatedOutdoorAirSystem::addAirLoops(const std::vector& airLoopHVACs) { + return getImpl()->addAirLoops(airLoopHVACs); + } + + /// @cond + AirLoopHVACDedicatedOutdoorAirSystem::AirLoopHVACDedicatedOutdoorAirSystem(std::shared_ptr impl) + : ModelObject(std::move(impl)) {} + /// @endcond + +} // namespace model +} // namespace openstudio diff --git a/src/model/AirLoopHVACDedicatedOutdoorAirSystem.hpp b/src/model/AirLoopHVACDedicatedOutdoorAirSystem.hpp new file mode 100644 index 0000000000..7c5c8659b3 --- /dev/null +++ b/src/model/AirLoopHVACDedicatedOutdoorAirSystem.hpp @@ -0,0 +1,141 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +* following conditions are met: +* +* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following +* disclaimer. +* +* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the distribution. +* +* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission from the respective party. +* +* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works +* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior +* written permission from Alliance for Sustainable Energy, LLC. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED +* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +***********************************************************************************************************************/ + +#ifndef MODEL_AIRLOOPHVACDEDICATEDOUTDOORAIRSYSTEM_HPP +#define MODEL_AIRLOOPHVACDEDICATEDOUTDOORAIRSYSTEM_HPP + +#include "ModelAPI.hpp" +#include "ModelObject.hpp" + +namespace openstudio { + +namespace model { + + class AirLoopHVACOutdoorAirSystem; + class Schedule; + class AirLoopHVAC; + + namespace detail { + + class AirLoopHVACDedicatedOutdoorAirSystem_Impl; + + } // namespace detail + + /** AirLoopHVACDedicatedOutdoorAirSystem is a ModelObject that wraps the OpenStudio IDD object 'OS:AirLoopHVAC:DedicatedOutdoorAirSystem:MovableInsulation'. */ + class MODEL_API AirLoopHVACDedicatedOutdoorAirSystem : public ModelObject + { + public: + /** @name Constructors and Destructors */ + //@{ + explicit AirLoopHVACDedicatedOutdoorAirSystem(const AirLoopHVACOutdoorAirSystem& oaSystem); + + virtual ~AirLoopHVACDedicatedOutdoorAirSystem() {} + + //@} + + static IddObjectType iddObjectType(); + + //@} + /** @name Getters */ + //@{ + + AirLoopHVACOutdoorAirSystem airLoopHVACOutdoorAirSystem() const; + + Schedule availabilitySchedule() const; + + double preheatDesignTemperature() const; + + double preheatDesignHumidityRatio() const; + + double precoolDesignTemperature() const; + + double precoolDesignHumidityRatio() const; + + unsigned int numberofAirLoops() const; + + std::vector airLoops() const; + + boost::optional airLoopIndex(const AirLoopHVAC& airLoopHVAC) const; + + //@} + /** @name Setters */ + //@{ + + bool setAirLoopHVACOutdoorAirSystem(const AirLoopHVACOutdoorAirSystem& airLoopHVACOutdoorAirSystem); + + bool setAvailabilitySchedule(Schedule& schedule); + + bool setPreheatDesignTemperature(double preheatDesignTemperature); + + bool setPreheatDesignHumidityRatio(double preheatDesignHumidityRatio); + + bool setPrecoolDesignTemperature(double precoolDesignTemperature); + + bool setPrecoolDesignHumidityRatio(double precoolDesignHumidityRatio); + + bool addAirLoop(const AirLoopHVAC& airLoopHVAC); + + bool removeAirLoop(const AirLoopHVAC& airLoopHVAC); + + bool removeAirLoop(unsigned groupIndex); + + void removeAllAirLoops(); + + bool addAirLoops(const std::vector& airLoopHVACs); + + //@} + /** @name Other */ + //@{ + + //@} + protected: + /// @cond + typedef detail::AirLoopHVACDedicatedOutdoorAirSystem_Impl ImplType; + + explicit AirLoopHVACDedicatedOutdoorAirSystem(std::shared_ptr impl); + + friend class detail::AirLoopHVACDedicatedOutdoorAirSystem_Impl; + friend class Model; + friend class IdfObject; + friend class openstudio::detail::IdfObject_Impl; + /// @endcond + private: + REGISTER_LOGGER("openstudio.model.AirLoopHVACDedicatedOutdoorAirSystem"); + }; + + /** \relates AirLoopHVACDedicatedOutdoorAirSystem */ + typedef boost::optional OptionalAirLoopHVACDedicatedOutdoorAirSystem; + + /** \relates AirLoopHVACDedicatedOutdoorAirSystem */ + typedef std::vector AirLoopHVACDedicatedOutdoorAirSystemVector; + +} // namespace model +} // namespace openstudio + +#endif // MODEL_AIRLOOPHVACDEDICATEDOUTDOORAIRSYSTEM_HPP diff --git a/src/model/AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp b/src/model/AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp new file mode 100644 index 0000000000..945eed8146 --- /dev/null +++ b/src/model/AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp @@ -0,0 +1,135 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +* following conditions are met: +* +* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following +* disclaimer. +* +* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the distribution. +* +* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission from the respective party. +* +* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works +* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior +* written permission from Alliance for Sustainable Energy, LLC. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED +* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +***********************************************************************************************************************/ + +#ifndef MODEL_AIRLOOPHVACDEDICATEDOUTDOORAIRSYSTEM_IMPL_HPP +#define MODEL_AIRLOOPHVACDEDICATEDOUTDOORAIRSYSTEM_IMPL_HPP + +#include "ModelAPI.hpp" +#include "ModelObject_Impl.hpp" + +namespace openstudio { +namespace model { + + class AirLoopHVACOutdoorAirSystem; + class Schedule; + class AirLoopHVAC; + + namespace detail { + + /** AirLoopHVACDedicatedOutdoorAirSystem_Impl is a ModelObject_Impl that is the implementation class for AirLoopHVACDedicatedOutdoorAirSystem.*/ + class MODEL_API AirLoopHVACDedicatedOutdoorAirSystem_Impl : public ModelObject_Impl + { + public: + /** @name Constructors and Destructors */ + //@{ + + AirLoopHVACDedicatedOutdoorAirSystem_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); + + AirLoopHVACDedicatedOutdoorAirSystem_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); + + AirLoopHVACDedicatedOutdoorAirSystem_Impl(const AirLoopHVACDedicatedOutdoorAirSystem_Impl& other, Model_Impl* model, bool keepHandle); + + virtual ~AirLoopHVACDedicatedOutdoorAirSystem_Impl() {} + + //@} + /** @name Virtual Methods */ + //@{ + + virtual ModelObject clone(Model model) const override; + + virtual const std::vector& outputVariableNames() const override; + + virtual IddObjectType iddObjectType() const override; + + virtual std::vector getScheduleTypeKeys(const Schedule& schedule) const override; + + //@} + /** @name Getters */ + //@{ + + AirLoopHVACOutdoorAirSystem airLoopHVACOutdoorAirSystem() const; + + Schedule availabilitySchedule() const; + + double preheatDesignTemperature() const; + + double preheatDesignHumidityRatio() const; + + double precoolDesignTemperature() const; + + double precoolDesignHumidityRatio() const; + + unsigned int numberofAirLoops() const; + + std::vector airLoops() const; + + boost::optional airLoopIndex(const AirLoopHVAC& airLoopHVAC) const; + + //@} + /** @name Setters */ + //@{ + + bool setAirLoopHVACOutdoorAirSystem(const AirLoopHVACOutdoorAirSystem& airLoopHVACOutdoorAirSystem); + + bool setAvailabilitySchedule(Schedule& schedule); + + bool setPreheatDesignTemperature(double preheatDesignTemperature); + + bool setPreheatDesignHumidityRatio(double preheatDesignHumidityRatio); + + bool setPrecoolDesignTemperature(double precoolDesignTemperature); + + bool setPrecoolDesignHumidityRatio(double precoolDesignHumidityRatio); + + bool addAirLoop(const AirLoopHVAC& airLoopHVAC); + + bool removeAirLoop(const AirLoopHVAC& airLoopHVAC); + + bool removeAirLoop(unsigned groupIndex); + + void removeAllAirLoops(); + + bool addAirLoops(const std::vector& airLoopHVACs); + + //@} + /** @name Other */ + //@{ + + //@} + protected: + private: + REGISTER_LOGGER("openstudio.model.AirLoopHVACDedicatedOutdoorAirSystem"); + }; + + } // namespace detail + +} // namespace model +} // namespace openstudio + +#endif // MODEL_AIRLOOPHVACDEDICATEDOUTDOORAIRSYSTEM_IMPL_HPP diff --git a/src/model/AirLoopHVACOutdoorAirSystem.cpp b/src/model/AirLoopHVACOutdoorAirSystem.cpp index e3686b2d80..a4a9b6a60f 100644 --- a/src/model/AirLoopHVACOutdoorAirSystem.cpp +++ b/src/model/AirLoopHVACOutdoorAirSystem.cpp @@ -29,6 +29,8 @@ #include "AirLoopHVACOutdoorAirSystem.hpp" #include "AirLoopHVACOutdoorAirSystem_Impl.hpp" +#include "AirLoopHVACDedicatedOutdoorAirSystem.hpp" +#include "AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" #include "AirToAirComponent.hpp" #include "AirToAirComponent_Impl.hpp" #include "WaterToAirComponent.hpp" @@ -589,6 +591,20 @@ namespace model { return boost::none; } + boost::optional AirLoopHVACOutdoorAirSystem_Impl::airLoopHVACDedicatedOutdoorAirSystem() const { + AirLoopHVACOutdoorAirSystem thisOASystem = getObject(); + std::vector doaSystems = + thisOASystem.getModelObjectSources(AirLoopHVACDedicatedOutdoorAirSystem::iddObjectType()); + if (doaSystems.empty()) { + return boost::none; + } else if (doaSystems.size() == 1) { + return doaSystems.at(0); + } else { + LOG(Error, "More than one AirLoopHVACDedicatedOutdoorAirSystem points to this AirLoopHVACOutdoorAirSystem"); + return boost::none; + } + } + } // namespace detail // create a new AirLoopHVACOutdoorAirSystem object in the model's workspace @@ -713,5 +729,9 @@ namespace model { return getImpl()->airflowNetworkDistributionNode(); } + boost::optional AirLoopHVACOutdoorAirSystem::airLoopHVACDedicatedOutdoorAirSystem() const { + return getImpl()->airLoopHVACDedicatedOutdoorAirSystem(); + } + } // namespace model } // namespace openstudio diff --git a/src/model/AirLoopHVACOutdoorAirSystem.hpp b/src/model/AirLoopHVACOutdoorAirSystem.hpp index 400cc74ea1..9acc7d29e5 100644 --- a/src/model/AirLoopHVACOutdoorAirSystem.hpp +++ b/src/model/AirLoopHVACOutdoorAirSystem.hpp @@ -47,6 +47,7 @@ namespace model { class ControllerOutdoorAir; class Node; class AirflowNetworkDistributionNode; + class AirLoopHVACDedicatedOutdoorAirSystem; /** AirLoopHVACOutdoorAirSystem is an HVACComponent that wraps the IDD object * named "OS:AirLoopHVAC:OutdoorAirSystem" @@ -150,17 +151,20 @@ namespace model { static IddObjectType iddObjectType(); - protected: - friend class Model; - - friend class openstudio::IdfObject; + /** Returns the AirLoopHVACDedicatedOutdoorAirSystem, if it exists. */ + boost::optional airLoopHVACDedicatedOutdoorAirSystem() const; + protected: /// @cond - typedef detail::AirLoopHVACOutdoorAirSystem_Impl ImplType; explicit AirLoopHVACOutdoorAirSystem(std::shared_ptr impl); + friend class detail::AirLoopHVACOutdoorAirSystem_Impl; + friend class Model; + friend class IdfObject; + friend class openstudio::detail::IdfObject_Impl; + /// @cond private: REGISTER_LOGGER("openstudio.model.AirLoopHVACOutdoorAirSystem"); diff --git a/src/model/AirLoopHVACOutdoorAirSystem_Impl.hpp b/src/model/AirLoopHVACOutdoorAirSystem_Impl.hpp index c3ac682b22..6104c26017 100644 --- a/src/model/AirLoopHVACOutdoorAirSystem_Impl.hpp +++ b/src/model/AirLoopHVACOutdoorAirSystem_Impl.hpp @@ -40,6 +40,7 @@ namespace model { class ControllerOutdoorAir; class Node; class AirflowNetworkDistributionNode; + class AirLoopHVACDedicatedOutdoorAirSystem; namespace detail { @@ -109,6 +110,8 @@ namespace model { boost::optional airflowNetworkDistributionNode() const; + boost::optional airLoopHVACDedicatedOutdoorAirSystem() const; + private: REGISTER_LOGGER("openstudio.model.AirLoopHVACOutdoorAirSystem"); diff --git a/src/model/AirLoopHVAC_Impl.hpp b/src/model/AirLoopHVAC_Impl.hpp index c55eeac1ce..f5122aa9d2 100644 --- a/src/model/AirLoopHVAC_Impl.hpp +++ b/src/model/AirLoopHVAC_Impl.hpp @@ -38,6 +38,7 @@ namespace model { class AirLoopHVAC; class Node; class AirLoopHVACOutdoorAirSystem; + class AirLoopHVACDedicatedOutdoorAirSystem; class AirLoopHVACZoneSplitter; class AirLoopHVACZoneMixer; class AirLoopHVACSupplyPlenum; @@ -106,6 +107,8 @@ namespace model { boost::optional airLoopHVACOutdoorAirSystem() const; + boost::optional airLoopHVACDedicatedOutdoorAirSystem() const; + boost::optional supplySplitter() const; bool setSupplySplitter(Splitter const& splitter); diff --git a/src/model/CMakeLists.txt b/src/model/CMakeLists.txt index c0969818df..4870d7d828 100644 --- a/src/model/CMakeLists.txt +++ b/src/model/CMakeLists.txt @@ -137,6 +137,9 @@ set(${target_name}_src AirLoopHVACOutdoorAirSystem.hpp AirLoopHVACOutdoorAirSystem_Impl.hpp AirLoopHVACOutdoorAirSystem.cpp + AirLoopHVACDedicatedOutdoorAirSystem.hpp + AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp + AirLoopHVACDedicatedOutdoorAirSystem.cpp AirLoopHVACReturnPlenum.hpp AirLoopHVACReturnPlenum_Impl.hpp AirLoopHVACReturnPlenum.cpp @@ -1747,6 +1750,7 @@ set(${target_name}_test_src test/AirflowNetworkZone_GTest.cpp test/AirGap_GTest.cpp test/AirLoopHVACOutdoorAirSystem_GTest.cpp + test/AirLoopHVACDedicatedOutdoorAirSystem_GTest.cpp test/AirLoopHVACUnitaryHeatPumpAirToAir_GTest.cpp test/AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_GTest.cpp test/AirLoopHVACUnitarySystem_GTest.cpp diff --git a/src/model/ConcreteModelObjects.hpp b/src/model/ConcreteModelObjects.hpp index fb1a2844c7..9d2db35185 100644 --- a/src/model/ConcreteModelObjects.hpp +++ b/src/model/ConcreteModelObjects.hpp @@ -56,6 +56,7 @@ #include "AirGap.hpp" #include "AirLoopHVAC.hpp" #include "AirLoopHVACOutdoorAirSystem.hpp" +#include "AirLoopHVACDedicatedOutdoorAirSystem.hpp" #include "AirLoopHVACUnitaryHeatPumpAirToAir.hpp" #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.hpp" #include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.hpp" @@ -561,6 +562,7 @@ #include "AirLoopHVACUnitaryHeatPumpAirToAir_Impl.hpp" #include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl.hpp" #include "AirLoopHVACOutdoorAirSystem_Impl.hpp" +#include "AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" #include "AirLoopHVACReturnPlenum_Impl.hpp" #include "AirLoopHVACSupplyPlenum_Impl.hpp" #include "AirLoopHVACUnitarySystem_Impl.hpp" diff --git a/src/model/ConstructionAirBoundary.hpp b/src/model/ConstructionAirBoundary.hpp index ec9450a1e6..7dc1446096 100644 --- a/src/model/ConstructionAirBoundary.hpp +++ b/src/model/ConstructionAirBoundary.hpp @@ -71,12 +71,16 @@ namespace model { /** @name Getters */ //@{ + // cppcheck-suppress functionStatic OS_DEPRECATED std::string solarAndDaylightingMethod() const; + // cppcheck-suppress functionStatic OS_DEPRECATED bool isSolarAndDaylightingMethodDefaulted() const; + // cppcheck-suppress functionStatic OS_DEPRECATED std::string radiantExchangeMethod() const; + // cppcheck-suppress functionStatic OS_DEPRECATED bool isRadiantExchangeMethodDefaulted() const; std::string airExchangeMethod() const; @@ -93,12 +97,16 @@ namespace model { /** @name Setters */ //@{ + // cppcheck-suppress functionStatic OS_DEPRECATED bool setSolarAndDaylightingMethod(const std::string& solarAndDaylightingMethod); + // cppcheck-suppress functionStatic OS_DEPRECATED void resetSolarAndDaylightingMethod(); + // cppcheck-suppress functionStatic OS_DEPRECATED bool setRadiantExchangeMethod(const std::string& radiantExchangeMethod); + // cppcheck-suppress functionStatic OS_DEPRECATED void resetRadiantExchangeMethod(); bool setAirExchangeMethod(const std::string& airExchangeMethod); diff --git a/src/model/Model.cpp b/src/model/Model.cpp index a44d530331..d72c79fcee 100644 --- a/src/model/Model.cpp +++ b/src/model/Model.cpp @@ -2595,6 +2595,7 @@ namespace model { REGISTER_CONSTRUCTOR(AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed); REGISTER_CONSTRUCTOR(AirLoopHVACUnitaryHeatPumpAirToAir); REGISTER_CONSTRUCTOR(AirLoopHVACOutdoorAirSystem); + REGISTER_CONSTRUCTOR(AirLoopHVACDedicatedOutdoorAirSystem); REGISTER_CONSTRUCTOR(AirLoopHVACReturnPlenum); REGISTER_CONSTRUCTOR(AirLoopHVACSupplyPlenum); REGISTER_CONSTRUCTOR(AirLoopHVACUnitarySystem); @@ -3105,6 +3106,7 @@ namespace model { REGISTER_COPYCONSTRUCTORS(AirLoopHVACUnitaryHeatPumpAirToAir); REGISTER_COPYCONSTRUCTORS(AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed); REGISTER_COPYCONSTRUCTORS(AirLoopHVACOutdoorAirSystem); + REGISTER_COPYCONSTRUCTORS(AirLoopHVACDedicatedOutdoorAirSystem); REGISTER_COPYCONSTRUCTORS(AirLoopHVACReturnPlenum); REGISTER_COPYCONSTRUCTORS(AirLoopHVACSupplyPlenum); REGISTER_COPYCONSTRUCTORS(AirLoopHVACUnitarySystem); diff --git a/src/model/ModelHVAC.i b/src/model/ModelHVAC.i index cedf6e7b88..5bdd75b837 100644 --- a/src/model/ModelHVAC.i +++ b/src/model/ModelHVAC.i @@ -129,6 +129,7 @@ MODELOBJECT_TEMPLATES(PlantEquipmentOperationScheme); MODELOBJECT_TEMPLATES(PlantEquipmentOperationRangeBasedScheme); MODELOBJECT_TEMPLATES(PlantComponentUserDefined); MODELOBJECT_TEMPLATES(AirLoopHVACOutdoorAirSystem); +MODELOBJECT_TEMPLATES(AirLoopHVACDedicatedOutdoorAirSystem); MODELOBJECT_TEMPLATES(ControllerMechanicalVentilation); MODELOBJECT_TEMPLATES(ControllerOutdoorAir); MODELOBJECT_TEMPLATES(ControllerWaterCoil); @@ -241,6 +242,7 @@ SWIG_MODELOBJECT(PlantEquipmentOperationScheme, 0); SWIG_MODELOBJECT(PlantEquipmentOperationRangeBasedScheme, 0); SWIG_MODELOBJECT(PlantComponentUserDefined, 1); SWIG_MODELOBJECT(AirLoopHVACOutdoorAirSystem, 1); +SWIG_MODELOBJECT(AirLoopHVACDedicatedOutdoorAirSystem, 1); SWIG_MODELOBJECT(ControllerMechanicalVentilation, 1); SWIG_MODELOBJECT(ControllerOutdoorAir, 1); SWIG_MODELOBJECT(ControllerWaterCoil, 1); diff --git a/src/model/ScheduleTypeRegistry.cpp b/src/model/ScheduleTypeRegistry.cpp index be1c0dac3f..230970ead6 100644 --- a/src/model/ScheduleTypeRegistry.cpp +++ b/src/model/ScheduleTypeRegistry.cpp @@ -116,6 +116,7 @@ namespace model { {"AirConditionerVariableRefrigerantFlow", "Basin Heater Operating Schedule", "basinHeaterOperatingSchedule", false, "Availability", 0.0, 1.0}, {"AirLoopHVAC", "Return Air Bypass Flow Temperature Setpoint", "returnAirBypassFlowTemperatureSetpointSchedule", true, "Temperature", OptionalDouble(), OptionalDouble()}, + {"AirLoopHVACDedicatedOutdoorAirSystem", "Availability Schedule", "availabilitySchedule", false, "Availability", 0.0, 1.0}, {"AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass", "Availability Schedule", "availabilitySchedule", false, "Availability", 0.0, 1.0}, {"AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass", "Outdoor Air Flow Rate Multiplier Schedule", "outdoorAirFlowRateMultiplierSchedule", true, "", 0.0, 1.0}, diff --git a/src/model/test/AirLoopHVACDedicatedOutdoorAirSystem_GTest.cpp b/src/model/test/AirLoopHVACDedicatedOutdoorAirSystem_GTest.cpp new file mode 100644 index 0000000000..67b7743b37 --- /dev/null +++ b/src/model/test/AirLoopHVACDedicatedOutdoorAirSystem_GTest.cpp @@ -0,0 +1,250 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +* following conditions are met: +* +* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following +* disclaimer. +* +* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the distribution. +* +* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products +* derived from this software without specific prior written permission from the respective party. +* +* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works +* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior +* written permission from Alliance for Sustainable Energy, LLC. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED +* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +***********************************************************************************************************************/ + +#include +#include "ModelFixture.hpp" +#include "../AirLoopHVACDedicatedOutdoorAirSystem.hpp" +#include "../AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" +#include "../AirLoopHVACOutdoorAirSystem.hpp" +#include "../AirLoopHVACOutdoorAirSystem_Impl.hpp" +#include "../ControllerOutdoorAir.hpp" +#include "../ControllerOutdoorAir_Impl.hpp" +#include "../AirLoopHVAC.hpp" +#include "../AirLoopHVAC_Impl.hpp" +#include "../ScheduleConstant.hpp" +#include "../ScheduleConstant_Impl.hpp" + +#include "../../utilities/idd/IddEnums.hpp" +#include + +using namespace openstudio::model; + +TEST_F(ModelFixture, AirLoopHVACDedicatedOutdoorAirSystem_AirLoopHVACDedicatedOutdoorAirSystem) { + ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + + ASSERT_EXIT( + { + Model model; + + ControllerOutdoorAir controller(model); + AirLoopHVACOutdoorAirSystem oaSystem(model, controller); + AirLoopHVACDedicatedOutdoorAirSystem doaSystem(oaSystem); + + exit(0); + }, + ::testing::ExitedWithCode(0), ""); + + Model model; + + ControllerOutdoorAir controller(model); + AirLoopHVACOutdoorAirSystem oaSystem(model, controller); + AirLoopHVACDedicatedOutdoorAirSystem doaSystem(oaSystem); + + ASSERT_TRUE(doaSystem.airLoopHVACOutdoorAirSystem().optionalCast()); + ASSERT_TRUE(doaSystem.availabilitySchedule().optionalCast()); + EXPECT_EQ(4.5, doaSystem.preheatDesignTemperature()); + EXPECT_EQ(0.004, doaSystem.preheatDesignHumidityRatio()); + EXPECT_EQ(17.5, doaSystem.precoolDesignTemperature()); + EXPECT_EQ(0.012, doaSystem.precoolDesignHumidityRatio()); + EXPECT_EQ(0, doaSystem.numberofAirLoops()); + EXPECT_EQ(0, doaSystem.airLoops().size()); +} + +TEST_F(ModelFixture, AirLoopHVACDedicatedOutdoorAirSystem_SetGetFields) { + Model model; + + ControllerOutdoorAir controller(model); + AirLoopHVACOutdoorAirSystem oaSystem(model, controller); + EXPECT_FALSE(oaSystem.airLoopHVACDedicatedOutdoorAirSystem()); + AirLoopHVACDedicatedOutdoorAirSystem doaSystem(oaSystem); + EXPECT_TRUE(oaSystem.airLoopHVACDedicatedOutdoorAirSystem()); + + ControllerOutdoorAir controller2(model); + AirLoopHVACOutdoorAirSystem oaSystem2(model, controller2); + oaSystem2.setName("New System"); + ScheduleConstant sched(model); + sched.setValue(0.5); + AirLoopHVAC airLoop(model); + + EXPECT_TRUE(doaSystem.setAirLoopHVACOutdoorAirSystem(oaSystem2)); + EXPECT_TRUE(doaSystem.setAvailabilitySchedule(sched)); + EXPECT_TRUE(doaSystem.setPreheatDesignTemperature(5.0)); + EXPECT_TRUE(doaSystem.setPreheatDesignHumidityRatio(0.0035)); + EXPECT_TRUE(doaSystem.setPrecoolDesignTemperature(18.2)); + EXPECT_TRUE(doaSystem.setPrecoolDesignHumidityRatio(0.0112)); + EXPECT_TRUE(doaSystem.addAirLoop(airLoop)); + + ASSERT_TRUE(doaSystem.airLoopHVACOutdoorAirSystem().optionalCast()); + EXPECT_EQ("New System", doaSystem.airLoopHVACOutdoorAirSystem().nameString()); + Schedule schedule = doaSystem.availabilitySchedule(); + boost::optional scheduleConstant = schedule.optionalCast(); + ASSERT_TRUE(scheduleConstant); + EXPECT_EQ((*scheduleConstant).value(), 0.5); + EXPECT_EQ(5.0, doaSystem.preheatDesignTemperature()); + EXPECT_EQ(0.0035, doaSystem.preheatDesignHumidityRatio()); + EXPECT_EQ(18.2, doaSystem.precoolDesignTemperature()); + EXPECT_EQ(0.0112, doaSystem.precoolDesignHumidityRatio()); + EXPECT_EQ(1, doaSystem.numberofAirLoops()); + EXPECT_EQ(1, doaSystem.airLoops().size()); + EXPECT_TRUE(doaSystem.removeAirLoop(airLoop)); + EXPECT_EQ(0, doaSystem.numberofAirLoops()); + EXPECT_EQ(0, doaSystem.airLoops().size()); + + std::vector airLoopHVACs; + EXPECT_FALSE(airLoop.airLoopHVACDedicatedOutdoorAirSystem()); + airLoopHVACs.push_back(airLoop); + EXPECT_TRUE(doaSystem.addAirLoops(airLoopHVACs)); + EXPECT_EQ(1, doaSystem.numberofAirLoops()); + EXPECT_EQ(1, doaSystem.airLoops().size()); + EXPECT_TRUE(airLoop.airLoopHVACDedicatedOutdoorAirSystem()); + doaSystem.removeAllAirLoops(); + EXPECT_EQ(0, doaSystem.numberofAirLoops()); + EXPECT_EQ(0, doaSystem.airLoops().size()); + EXPECT_FALSE(doaSystem.removeAirLoop(0)); + + AirLoopHVAC airLoop2(model); + airLoopHVACs.push_back(airLoop2); + + EXPECT_TRUE(doaSystem.addAirLoops(airLoopHVACs)); + EXPECT_EQ(2, doaSystem.numberofAirLoops()); + EXPECT_EQ(2, doaSystem.airLoops().size()); + EXPECT_TRUE(doaSystem.removeAirLoop(1)); + EXPECT_EQ(1, doaSystem.numberofAirLoops()); + EXPECT_EQ(1, doaSystem.airLoops().size()); +} + +TEST_F(ModelFixture, AirLoopHVACDedicatedOutdoorAirSystem_AirLoops) { + Model model; + ControllerOutdoorAir controller(model); + AirLoopHVACOutdoorAirSystem oaSystem(model, controller); + AirLoopHVACDedicatedOutdoorAirSystem doaSystem(oaSystem); + + AirLoopHVAC airLoop1(model); + EXPECT_EQ(0, doaSystem.airLoops().size()); + EXPECT_TRUE(doaSystem.addAirLoop(airLoop1)); + EXPECT_EQ(1, doaSystem.airLoops().size()); + EXPECT_TRUE(doaSystem.addAirLoop(airLoop1)); + EXPECT_EQ(1, doaSystem.airLoops().size()); + + ControllerOutdoorAir controller2(model); + AirLoopHVACOutdoorAirSystem oaSystem2(model, controller2); + AirLoopHVACDedicatedOutdoorAirSystem doaSystem2(oaSystem2); + + AirLoopHVAC airLoop2(model); + EXPECT_EQ(0, doaSystem2.airLoops().size()); + EXPECT_TRUE(doaSystem2.addAirLoop(airLoop2)); + EXPECT_EQ(1, doaSystem2.airLoops().size()); + EXPECT_TRUE(doaSystem.addAirLoop(airLoop1)); + EXPECT_EQ(1, doaSystem2.airLoops().size()); + + doaSystem2.removeAllAirLoops(); + EXPECT_EQ(0, doaSystem2.airLoops().size()); + std::vector airLoopHVACs; + airLoopHVACs.push_back(airLoop2); + airLoopHVACs.push_back(airLoop2); + + EXPECT_TRUE(doaSystem2.addAirLoops(airLoopHVACs)); + EXPECT_EQ(1, doaSystem2.airLoops().size()); +} + +TEST_F(ModelFixture, AirLoopHVACDedicatedOutdoorAirSystem_Clone) { + Model model; + ControllerOutdoorAir controller(model); + AirLoopHVACOutdoorAirSystem oaSystem(model, controller); + AirLoopHVAC airLoop(model); + AirLoopHVAC airLoop2(model); + std::vector airLoopHVACs; + airLoopHVACs.push_back(airLoop); + airLoopHVACs.push_back(airLoop2); + + AirLoopHVACDedicatedOutdoorAirSystem doaSystem(oaSystem); + doaSystem.addAirLoops(airLoopHVACs); + + EXPECT_EQ(2, doaSystem.numberofAirLoops()); + EXPECT_EQ(2, doaSystem.airLoops().size()); + EXPECT_EQ(2, model.getConcreteModelObjects().size()); + EXPECT_EQ(1, model.getConcreteModelObjects().size()); + + auto doaSystemClone = doaSystem.clone(model).cast(); + + EXPECT_EQ(2, doaSystemClone.numberofAirLoops()); + EXPECT_EQ(2, doaSystemClone.airLoops().size()); + EXPECT_EQ(2, model.getConcreteModelObjects().size()); + EXPECT_EQ(2, model.getConcreteModelObjects().size()); +} + +TEST_F(ModelFixture, AirLoopHVACDedicatedOutdoorAirSystem_Remove) { + Model model; + std::vector doaSystems = model.getModelObjects(); + EXPECT_EQ(0u, doaSystems.size()); + + ControllerOutdoorAir controller(model); + AirLoopHVACOutdoorAirSystem oaSystem(model, controller); + AirLoopHVAC airLoop(model); + AirLoopHVAC airLoop2(model); + std::vector airLoopHVACs; + airLoopHVACs.push_back(airLoop); + airLoopHVACs.push_back(airLoop2); + + AirLoopHVACDedicatedOutdoorAirSystem doaSystem(oaSystem); + doaSystem.addAirLoops(airLoopHVACs); + + doaSystems = model.getModelObjects(); + EXPECT_EQ(1u, doaSystems.size()); + + EXPECT_FALSE(doaSystem.remove().empty()); + doaSystems = model.getModelObjects(); + EXPECT_EQ(0u, doaSystems.size()); + EXPECT_FALSE(oaSystem.airLoopHVACDedicatedOutdoorAirSystem()); +} + +TEST_F(ModelFixture, AirLoopHVACDedicatedOutdoorAirSystem_Remove2) { + Model model; + std::vector doaSystems = model.getModelObjects(); + EXPECT_EQ(0u, doaSystems.size()); + + ControllerOutdoorAir controller(model); + AirLoopHVACOutdoorAirSystem oaSystem(model, controller); + AirLoopHVAC airLoop(model); + AirLoopHVAC airLoop2(model); + std::vector airLoopHVACs; + airLoopHVACs.push_back(airLoop); + airLoopHVACs.push_back(airLoop2); + + AirLoopHVACDedicatedOutdoorAirSystem doaSystem(oaSystem); + doaSystem.addAirLoops(airLoopHVACs); + + doaSystems = model.getModelObjects(); + EXPECT_EQ(1u, doaSystems.size()); + + EXPECT_FALSE(doaSystem.remove().empty()); + doaSystems = model.getModelObjects(); + EXPECT_EQ(0u, doaSystems.size()); + EXPECT_FALSE(oaSystem.airLoopHVACDedicatedOutdoorAirSystem()); +} diff --git a/src/utilities/idf/Test/WorkspaceObject_GTest.cpp b/src/utilities/idf/Test/WorkspaceObject_GTest.cpp index f87030e71f..99648e55e7 100644 --- a/src/utilities/idf/Test/WorkspaceObject_GTest.cpp +++ b/src/utilities/idf/Test/WorkspaceObject_GTest.cpp @@ -571,12 +571,16 @@ TEST_F(IdfFixture, WorkspaceObject_setString) { ASSERT_TRUE(space1.getString(nameIndex)); EXPECT_EQ("Space 1", space1.getString(nameIndex).get()); + EXPECT_TRUE(space2.setString(nameIndex, "SpaceA")); + EXPECT_EQ("SpaceA", space2.getString(nameIndex).get()); + EXPECT_TRUE(space2.setString(nameIndex, "Space 1")); // Setting works, but it should modify it ASSERT_TRUE(space2.getString(nameIndex)); EXPECT_NE("Space 1", space2.getString(nameIndex).get()); + EXPECT_EQ("Space 2", space2.getString(nameIndex).get()); - // That portion is accepted because the level is Draft, not Final - EXPECT_TRUE(space2.setString(nameIndex, "")); + // That portion is not accepted either, even at Draft level + EXPECT_FALSE(space2.setString(nameIndex, "")); ASSERT_TRUE(space2.getString(nameIndex)); - EXPECT_EQ("", space2.getString(nameIndex).get()); + EXPECT_EQ("Space 2", space2.getString(nameIndex).get()); } diff --git a/src/utilities/sql/Test/SqlFile_GTest.cpp b/src/utilities/sql/Test/SqlFile_GTest.cpp index 43355068ba..52187ed499 100644 --- a/src/utilities/sql/Test/SqlFile_GTest.cpp +++ b/src/utilities/sql/Test/SqlFile_GTest.cpp @@ -301,7 +301,21 @@ TEST_F(SqlFileFixture, AnnualTotalCosts) { // SqlResults ep_910 = {195052539.91, 27600.69, 427.17, 324.04, 782.87, 3256405.15, 191767000.0}; // SqlResults ep_920 = {194898706.43, 27595.94, 426.75, 324.25, 782.28, 3256577.21, 191613000.0}; // SqlResults ep_930 = {194906985.51, 27596.57, 426.75, 324.25, 782.28, 3262855.66, 191615000.0}; - SqlResults ep_940 = {191927299.41, 27898.69, 407.55, 361.09, 776.63, 3322855.45, 188575000.0}; + // SqlResults ep_940 = {191927299.41, 27898.69, 407.55, 361.09, 776.63, 3322855.45, 188575000.0}; + SqlResults ep_950 = {191927299.41, 27898.69, 407.55, 361.09, 776.63, 3322855.45, 188575000.0}; + + // To update, cd build/resources, then in Ruby + /* ```ruby + * sqlFile2 = OpenStudio::SqlFile.new('energyplus/Office_With_Many_HVAC_Types/eplusout.sql') + * vals = [] + * vals << sqlFile2.annualTotalUtilityCost().get + * fuelTypes = ["Electricity", "Gas", "DistrictCooling", "DistrictHeating", "Water", "FuelOil_1"] + * fuelTypes.each do |f| + * vals << sqlFile2.annualTotalCost(f.to_FuelType).get + * end + * vals + * ``` + */ // =========== Check that you are within relatively normal ranges compared to previous versions ================= @@ -323,15 +337,15 @@ TEST_F(SqlFileFixture, AnnualTotalCosts) { // =========== Check that within our development based on the current E+ version we do not make the results vary (at all) ================= // Total annual costs for all fuel types - EXPECT_NEAR(ep_940.annualTotalUtilityCost, sqlFile2.annualTotalUtilityCost().get(), 0.03); + EXPECT_NEAR(ep_950.annualTotalUtilityCost, sqlFile2.annualTotalUtilityCost().get(), 0.03); // Costs by fuel type - EXPECT_DOUBLE_EQ(ep_940.annualTotalCost_Electricity, sqlFile2.annualTotalCost(FuelType::Electricity).get()); - EXPECT_DOUBLE_EQ(ep_940.annualTotalCost_Gas, sqlFile2.annualTotalCost(FuelType::Gas).get()); - EXPECT_DOUBLE_EQ(ep_940.annualTotalCost_DistrictCooling, sqlFile2.annualTotalCost(FuelType::DistrictCooling).get()); - EXPECT_DOUBLE_EQ(ep_940.annualTotalCost_DistrictHeating, sqlFile2.annualTotalCost(FuelType::DistrictHeating).get()); - EXPECT_NEAR(ep_940.annualTotalCost_Water, sqlFile2.annualTotalCost(FuelType::Water).get(), 0.03); - EXPECT_DOUBLE_EQ(ep_940.annualTotalCost_FuelOil_1, sqlFile2.annualTotalCost(FuelType::FuelOil_1).get()); + EXPECT_DOUBLE_EQ(ep_950.annualTotalCost_Electricity, sqlFile2.annualTotalCost(FuelType::Electricity).get()); + EXPECT_DOUBLE_EQ(ep_950.annualTotalCost_Gas, sqlFile2.annualTotalCost(FuelType::Gas).get()); + EXPECT_DOUBLE_EQ(ep_950.annualTotalCost_DistrictCooling, sqlFile2.annualTotalCost(FuelType::DistrictCooling).get()); + EXPECT_DOUBLE_EQ(ep_950.annualTotalCost_DistrictHeating, sqlFile2.annualTotalCost(FuelType::DistrictHeating).get()); + EXPECT_NEAR(ep_950.annualTotalCost_Water, sqlFile2.annualTotalCost(FuelType::Water).get(), 0.03); + EXPECT_DOUBLE_EQ(ep_950.annualTotalCost_FuelOil_1, sqlFile2.annualTotalCost(FuelType::FuelOil_1).get()); // These have a relatively high tolerance and shouldn't fail, and they depend on the above values divided by square footage which shouldn't vary // So it's fine to keep it as is @@ -572,6 +586,7 @@ TEST_F(SqlFileFixture, Regressions) { regressionTestSqlFile("1ZoneEvapCooler-V9-2-0.sql", 43.28, 20, 20); regressionTestSqlFile("1ZoneEvapCooler-V9-3-0.sql", 43.28, 20, 20); regressionTestSqlFile("1ZoneEvapCooler-V9-4-0.sql", 43.28, 20, 20); + regressionTestSqlFile("1ZoneEvapCooler-V9-5-0.sql", 43.28, 20, 20); } TEST_F(SqlFileFixture, SqlFile_LeapYear) {