/** * Initialize the integrator. Check for the existence of a director and an ODE solver. Set the * state to the value given by <i>initialState</i>. * * @exception IllegalActionException If there is no director, or the director has no ODE solver, * or the initialState parameter does not contain a valid token, or the superclass throws it. */ public void initialize() throws IllegalActionException { ContinuousDirector dir = (ContinuousDirector) getDirector(); if (dir == null) { throw new IllegalActionException(this, " no director available"); } ContinuousODESolver solver = dir._getODESolver(); if (solver == null) { throw new IllegalActionException(this, " no ODE solver available"); } super.initialize(); _lastRound = -1; _tentativeState = ((DoubleToken) initialState.getToken()).doubleValue(); _state = _tentativeState; if (_debugging) { _debug("Initialize: initial state = " + _tentativeState); } // The number of auxiliary variables that are used depends on // the solver. int n = solver.getIntegratorAuxVariableCount(); if ((_auxVariables == null) || (_auxVariables.length != n)) { _auxVariables = new double[n]; } }
/** * Return the suggested next step size. This method delegates to the integratorPredictedStepSize() * method of the current ODESolver. * * @return The suggested next step size. */ public double suggestedStepSize() { ContinuousODESolver solver = ((ContinuousDirector) getDirector())._getODESolver(); return solver.integratorSuggestedStepSize(this); }
/** * Return true if the state is resolved successfully. If the input is not available, or the input * is a result of divide by zero, a NumericalNonconvergeException is thrown. * * @return True if the state is resolved successfully. */ public boolean isStepSizeAccurate() { ContinuousODESolver solver = ((ContinuousDirector) getDirector())._getODESolver(); _successful = solver.integratorIsAccurate(this); return _successful; }