Error: ur_ec_sched_weekday not assigned

  • Sashadf1
  • Topic Author
More
16 May 2024 10:50 - 16 May 2024 11:10 #13165 by Sashadf1
Error: ur_ec_sched_weekday not assigned was created by Sashadf1
Broader goal: combining EnergyPlus 8760 hourly kWh with a complex tariff scheme using PySAM to efficiently calculate operating costs, avoiding complex post-processing in excel or using E+'s native economics objects, which may not have desired functionality.

I have a TOU utility rate from URDB in JSON format.

I load the rate_data from disk.

with open(ratepath, 'r') as f:
    rate_data = json.load(f)

    rates = PySAM.UtilityRateTools.URDBv8_to_ElectricityRates(rate_data)

    ur = utility_rate.new()
    for key, val in rates.items():
        ur.value(key, val)

However, when I run ur.execute() to calculate the utility bills, I get the following error.Exception: utilityrate5 execution error.
ur_ec_sched_weekday not assigned

ec stands for "Energy Charge"

Inspecting the JSON file, "energyweekdayschedule" is definitely populated.
It is also the appropriate size (12x24) and type (sequence[sequence]) as the ur_ec_sched_weekday key defined in the Utilityrate5 documentation, so I assume this is what get's mapped to the "ur_ec_sched_weekday" when ur.value(key, val) is executed.

 

Maybe its a bug with the URDBv8_to_ElectricityRates method?

I will try hard-coding the energyweekdayschedule, through something like

 

That method is prone to input error though!

Any help greatly appreciated!
Last edit: 16 May 2024 11:10 by pgilman. Reason: Please attach images as files and then insert them into your message

Please Log in or Create an account to join the conversation.

  • pgilman
More
16 May 2024 11:31 #13167 by pgilman
Replied by pgilman on topic Error: ur_ec_sched_weekday not assigned
Hi Sasha,

As far as we know, the URDBv8_to_ElectricityRates() should be working correctly.

Could you attach a copy of the JSON rate data you are working with so we can investigate?

Note that your hardcoded workaround does not account for the fact that the URDB data is indexed to zero while SAM data is indexed to 1, so it will likely cause downstream errors in the Utilitityrate5 module.

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

  • Sashadf1
  • Topic Author
More
16 May 2024 18:03 #13169 by Sashadf1
Replied by Sashadf1 on topic Error: ur_ec_sched_weekday not assigned
I emailed you the JSON files; I can't attach them to the SAM forum because .json is not an allowed filetype.

Please Log in or Create an account to join the conversation.

  • pgilman
More
17 May 2024 11:11 #13171 by pgilman
Replied by pgilman on topic Error: ur_ec_sched_weekday not assigned
Hi Sasha,

Thank you for emailing the file. I changed the forum settings to allow .json attachments (or you can always zip a file if the file type is not allowed).

There is a mistake in your call to the URDBv8_to_ElectricityRates() function. The correct way to call it is:

Code:
rates = PySAM.UtilityRateTools.URDBv8_to_ElectricityRates(rate_data["items"][0])


instead of:

Code:
rates = PySAM.UtilityRateTools.URDBv8_to_ElectricityRates(rate_data)


That's based on this example in the PySAM repository on GitHub: github.com/NREL/pysam/blob/8274fbaa5ac02ed112a515ffc8270db2d7e39482/Examples/UtilityRatesExample.py#L60

Best regards,
Paul.


 

Please Log in or Create an account to join the conversation.

  • Sashadf1
  • Topic Author
More
17 May 2024 13:05 #13172 by Sashadf1
Replied by Sashadf1 on topic Error: ur_ec_sched_weekday not assigned
Thanks Paul.

That syntax worked.

Just to be clear, if I model a building with PV, I should set the gen variable to a csv of PV load draw?



 

Please Log in or Create an account to join the conversation.

  • pgilman
More
20 May 2024 15:53 #13182 by pgilman
Replied by pgilman on topic Error: ur_ec_sched_weekday not assigned
Hi Sasha,

The 'gen' input to the Utilityrate5 module is the AC power output of the PV system in kW for each time step.

The 'load' input is the building's electric power consumption in kW for each time step.

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum