From: R.T.H.Chin <r.t...@tb...> - 2006-03-27 12:56:40
|
Dear Alexander, I went through the book and the code again. Most of my questions are answered now. This is how it works: There are actually three types of "events" in DSOL: (1) the timestep of the Animator, (2) a discrete time event, (3) the timestep of a differential equation The Animator proceeds to its next timestep, or to a discrete time event within its timestep (whichever comes first). Next the differential equation(s) are integrated until the current time using the timestep of DifferentialEquation (in jstats.ode). A ratio is used in DifferentialEquation.integrateY() to correct the mismatch in the (final) timestep. Next, if a discrete event is scheduled it is executed by the Animator. Finally it starts all over again until the simulation is finished. So that solves the questions 1,2,3, and 5 in my previous mail. One question remains: 4 What is you have two differential equations which should be solved at two different timesteps (e.g. a high frequency motion and a low frequency motion)? Differential equations are solved as soon as they receive a TIME_CHANGED_EVENT. However, by my knowledge you cannot know the order in which different differential equations (instances of DifferentialEquation) are notified and thus integrated/solved. I assume that a similar thing probably happens when discrete time events are scheduled at the same time, but suppose the following: Suppose I have 2 differential equations EQ1 and EQ2. EQ1 is a low frequency motion which is solved every 10 seconds. EQ2 is a high frequency motion which is solved every second. The outcomes of EQ2 are input for EQ1, and may be assumed to be stable during a 10 second interval. Suppose the time interval of Animator is set by the user to 25 seconds. Then it does matter in which order the equations are solved, and the outcome would unpredictable since we don't know what the user will do in advance. Or should we prevent a user from setting the Animator time interval in the DSOLapp? Kind regards, Roy Alexander Verbraeck wrote: >Dear Roy, > >The implementation exactly follows the suggested implementation for the >DEV&DESS formalism as described in B.P. Zeigler, H. Praehofer & T.G. Kim, >Theory of Modeling and Simulation, 2nd Edition, Academic Press, 2000. In >section 9.6 (pp. 222-227), the algorithm is described. With a clear reason >for integrating in-between. Figure 11 on page 221 of Zeigler's book is also >interesting. > >I will post a separate document on the DSOL website on the implementation of >the DEV&DESS simulator later, as this often leads to questions and >confusion. > >There is, by the way, one small mistake in the implementation of the >Animator that extends the DEVDESSSimulator, which relates to the >implementation of the start() and stop() methods. This will be corrected in >the next version of DSOL. > >Kind regards, >Alexander Verbraeck > > > >>-----Original Message----- >>From: dso...@li... [mailto:dsol- >>dev...@li...] On Behalf Of R.T.H.Chin >>Sent: 27 March 2006 11:01 >>To: dso...@li... >>Subject: [Dsol-development] Confused about DESS implementation >> >>Hi DSOL team, >> >>Not that I need it right now, actually I don't even use it and should >>focus on other stuff right now, but studying the DSOL code I'm kind of >>confused about the DESS implementation. >> >>Suppose I use the DSOL application, so then I am actually using the >>Animator as a delayed DEVSDESS simulator. Looking at the code of the >>Animator I see two nested loops in the run() method: >> >>1-the outer loop which just keeps going for as long as the simulation is >>not finished >>2-the inner loop which runs until simulatorTime + timeStep >> >>The loop 2 handles all DEVS-events (event.execute() ). Every time such >>an event is executed a TIME_CHANGED_EVENT is fired. After loop 2 another >>TIME_CHANGED_EVENT is fired. >> >>Suppose my model uses both discrete events and differential equations. >>Alse suppose that for a specific timestep four events were executed, >>then 4+1=5 TIME_CHANGED_EVENTS are fired in loop 2. >> >>The class >>nl.tudelft.simulation.dsol.formalisms.dess.DifferentialEquation is a >>listener and listens to TIME_CHANGED_EVENTs in the notify() method. A >>differential equation is solved every time a TIME_CHANGED_EVENT is >>fired. So in my example that means that the differential equation is >>solved 5 times: >> >>public synchronized void notify(final EventInterface event) { >> ... >> this.previousY = integrateY(this.simulator.getSimulatorTime(), >> this.previousX, this.previousY); >> ... >> this.previousX = this.simulator.getSimulatorTime(); >>} >> >>This is kind of confusing because: >>1 Shouldn't a differential equation only be solved at specified timeSteps? >>2 The constructor of DifferentialEquation allows setting a timeStep, but >>what is the use of that if the equations are solved at >>TIME_CHANGED_EVENTS? >>3 What if you set a timestep of DifferentialEquation in the constructor >>which differs from the timeStep in Animator: are the results still >>correct? >>4 What is you have two differential equations which should be solved at >>two different timesteps (e.g. a high frequency motion and a low >>frequency motion)? >>5 What if you use variable timestep algorithms to optimize the timestep >>/ minimize the error? >> >>Maybe I didn't understand the code, and I didn't make a test, but it >>seems kind of odd. >>Greetings, >>Roy >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by xPML, a groundbreaking scripting >>language >>that extends applications into web and mobile media. Attend the live >>webcast >>and join the prime developer group breaking into this new coding >>territory! >>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 >>_______________________________________________ >>Dsol-development mailing list >>Dso...@li... >>https://lists.sourceforge.net/lists/listinfo/dsol-development >> >> > > > > |