Skip to content

Conversation

@joseph-robertson
Copy link
Collaborator

@joseph-robertson joseph-robertson commented Jan 8, 2026

Pull Request Description

Create a critical load custom meter (Electricity:Facility plus PV) to use for resilience calculations. This replaces requesting/using multiple meters (Electricity:Facility, ElectricityProduced:Facility, ElectricStorage:ElectricityProduced) for resilience calculations.

Checklist

Not all may apply:

  • Schematron validator (EPvalidator.sch) has been updated
  • Sample files have been added/updated (openstudio tasks.rb update_hpxmls)
  • Tests have been added/updated (e.g., HPXMLtoOpenStudio/tests/test*.rb and/or workflow/tests/test*.rb)
  • Documentation has been updated
  • Changelog has been updated
  • openstudio tasks.rb update_measures has been run
  • No unexpected changes to simulation results of sample files

@joseph-robertson joseph-robertson self-assigned this Jan 8, 2026
@joseph-robertson joseph-robertson added the enhancement New feature or request label Jan 8, 2026
@joseph-robertson joseph-robertson marked this pull request as ready for review January 8, 2026 18:28
Comment on lines 1518 to 1523
# Create PV/CritLoad meters
if pv_key_vars.empty? && gen_key_vars.empty?
# Avoid OpenStudio warnings if nothing to decrement
Model.add_meter_custom(
model,
name: MeterCustomElectricityPV,
name: MeterCustomElectricityCriticalLoad,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the critical load meter is similar to the total/net meters, in that it's the facility meter minus some other things. So maybe I am not immediately seeing the nuance here, but can't you revert all of this new logic and simply change

    { MeterCustomElectricityTotal => total_key_vars,
      MeterCustomElectricityNet => net_key_vars }.each do |meter_name, key_vars|

to

    { MeterCustomElectricityTotal => total_key_vars,
      MeterCustomElectricityNet => net_key_vars,
      MeterCustomElectricityCriticalLoad => pv_key_vars + gen_key_vars }.each do |meter_name, key_vars|

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Comment on lines 1087 to 1088
crit_load = get_report_meter_data_timeseries([Outputs::MeterCustomElectricityCriticalLoad.upcase], UnitConversions.convert(1.0, 'J', 'kWh'), 0, resilience_frequency)
crit_load = crit_load.zip(batt_loss).map { |x, y| x + y }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice to see all the meters removed. But I can't help to wonder if the battery losses should be incorporated in the critical load meter, rather than doing timeseries addition here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, aren't battery losses already on Electricity:Facility? Maybe we're already adding battery losses twice, and there is a bug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which I think would mean 0ae7bdb should be reverted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the conclusion I came to. See 35585cc.

@joseph-robertson joseph-robertson changed the base branch from master to battery-unit-mults-fix January 13, 2026 19:53
@shorowit shorowit moved this from Triage to In progress in OpenStudio-HPXML Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants