In the battSolarOptimize.m function, the battery power (PbattV) is only constrained by maximum and minimum power:
PbattV = optimvar('PbattV',N,'LowerBound',batteryMinMax.Pmin,'UpperBound',batteryMinMax.Pmax);
However, there are no ramp-rate constraints, meaning the battery can change its output instantly from −400 kW to +400 kW (based on energyOptimizationScript.m settings). This behavior is physically unrealistic, as real batteries have maximum charge/discharge rates per second or per timestep. Without ramp-rate limits, the optimized battery dispatch may include abrupt jumps that cannot be implemented in practice.
Suggested Fix
Add ramp-rate constraints to the optimization problem:
prob.Constraints.rampRate = optimconstr(N-1);
prob.Constraints.rampRate(1:N-1) = abs(PbattV(2:N) - PbattV(1:N-1)) <= MaxRamp;
In the battSolarOptimize.m function, the battery power (PbattV) is only constrained by maximum and minimum power:
However, there are no ramp-rate constraints, meaning the battery can change its output instantly from −400 kW to +400 kW (based on energyOptimizationScript.m settings). This behavior is physically unrealistic, as real batteries have maximum charge/discharge rates per second or per timestep. Without ramp-rate limits, the optimized battery dispatch may include abrupt jumps that cannot be implemented in practice.
Suggested Fix
Add ramp-rate constraints to the optimization problem: