Skip to content

SAM crashes when REopt optimization energy rates include kWh/kW units #2178

@cpaulgilman

Description

@cpaulgilman

Describe the bug

When the maximum usage units on the Electricity Rates page are "kWh/kW" in the energy rates table, running the REopt optimization from the Battery Cell and System page causes SAM to crash.

For examples with kWh/kW units, see Duke Energy Large General Servcice (LGS) rates.

Image

To Reproduce

Steps to reproduce the behavior:

  1. Open example file kwh-kw-max-usage-units.zip
  2. Note kWh/kW units in energy rate table on Electricity Rates page.
  3. On Battery Cell and System page, click Get size and dispatch.
  4. SAM crashes.

Expected behavior

REopt optimization should either run work kWh/kW units, or SAM should display an error message like "REopt optmization does not support kWh/kW maximum usage units for energy rates."

Operating System and Version

SAM 2025.4.16 r1 for Windows.

Additional context

This seems like it should be handled as an error by Line 97 of try_get_rate_structure() in cmod_utilityrate5_eqns.cpp:

Image

But perhaps this REopt error handling issue is preventing the error from being displayed correctly: #2131.

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions