template<class X> class adevs::rk45

This class can be used to simulate a set of ordinary differential equations with state and time events.

Inheritance:


Public Methods

[more] rk45(int num_state_vars, double h_max, double err_tol, int zero_crossing_funcs, double event_tol = 1E-12)
The constructor requires the number of continuous state variables, the maximum allowed integration time step, maximum truncation error tolerance, and the number of zero crossing functions in this system.
[more]void init(int i, double q0)
Initialize the ith state variable
[more]const double* getStateVars() const
Get read-only access to the state variable array
[more]int getNumStateVars() const
Get the number of items in the state variable array
[more]virtual void der_func(const double* q, double* dq) = 0
Compute the derivative function using the supplied state variable values The derivatives should be stored in dq
[more]virtual void state_event_func(const double* q, double* z) = 0
This function should fill the array z with the value of the zero crossing functions.
[more]virtual double time_event_func(const double* q) = 0
This method is used to schedule time event.
[more]virtual void discrete_action(double* q, const Bag<X>& xb) = 0
This function is called when an event occurs.
[more]virtual void discrete_output(const double* q, Bag<X>& yb) = 0
This output function is evaluated when internal events occur.
[more]virtual void state_changed(const double* q)
This method is called immediately following every time step, and just prior and following every discrete action.
[more]void evolve_func(double h)
[more]double next_event_func(bool& is_event)
[more]void discrete_action_func(const Bag<X>& xb)
[more]void discrete_output_func(Bag<X>& yb)
[more]void state_changed()
[more] ~rk45()
Destructor


Inherited from DESS:

Public Methods

ovoid delta_int()
ovoid delta_ext(double e, const Bag<X>& xb)
ovoid delta_conf(const Bag<X>& xb)
ovoid output_func(Bag<X>& yb)
odouble ta()


Inherited from Atomic:

Public Methods

ovirtual void gc_output(Bag<X>& g)
oAtomic<X> * typeIsAtomic()

Protected Methods

odouble getLastEventTime() const


Inherited from Devs:

Public Methods

ovirtual Network<X> * typeIsNetwork()
oconst Network<X> * getParent() const
oNetwork<X> * getParent()
ovoid setParent(Network<X>* parent)
ovirtual bool model_transition()


Documentation

This class can be used to simulate a set of ordinary differential equations with state and time events. An adaptive fourth/fifth order Runge-Kutta integration scheme is used to advance to solution, and interval halving is used for event detection. Truncation errors are estimated for the fourth order scheme, but the solution is advanced with the fifth order scheme. The inf-norm is used in the error tolerance test.
o rk45(int num_state_vars, double h_max, double err_tol, int zero_crossing_funcs, double event_tol = 1E-12)
The constructor requires the number of continuous state variables, the maximum allowed integration time step, maximum truncation error tolerance, and the number of zero crossing functions in this system. An optional event tolerance sets the absolute time by which events can be missed (default is 1E-12).

ovoid init(int i, double q0)
Initialize the ith state variable

oconst double* getStateVars() const
Get read-only access to the state variable array

oint getNumStateVars() const
Get the number of items in the state variable array

ovirtual void der_func(const double* q, double* dq) = 0
Compute the derivative function using the supplied state variable values The derivatives should be stored in dq

ovirtual void state_event_func(const double* q, double* z) = 0
This function should fill the array z with the value of the zero crossing functions. The z array will have a number of entries equal to the zero_crossing_funcs argument that was passed to the constructor. An event occurs when any of these functions are equal to zero.

ovirtual double time_event_func(const double* q) = 0
This method is used to schedule time event. The returned value is the time remaining until the next time event.

ovirtual void discrete_action(double* q, const Bag<X>& xb) = 0
This function is called when an event occurs. The event can be due to the zero crossing function reaching zero or because of an external input. The continuous and discrete variables can be updated here. The q array contains continuous state when the event occurs, and can be modified if desired.

ovirtual void discrete_output(const double* q, Bag<X>& yb) = 0
This output function is evaluated when internal events occur. Output events should be placed into the bag yb.

ovirtual void state_changed(const double* q)
This method is called immediately following every time step, and just prior and following every discrete action. It is meant to allow output variables to be recorded to file or log every time that the model state changes. You chould not change the simulation state as part of this method! It is non-const just for convenience - please be careful. This method does nothing by default.

ovoid evolve_func(double h)

odouble next_event_func(bool& is_event)

ovoid discrete_action_func(const Bag<X>& xb)

ovoid discrete_output_func(Bag<X>& yb)

ovoid state_changed()

o ~rk45()
Destructor


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.