Skip to content

Commit

Permalink
add hard sizing, qaqc, and austin util rates
Browse files Browse the repository at this point in the history
  • Loading branch information
asparke2 committed Apr 13, 2014
1 parent bcc388e commit a4c940a
Show file tree
Hide file tree
Showing 59 changed files with 18,723 additions and 0 deletions.
365 changes: 365 additions & 0 deletions AustinTexasUtilityRates/measure.rb

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions AustinTexasUtilityRates/measure.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<measure>
<name>Austin Texas Utility Rates</name>
<uid>ea2947e8-54f2-4417-a5dc-512074bb7f93</uid>
<version_id>d8636f01-0680-4953-bd27-87f3e6e8078b</version_id>
<description>Set utility rate.</description>
<modeler_description>Set utility rate.</modeler_description>
<provenances/>
<tags>
<tag>Economics.Life Cycle Cost Analysis</tag>
</tags>
<attributes>
<attribute>
<name>Measure Function</name>
<value>Measure</value>
<datatype>string</datatype>
</attribute>
<attribute>
<name>Requires EnergyPlus Results</name>
<value>false</value>
<datatype>boolean</datatype>
</attribute>
<attribute>
<name>Measure Type</name>
<value>EnergyPlusMeasure</value>
<datatype>string</datatype>
</attribute>
<attribute>
<name>Uses SketchUp API</name>
<value>false</value>
<datatype>boolean</datatype>
</attribute>
</attributes>
<files>
<file>
<version>
<software_program>OpenStudio</software_program>
<identifier>0.11.3</identifier>
</version>
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>06616AB5</checksum>
</file>
<file>
<filename>Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW.idf</filename>
<filetype>idf</filetype>
<usage_type>resource</usage_type>
<checksum>E32D49CF</checksum>
</file>
<file>
<filename>Texas_Gas_Service_Commercial.idf</filename>
<filetype>idf</filetype>
<usage_type>resource</usage_type>
<checksum>C09D5821</checksum>
</file>
<file>
<filename>Austin_Downtown_Chilled_Water.idf</filename>
<filetype>idf</filetype>
<usage_type>resource</usage_type>
<checksum>AE668D53</checksum>
</file>
</files>
</measure>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

Version,
7.2.0.006; ! Version Identifier

UtilityCost:Tariff,
Austin_Downtown_Chilled_Water, !- Name
DistrictCooling:Facility, !- Output Meter Name
Therm, !- Conversion Factor Choice
, !- Energy Conversion Factor
, !- Demand Conversion Factor
, !- Time of Use Period Schedule Name
, !- Season Schedule Name
, !- Month Schedule Name
Day, !- Demand Window Length
0.0; !- Monthly Charge or Variable Name

UtilityCost:Charge:Simple,
FlatEnergyCharge-ChilledWater, !- Name
Austin_Downtown_Chilled_Water, !- Tariff Name
totalEnergy, !- Source Variable
Annual, !- Season
EnergyCharges, !- Category Variable Name
1.43; !- Cost per Unit Value or Variable Name ! $0.1716 Per Ton Hour (1 ton-hr = 0.12 therms) = $1.43/therm

UtilityCost:Charge:Simple,
FlatDemandCharge-ChilledWater, !- Name
Austin_Downtown_Chilled_Water, !- Tariff Name
totalDemand, !- Source Variable
Annual, !- Season
DemandCharges, !- Category Variable Name
0.0; !- Cost per Unit Value or Variable Name

Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

Version,
7.2.0.006; ! Version Identifier

UtilityCost:Tariff,
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW, !- Name
ElectricityPurchased:Facility, !- Output Meter Name
kWh, !- Conversion Factor Choice
, !- Energy Conversion Factor
, !- Demand Conversion Factor
TimeOfDaySchedule, !- Time of Use Period Schedule Name
TwoSeasonSchedule, !- Season Schedule Name
, !- Month Schedule Name
QuarterHour, !- Demand Window Length
0.0; !- Monthly Charge or Variable Name

UtilityCost:Charge:Simple,
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW SummerOnPeakEnergyCharge, !- Name
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW, !- Tariff Name
peakEnergy, !- Source Variable
summer, !- Season
EnergyCharges, !- Category Variable Name
0.03293; !- Cost per Unit Value or Variable Name

UtilityCost:Charge:Simple,
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW SummerOffPeakEnergyCharge, !- Name
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW, !- Tariff Name
offPeakEnergy, !- Source Variable
summer, !- Season
EnergyCharges, !- Category Variable Name
0.03293; !- Cost per Unit Value or Variable Name

UtilityCost:Charge:Simple,
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW WinterOnPeakEnergyCharge, !- Name
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW, !- Tariff Name
peakEnergy, !- Source Variable
winter, !- Season
EnergyCharges, !- Category Variable Name
0.02793; !- Cost per Unit Value or Variable Name

UtilityCost:Charge:Simple,
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW WinterOffPeakEnergyCharge, !- Name
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW, !- Tariff Name
offPeakEnergy, !- Source Variable
winter, !- Season
EnergyCharges, !- Category Variable Name
0.02793; !- Cost per Unit Value or Variable Name

UtilityCost:Charge:Simple,
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW SummerDemandCharge, !- Name
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW, !- Tariff Name
totalDemand, !- Source Variable
summer, !- Season
DemandCharges, !- Category Variable Name
12.62; !- Cost per Unit Value or Variable Name

UtilityCost:Charge:Simple,
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW WinterDemandCharge, !- Name
Austin_Energy_Commercial_Secondary_Voltage_10kW_50kW, !- Tariff Name
totalDemand, !- Source Variable
winter, !- Season
DemandCharges, !- Category Variable Name
11.62; !- Cost per Unit Value or Variable Name

Schedule:Compact,
TwoSeasonSchedule, !- Name
number, !- Schedule Type Limits Name
Through: 5/31, !- Field 1
For: AllDays, !- Field 2
Until: 24:00, ! Field 3
1, !- Field 3
Through: 9/30, !- Field 5
For: AllDays, !- Field 6
Until: 24:00, ! Field 7
3, !- Field 7
Through: 12/31, !- Field 9
For: AllDays, !- Field 10
Until: 24:00, ! Field 11
1; !- Field 11

Schedule:Compact,
TimeOfDaySchedule, !- Name
number, !- Schedule Type Limits Name
Through: 12/31, !- Field 1
For: Weekdays, !- Field 2
Until: 9:00, ! Field 3
3, !- Field 3
Until: 21:00, ! Field 5
1, !- Field 4
Until: 24:00, ! Field 7
3, !- Field 5
For: AllOtherDays, !- Field 6
Until: 24:00, ! Field 10
3; !- Field 7

ScheduleTypeLimits,
number, !- Name
0, !- Lower Limit Value
, !- Upper Limit Value
Continuous, !- Numeric Type
Dimensionless; !- Unit Type

32 changes: 32 additions & 0 deletions AustinTexasUtilityRates/resources/Texas_Gas_Service_Commercial.idf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

Version,
7.2.0.006; ! Version Identifier

UtilityCost:Tariff,
Texas Gas Service Commercial, !- Name
Gas:Facility, !- Output Meter Name
CCF, !- Conversion Factor Choice
, !- Energy Conversion Factor
, !- Demand Conversion Factor
, !- Time of Use Period Schedule Name
, !- Season Schedule Name
, !- Month Schedule Name
Day, !- Demand Window Length
12.75; !- Monthly Charge or Variable Name

UtilityCost:Charge:Simple,
FlatEnergyCharge-Gas, !- Name
Texas Gas Service Commercial, !- Tariff Name
totalEnergy, !- Source Variable
Annual, !- Season
EnergyCharges, !- Category Variable Name
0.1301; !- Cost per Unit Value or Variable Name

UtilityCost:Charge:Simple,
FlatDemandCharge-Gas, !- Name
Texas Gas Service Commercial, !- Tariff Name
totalDemand, !- Source Variable
Annual, !- Season
DemandCharges, !- Category Variable Name
0.0; !- Cost per Unit Value or Variable Name

161 changes: 161 additions & 0 deletions HardSizeHVACEquipment/measure.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
#see the URL below for information on how to write OpenStudio measures
# http://openstudio.nrel.gov/openstudio-measure-writing-guide

#see the URL below for information on using life cycle cost objects in OpenStudio
# http://openstudio.nrel.gov/openstudio-life-cycle-examples

#see the URL below for access to C++ documentation on model objects (click on "model" in the main window to view model objects)
# http://openstudio.nrel.gov/sites/openstudio.nrel.gov/files/nv_data/cpp_documentation_it/model/html/namespaces.html

# start the measure
class HardSizeHVACEquipment < OpenStudio::Ruleset::ModelUserScript

# define the name that a user will see, this method may be deprecated as
# the display name in PAT comes from the name field in measure.xml
def name
return "HardSizeHVACEquipment"
end

# define the arguments that the user will input
def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new

return args
end #end the arguments method

# define what happens when the measure is run
def run(model, runner, user_arguments)
super(model, runner, user_arguments)

# use the built-in error checking
if not runner.validateUserArguments(arguments(model), user_arguments)
return false
end

# make a copy of the model and set up for sizing run
sizing_model = model

# report the sizing factors being used
siz_params = model.getSimulationControl.sizingParameters
if siz_params.is_initialized
siz_params = siz_params.get
else
siz_params_idf = OpenStudio::IdfObject.new OpenStudio::Model::SizingParameters::iddObjectType
model.addObject siz_params_idf
siz_params = model.getSimulationControl.sizingParameters.get
end
runner.registerInfo("The heating sizing factor for the model is #{siz_params.heatingSizingFactor}. 90.1 Appendix G requires 1.25.")
runner.registerInfo("The cooling sizing factor for the model is #{siz_params.coolingSizingFactor}. 90.1 Appendix G requires 1.15.")

# set the simulation to only run the sizing
sim_control = sizing_model.getSimulationControl
sim_control.setRunSimulationforSizingPeriods(true)
sim_control.setRunSimulationforWeatherFileRunPeriods(false)

# save the model to energyplus idf
idf_directory = Dir.pwd
idf_name = "sizing.idf"
runner.registerInfo("Saving sizing idf to #{idf_directory} as '#{idf_name}'")
forward_translator = OpenStudio::EnergyPlus::ForwardTranslator.new()
workspace = forward_translator.translateModel(sizing_model)
idf_path = OpenStudio::Path.new("#{idf_directory}/#{idf_name}")
workspace.save(idf_path,true)

# set up to run the sizing simulation
require 'openstudio/energyplus/find_energyplus'
epw_path = OpenStudio::Path.new("#{Dir.pwd}/in.epw")
if not File.file?("#{epw_path}")
epw_path = OpenStudio::Path.new("#{Dir.pwd}/../in.epw")
end

# find energyplus
ep_hash = OpenStudio::EnergyPlus::find_energyplus(8,0)
ep_path = OpenStudio::Path.new(ep_hash[:energyplus_exe].to_s)
idd_path = OpenStudio::Path.new(ep_hash[:energyplus_idd].to_s)
weather_path = OpenStudio::Path.new(ep_hash[:energyplus_weatherdata].to_s)

# make a run manager
run_manager_db_path = OpenStudio::Path.new("#{idf_directory}/sizing_run.db")
run_manager = OpenStudio::Runmanager::RunManager.new(run_manager_db_path, true)

# setup tool info to pass run manager the location of energy plus
ep_tool = OpenStudio::Runmanager::ToolInfo.new(ep_path)
ep_tool_info = OpenStudio::Runmanager::Tools.new()
ep_tool_info.append(ep_tool)

# get the run manager configuration options
config_options = run_manager.getConfigOptions()
output_path = OpenStudio::Path.new("#{idf_directory}/")

# make a job for the file we want to run
job = OpenStudio::Runmanager::JobFactory::createEnergyPlusJob(ep_tool,
idd_path,
idf_path,
epw_path,
output_path)

# put the job in the run queue
run_manager.enqueue(job, true)

# run then wait for jobs to complete
while run_manager.workPending()
sleep 1
OpenStudio::Application::instance().processEvents()
end
runner.registerInfo("Finished sizing run.")

# load the sql file, exiting and erroring if a problem is found
sql_path = OpenStudio::Path.new("#{idf_directory}/Energyplus/eplusout.sql")
if OpenStudio::exists(sql_path)
sql = OpenStudio::SqlFile.new(sql_path)
# attach the sql file from the run to the sizing model
attach_sql = model.setSqlFile(sql)
else
runner.registerError("#{sql_path} couldn't be found")
return false
end

# load the helper libraries
@resource_path = "#{File.dirname(__FILE__)}/resources"
require "#{@resource_path}/Model.rb"
require "#{@resource_path}/AirTerminalSingleDuctParallelPIUReheat.rb"
require "#{@resource_path}/AirTerminalSingleDuctVAVReheat.rb"
require "#{@resource_path}/AirTerminalSingleDuctUncontrolled.rb"
require "#{@resource_path}/AirLoopHVAC.rb"
require "#{@resource_path}/FanConstantVolume.rb"
require "#{@resource_path}/FanVariableVolume.rb"
require "#{@resource_path}/CoilHeatingElectric.rb"
require "#{@resource_path}/CoilHeatingGas.rb"
require "#{@resource_path}/CoilHeatingWater.rb"
require "#{@resource_path}/CoilCoolingDXSingleSpeed.rb"
require "#{@resource_path}/CoilCoolingDXTwoSpeed.rb"
require "#{@resource_path}/CoilCoolingWater.rb"
require "#{@resource_path}/ControllerOutdoorAir.rb"
require "#{@resource_path}/PlantLoop.rb"
require "#{@resource_path}/PumpConstantSpeed.rb"
require "#{@resource_path}/PumpVariableSpeed.rb"
require "#{@resource_path}/BoilerHotWater.rb"
require "#{@resource_path}/ChillerElectricEIR.rb"
require "#{@resource_path}/CoolingTowerSingleSpeed.rb"
require "#{@resource_path}/ControllerWaterCoil.rb"

# hard size the HVAC equipment
apply_sizes_success = model.applySizingValues
if apply_sizes_success
runner.registerInfo("Successfully applied component sizing values.")
else
runner.registerInfo("Failed to apply component sizing values.")
end

# set the simulation back to running the weather file
sim_control.setRunSimulationforSizingPeriods(false)
sim_control.setRunSimulationforWeatherFileRunPeriods(true)

return true

end #end the run method

end #end the measure

#this allows the measure to be use by the application
HardSizeHVACEquipment.new.registerWithApplication
Loading

0 comments on commit a4c940a

Please sign in to comment.