Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
How to store final time of simulation in a variable ?
Posted 2023年12月9日 GMT-5 05:46 Studies & Solvers Version 6.1 3 Replies
Please login with a confirmed email address before reporting spam
I'm chaining two time-dependent simulations, the first one finishing on a stop condition and yielding the solution, say 'sol 1'.
I know how to create and start a new simulation starting from the final state of the latter.
What I don't manage to do is to record the value of the last time of simulation 1 and use it as the starting time of simulation 2. I've tried do define a variable tlast1 with the expression :
withsol( 'sol1', t, setind(t, 'last') )
It yields the correct value of final time, but repeated at each output time of 'sol1'. Thus, no surprise that when I try to use this quantity as the starting time of the second simulation, I get the error :
Unknown model parameter. - Parameter: tlast1 - Property: tlist (Output times) - Time dependent: Time Dependent
because tlast1 is not a scalar (by the way, why ?)
I've been deeply through the documentation and can't manage to find a way to do that. If anyone can help, thank you very much by advance.