-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model EV Batteries #1533
base: master
Are you sure you want to change the base?
Model EV Batteries #1533
Conversation
…o ev_batteries # Conflicts: # BuildResidentialHPXML/measure.rb # HPXMLtoOpenStudio/resources/battery.rb # HPXMLtoOpenStudio/resources/hpxml_defaults.rb
Yes, for now we plan to limit to 1 EV/unit. However, the current implementation does allow for one home battery and one EV battery and expects separate schedules for each. |
I assume that probably won't work, for the same reason that modeling two home batteries wasn't previously supported. But we can worry about that later. More of a heads up for now. |
# @param vehicle [HPXML::Vehicle] Object that defines a single electric vehicle | ||
# @param schedules_file [SchedulesFile] SchedulesFile wrapper class instance of detailed schedule files | ||
# @return [Array<OpenStudio::Model::ScheduleRuleset or OpenStudio::Model::ScheduleFile>] The charging and discharging schedules, either as a ScheduleRuleset or as a ScheduleFile | ||
def self.get_ev_charging_schedules(runner, model, vehicle, schedules_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method was created so that the discharge schedule could be accessed and the rated power output could be set prior to the Battery.apply call. The process looks like:
- call get_ev_charging_schedules() to get discharge schedule
- parse discharge schedule and sum the annual hours
- calculate effective discharge power based on annual driving hours, efficiency, and annual miles
- estimate the rated power output using the effective discharge * 2.25
- apply battery (which does call get_ev_charging_schedules() once more)
if !(vehicle.hours_per_week_isdefaulted || vehicle.ev_charging_weekday_fractions_isdefaulted || vehicle.ev_charging_weekend_fractions_isdefaulted) | ||
runner.registerWarning("Electric vehicle hours per week inputted (#{vehicle.hours_per_week.round(1)}) do not match the hours per week calculated from the discharging schedule (#{sch_hours_per_week.round(1)}). The inputted hours per week value will be ignored.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible enhancement - write the default schedule based on the user-inputed hours_per_week,
…p EV efficiency argument; update some constants.
arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_miles_per_year', false) | ||
arg.setDisplayName('Electric Vehicle: Miles Traveled') | ||
arg.setDescription('The annual miles traveled by the EV.') | ||
arg.setUnits('miles') | ||
args << arg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used to calculate the effective discharge power in vehicles.rb (power = kwh/mile * annl_miles / driving hours)
arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_hours_per_week', false) | ||
arg.setDisplayName('Electric Vehicle: Hours Driven per Week') | ||
arg.setDescription('The weekly hours traveled by the EV.') | ||
arg.setUnits('hours') | ||
args << arg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not currently used, but will be needed in schedule generation PR
arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('ev_fraction_charged_home', false) | ||
arg.setDisplayName('Electric Vehicle: Fraction Charged at Home') | ||
arg.setDescription('The fraction charging energy provided by the at-home charger.') | ||
args << arg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this argument belongs here. It will be used in ResStockArguments to scale the miles/year, which influences the schedule. I liked that it persists into the HPXML to give context to the miles/year, but the fraction is not used directly in OS-HPXML.
charging_schedule = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:BatteryCharging].name) | ||
discharging_schedule = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:BatteryDischarging].name) | ||
elsif is_ev | ||
charging_schedule, discharging_schedule = Vehicle.get_ev_charging_schedules(runner, model, battery, schedules_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get schedule file or schedule ruleset for EV
# Calculate effective discharge power and rated power output | ||
# Scale the effective discharge power by 2.25 to assign the rated discharge power. This value reflects the maximum power adjustment allowed in the EMS EV discharge program at -17.8 C. | ||
ev_annl_energy = vehicle.energy_efficiency * vehicle.miles_per_year # kWh/year | ||
eff_discharge_power = UnitConversions.convert(ev_annl_energy / annual_driving_hours, 'kw', 'w') # W | ||
vehicle.rated_power_output = eff_discharge_power * 2.25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rated power output is set to avoid ever limiting the actual discharge power at a timestep. This means that some combinations of inputs could result in very high and unrealistic effective discharge powers (eg, high miles, low hours == high annual energy over a short amount of hours). Granted, this would only happen under unrealistic combinations of inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on including this file which shows the calculation of the default vehicle charging/discharging schedules?
Pull Request Description
Allows detailed modeling of EVs using the EnergyPlus battery model, whereas previous EV charging was limited to a simple plug load. This PR adds arguments to define EV battery parameters, EV charger parameters, driving behavior such as miles traveled, and detailed charging and discharging schedules. The E+ battery model was used so that bidirectional charging can be supported in the future, but this capability is not included in this PR.
Key aspects of this PR include:
Electricity: Electric Vehicle Charging (MBtu)
and writes a new "Unmet Hours" output typeDriving (hr)
(if specified)Companion HPXML PR: hpxmlwg/hpxml#403
Schedule generation PR: #1757
Checklist
PR Author: Check these when they're done. Not all may apply.
strikethroughand check any that do not apply.PR Reviewer: Verify each has been completed.
EPvalidator.xml
) has been updatedtasks.rb
)HPXMLtoOpenStudio/tests
and/orworkflow/tests/hpxml_translator_test.rb
)openstudio tasks.rb update_measures
has been run