Skip to content

Commit 1817f80

Browse files
committed
Version upgrade fixes
Use `oldvalue()` to load simple battery inputs because those inputs are not in new detailed config. Add message to variables that are copied from old simple battery inputs. Set battery size units to AC to be consistent with simple battery. Replace `batt_bank_duration` with `batt_bank_size_ui` (note confusing widget `batt_bank_duration` was hidden under `batt_bank_size_UI`in UI) Revise message text.
1 parent 11f61e5 commit 1817f80

File tree

1 file changed

+42
-36
lines changed

1 file changed

+42
-36
lines changed

deploy/runtime/versions.lk

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -60,54 +60,60 @@ version_upgrade{'2025.9.19'} = define() {
6060
const cfg = config();
6161

6262
if(cfg.tech == 'PVWatts' || cfg.tech == 'PVWatts Battery') {
63-
message('We converted PVWatts to run in the GUI in lifetime mode by default.', 'warning');
64-
old_degradation = value('degradation');
65-
66-
value('dc_degradation', old_degradation, 'Update degradation from AC to DC degradation');
63+
message('PVWatts now runs in lifetime mode so that time series outputs are over the analysis period instead of one year.');
64+
message('PVWatts degradation is now modeled as DC degradation instead of AC degradation. DC degradation is an annual reduction in the DC output of the array instead of AC output of the system.', 'warning');
65+
old_degradation = oldvalue('degradation');
66+
67+
value('dc_degradation', old_degradation, 'New DC degradation on DC Degradation page set to old AC degradation value from AC Degradation page.');
6768
}
6869
if (cfg.tech == 'PVWatts Battery') {
69-
message('Converting simple battery to detailed battery for configurations paired with PVWatts.', 'warning');
70-
old_kw = value('batt_simple_kw');
71-
old_kwh = value('batt_simple_kwh');
72-
old_dispatch = value('batt_simple_dispatch');
73-
old_chem = value('batt_simple_chemistry'); // batt_type
74-
75-
value('batt_bank_power', old_kw);
76-
value('batt_duration_choice', 0);
77-
value('batt_bank_duration', old_kwh);
78-
79-
message("DEBUG: " + old_dispatch + " chem: " + old_chem, 'warning');
80-
81-
// From cmod_battwatts lines 254 - 259
82-
value('batt_dispatch_auto_can_charge', true);
83-
value('batt_dispatch_auto_can_gridcharge', true);
84-
value('batt_dispatch_auto_btm_can_discharge_to_grid', true);
85-
value('batt_dispatch_auto_can_clipcharge', false);
86-
value('batt_dispatch_charge_only_system_exceeds_load', false);
87-
value('batt_dispatch_discharge_only_load_exceeds_system', false);
88-
70+
message('PVWatts Battery configurations now use the detailed battery inputs to allow for modeling a full range of battery applications instead of only behind-the-meter applications with limited dispatch options.', 'warning');
71+
old_kw = oldvalue('batt_simple_kw');
72+
old_kwh = oldvalue('batt_simple_kwh');
73+
old_dispatch = oldvalue('batt_simple_dispatch');
74+
old_chem = oldvalue('batt_simple_chemistry'); // batt_type
75+
76+
message("DEBUG old_dispatch: " + old_dispatch + " chem: " + old_chem, 'error'); // TO DO delete
77+
message("DEBUG old_kwh: " + old_kwh + " old_kw: " + old_kw, 'error'); // TO DO delete
8978

79+
// inputs from simple battery inputs on old PVWatts-Battery System Design page with explanation of where to find inputs
80+
value('batt_bank_power', old_kw, 'Desired bank power (kWac) on Battery Cell and System page set to old battery power (kWac).');
81+
value('batt_bank_size_ui', old_kwh, 'Desired bank capacity (kWhac) on Battery Cell and System page capacity set to old battery capacity kWhac).');
82+
if (old_chem == 0) {
83+
// Lead Acid
84+
value('batt_type', 0, 'New battery type on Battery Cell and System page set to Lead Acid: Flooded from old battery chemistry Lead Acid.');
85+
}
86+
else {
87+
// Li-ion NMC
88+
value('batt_type', 8, 'New battery type on Battery Cell and System page set to Lithium-ion: NMC/Graphite from old battery chemistry Lithium Ion.' );
89+
}
9090
if (old_dispatch == 0 || old_dispatch == 1) {
91-
value('batt_dispatch_choice_ui', 0);
91+
value('batt_dispatch_choice_ui', 0, 'Dispatch option on Battery Dispatch page set to Peak Shaving from old Peak Shaving (look ahead) or Peak shaving (look behind) option.');
9292
value('batt_dispatch_choice', 0);
93-
value('peak_shaving_batt_dispatch_choice', old_dispatch);
93+
msg_pk_shaving = 'Peak shaving dispatch option on Battery Dispatch page set to Perfect Look Ahead.';
94+
if ( old_dispatch == 1 ) {
95+
msg_pk_shaving = 'Peak shaving dispatch option on Battery Dispatch page set to One Day Look Behind.';
96+
}
97+
value('peak_shaving_batt_dispatch_choice', old_dispatch, msg_pk_shaving);
9498
value('batt_dispatch_load_forecast_choice_peak_shaving', old_dispatch);
9599
}
96100
else {
97101
// Should only be 2 (custom dispatch)
98-
value('batt_dispatch_choice_ui', old_dispatch);
102+
value('batt_dispatch_choice_ui', old_dispatch, 'Dispatch option on Battery Dispatch page set to Input Battery Power Targets from old Custom Dispatch option.');
99103
value('batt_dispatch_choice', old_dispatch);
100-
101104
}
102-
if (old_chem == 0) {
103-
// Lead Acid
104-
value('batt_type', 0);
105+
106+
value('batt_duration_choice', 0); // sizing choice to kWh (not hours of storage)
107+
value('batt_bank_size_dc_ac', 1); // set sizing units to AC to be consistent with simple battery
108+
109+
// From cmod_battwatts lines 254 - 259
110+
value('batt_dispatch_auto_can_charge', true);
111+
value('batt_dispatch_auto_can_gridcharge', true);
112+
value('batt_dispatch_auto_btm_can_discharge_to_grid', true);
113+
value('batt_dispatch_auto_can_clipcharge', false);
114+
value('batt_dispatch_charge_only_system_exceeds_load', false);
115+
value('batt_dispatch_discharge_only_load_exceeds_system', false);
105116

106-
}
107-
else {
108-
// Li-ion NMC
109-
value('batt_type', 8);
110-
}
111117
}
112118
};
113119

0 commit comments

Comments
 (0)