NREL / SAM

System Advisor Model (SAM)
BSD 3-Clause "New" or "Revised" License
322 stars 137 forks source link

Conditional battery inputs in UI for BTM, FOM, standalone, PV, Generic configurations #798

Closed cpaulgilman closed 2 years ago

cpaulgilman commented 2 years ago

1. Battery Voltage UI

Battery voltage model option batt_voltage_choice and voltage table batt_voltage_matrix does not update when battery type changed. For example:

  1. Open default PV Battery / Single Owner case.
  2. Change voltage model from electrochemical model to voltage table.
  3. Change battery type to a vanadium flow battery.

2. Standalone Battery

Disable "Minimum time at charge state" under Charge Limits and Priority?

Are all dispatch options available for standalone battery? If not, for now, use msgbox() in UI when user chooses an invalid option for now.

3. Generic Battery with Custom Weather File

UI callback error for Generic Battery / Single Owner with Automated dispatch and Look ahead to custom weather file. Should 1) display msgbox() with "Look ahead to custom weather file is only available for system systems with a photovoltaic array." 2) Disable batt_select_weather_file_forecast and batt_user_specified_weather_file Browse button and weather file input field.

Could not evaluate callback function:batt_select_weather_file_forecast->on_change
[27]: eval error in statement list
[27]: error inside function call
[30]: eval error in statement list

4. Generic Battery with PV Smoothing

For generic battery, msgbox() when PV smoothing selected, or allow when generation profile option enables with 15-minute or less time step data.

5. FOM Automated Dispatch with Specify IRR

SSC should throw an error for this option. Until we make that change, show message on both Battery Dispatch and Revenue (or Financial Parameters for partnership flip and sale leaseback) when user chooses automated dispatch option while in Specify IRR mode (or chooses Specify IRR while in Automatic dispatch mode). Consider using yesno() instead of msgbox() to prompt user to automatically change mode from Specify IRR to Specify PPA price.

mjprilliman commented 2 years ago

@cpaulgilman @janinefreeman @dguittet What is supposed to happen on the item 1? It seems as though the LMOLTO and LeadAcid json default files have voltage matrices defined and so they set the voltage option to 1 and set the correct matrix. LFPGraphite and NMC Graphite do not have voltage_matrix defined and thus set voltage_option to 0 and write the correct input values for the electrochemical? The vanadium flow battery in your example has defaults defined in the callbacks for the electrochemical model and sets voltage_option to 0. Unless I am missing something I believe these values are updating as intended

mjprilliman commented 2 years ago

'Disable "Minimum time at charge state" under Charge Limits and Priority?'

I'm not clear on why this is necessary for standalone batteries

cpaulgilman commented 2 years ago

'Disable "Minimum time at charge state" under Charge Limits and Priority?'

I'm not clear on why this is necessary for standalone batteries

The documentation suggests that this option is to prevent the battery from rapid charge/discharge cycles in response to the PV array. If it also works for standalone batteries, perhaps in response to rapidly varying power prices, then it should not be disabled. In the SSC code, I see where batt_minimum_modetime is defined, but I don't see it used in any calculations.

cpaulgilman commented 2 years ago

We should confirm the desired default voltage inputs for each battery type with @dguittet. In some cases, defaults are loaded from JSON and others are set by callbacks.

dguittet commented 2 years ago

For the LeadAcid, NMC/Gr, LFP/Gr and LMO/LTO chemistries where the JSON files exist, the defaults are loaded from the JSON. LeadAcid & LMO/LTO use the voltage table, as does the Iron Flow, and in these cases, the voltage table defaults do get loaded up when you switch chemistry.

I checked the other chemistries' voltage defaults and the only one which can behave in a way that looks wrong is the Vanadium Flow one. That one uses a separate electrochemical model, but uses the same toggle, and doesn't use batt_Vcut and you can have strange plots when Vcut > Vnom: image

I set batt_Vcut value to 0 in sam commit 90ba29c0be870886c3259c061e3b77890e17201c for the flow batteries and for the voltage table cases since those models don't use the value, to prevent that odd effect in plotting.

brtietz commented 2 years ago

batt_minimum_modetime is used in the constraints section of the dispatch code. This is one of the base constraints in lib_battery_dispatch.cpp, used by all algorithms. I agree with Paul's comment about the standalone battery responding to price signals,.

cpaulgilman commented 2 years ago

batt_minimum_modetime is used in the constraints section of the dispatch code. This is one of the base constraints in lib_battery_dispatch.cpp, used by all algorithms. I agree with Paul's comment about the standalone battery responding to price signals,.

Thanks, Brian. I take back my suggestion to disable the input for Standalone batteries and will revise the documentation.