Hello,
I am attempting to get to grips with dde23 (and the ode solvers for that matter).
System being modeled: An oscillating force is applied to a piston which pressurises a liquid until a valve opens. Within the piston is a bag of gas which has a varying pressure and volume (this bag allows the piston to move even if valves are closed).
The system of equations are as follows:
y1 ' = y2
y2' =(7.3e5 + 2e5*sin(t)-1.9e5./max(0.0733,min(Z(3)-((y(1)-Z(1))*0.12),0.1))^1.4*0.12)/6.7e5
if y3 > 0.1
y3' = 0
elseif y3 < 0.0733
y3' = 0
else 0.0733 < y3 < 0.1
y3' = -((y(1)-Z(1))*0.12)/lag
end
The issue: I feel like provided the time lag is small enough to capture changes in variables and large enough that rounding errors do not affect results, different lags should give the same results. however that is not the case and I cannot decide what lag to use. The following image shows the results for position (top axis) and volume (bottom axis). As you can see the results vary a lot in this small range of lags and also the location of the lines are not predictable.
lag=0.01 % middle line
lag=0.011 % top line
lag=0.012 % middle line
lag=0.013 % bottom line
lag=0.014 % middle line
lag=0.015 % middle line