def constraint_sustain_total_charged_energy_up(model):
    """
    Constraints the relative change of the total charged energy to the 
    baseline total charged energy to be at most 
    1 + model.tolerance_total_charged_energy_up.
    """
    
    base_total_charged_energy = 0
    res_total_charged_energy  = 0
    for i in model.t:
        base_total_charged_energy += model.base_charg_load[i]
        # res_total_charged_energy  += model.base_charg_load[i] * (1 - model.alpha*(model.opt_elec_rate[i]-model.base_elec_rate[i])/model.base_elec_rate[i])
        res_total_charged_energy  += model.base_charg_load[i] * (1 - model.alpha[i]*(model.opt_elec_rate[i]-model.base_elec_rate[i])/model.base_elec_rate[i])
    
    frac = res_total_charged_energy/base_total_charged_energy
    
    return frac <= 1+model.tolerance_total_charged_energy_up