function v_updated = update_v1(time, v0, e_s_inlet, e_s_outlet, Z_outlet, Z_inlet, v)
alpha_1 = -0.017990;
alpha_2 = 0.022516;
v_split = 44.412;
u1_max = 1;
u2_max = 1;
update_time_limit = 25;

global bias_v1;
global v1_time_before_next_update_is_allowed;
%%%%%%%%%%%%%%%%%%%%
if e_s_outlet ~= 0
    if v < v_split
        if time >= v1_time_before_next_update_is_allowed
        bias_v1 = (Z_inlet-u1_max)/alpha_1 + v_split - v0;
        v1_time_before_next_update_is_allowed = time + update_time_limit;
        end
    end
end
%%%%%%%%%%%%%%%%%%%%
if e_s_inlet ~= 0
    if v > v_split
        if time >= v1_time_before_next_update_is_allowed
        bias_v1 = (Z_outlet-u2_max)/alpha_2 + v_split - v0;
        v1_time_before_next_update_is_allowed = time + update_time_limit;
        end
    end
end
%%%%%%%%%%%%%%%%%%%%
v_updated = v0 + bias_v1;
end