Sam 1783 enforce utility rate tiers#1207
Conversation
sjanzou
left a comment
There was a problem hiding this comment.
Please update the Demand Charge error message value on line 829.
Using the updated test file,
sam_1873_test.zip
I would suggest the following error message changes:
For the Energy Charge error message, I would suggest some additional details:
from
exec fail(lib_utility_rate_equations): Energy tier for month 0 period 2 was expected to be 200 but was 100 in tier 1. Tiers within a month should be the same for TOU rates.
To
exec fail(lib_utility_rate_equations): Energy Tier 1 Max. Usage for January Period 2 was expected to be 200 kWh but was 100 kWh. Tiers should have the same Max. Usage across Periods in the same month for TOU rates.
Similarly, I suggest changing the demand charge error message from:
exec fail(lib_utility_rate_equations): Demand tier for month 0 period 2 was expected to be 100 but was 50 in tier 1. Tiers within a month should be the same for TOU rates.
Request change to
exec fail(lib_utility_rate_equations): Demand Tier 1 Peak for January Period 2 was expected to be 100 kW but was 50 kW. Tiers should have the same Peak across Periods in the same month for TOU rates.
| else if (std::fabs(tier_check[tier - 1] - m_month[m].dc_tou_ub.at(i, j)) > 1e-7) { | ||
| std::ostringstream ss; | ||
| ss << "Demand tier for month " << m << " period " << period << " was expected to be " << tier_check[tier - 1] << " but was "; | ||
| ss << m_month[m].ec_tou_ub.at(i, j) << " in tier " << tier << ". Tiers within a month should be the same for TOU rates."; |
There was a problem hiding this comment.
m_month[m].ec_tou_ub.at(i, j) should be m_month[m].dc_tou_ub.at(i, j)
|
@sjanzou Thanks, that's a much more useful message. Is there a function that looks up month name by month that is accessible to "shared"? I see DateTime::GetMonthName in Toolbox.cpp, but not seeing anything in lib_util or otherwise accessible from this function call. Are there other functions in shared that would benefit from an analogous function there? |
Never mind on this one: I found util::schedule_int_to_month (January vs jan was the search issue) However, I'm not sure there's a function that translates ec_tou_units to a string in ssc. Is it worth adding a function for that for this error message? It's unclear to me if there are other places that would be useful. |
@brtietz - good point... I think it would be useful to have the index mapping from the UI. The general purpose function would be the compute_module::info function that returns the meta data for ur_ec_tou_mat |
|
Good idea on adding a daily function. That's addressed in the latest push. This should be ready for a second review. Thanks! |
sjanzou
left a comment
There was a problem hiding this comment.
Please see the comments when using different input units...
Maybe the error message should be kWh regardless of units entered for the energy change...
| } | ||
|
|
||
| std::ostringstream ss; | ||
| ss << "Energy tier " << tier << " Max. Usage for " << util::schedule_int_to_month(m) << " period " << period << " was expected to be "; |
There was a problem hiding this comment.








Fixes NatLabRockies/SAM#1783. Tiers are now required to be the same within a month across tou periods. This is enforced seperately for demand and energy charges (e.g. the tiers within energy charges have to be consistent, but don't have to be the same as demand charges).
No changes to the the underlying calculations, just a new exception to inform users what the downstream code expects.
Test file:
sam_1873_test.zip
Feel free to suggest other tests - this just demonstrates the cases above.