|
From: R.T.H.Chin <r.t...@tb...> - 2006-03-27 09:01:34
|
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
|