about your model I think that the best way to realize it is to have the three models coded in three different classes, and then have a wrapper in which you have all the variables of our model, and then implement in the wrapper a when - elsewhen - elsewhen statement that will restart the state variables of the models that is been activated, and finally a if - elseif - else statement to link the wrapper variables to the corresponding one of the active block. This way you can also change causality of the variables in your models without causing errors. As an example I post the case of a broken pendulum model:
model BreakingPendulum2
extends BasePendulum(p(m=1, g=9.81, L=0.5));
input Boolean Broken;
protected
Pendulum pend (p=p, u=u, enable=not Broken);
BrokenPendulum bpend(p=p, u=u, enable=Broken);
equation
when Broken then
reinit(bpend.pos, pend.pos);
reinit(bpend.vel, pend.vel);
end when;
pos = if not Broken then pend.pos else bpend.pos;
vel = if not Broken then pend.vel else bpend.vel;
end BreakingPendulum2;
The class BasePendulum implements the variables that you need to compute about the system is been simulated. Extending from that cass you implement your three different versions of the models valid in different cases. Then you write a block like the one I posted and implement the logic based on the validity of the different models.