9 #include <dpsim/ODEintSolver.h>
11 using namespace DPsim;
15 : mComponent(comp), mTimestep(dt) {
23 system.push_back([comp](
const double y[],
double ydot[],
const double t) {
24 comp->odeint(y, ydot, t);
35 std::cout <<
"Current Time " << NextTime << std::endl;
38 &ODEintSolver::StateSpaceWrapper,
curSolution, time,
43 times.push_back(time);
50 void ODEintSolver::StateSpaceWrapper(
const std::vector<double> &y,
51 std::vector<double> ydot,
double t) {
56 comp(y.data(), ydot.data(), t);
std::vector< CPS::ODEintInterface::stateFnc > system
ODE of Component.
std::vector< Real > times
Vector containing all timesteps.
ODEintSolver(String name, CPS::ODEintInterface::Ptr comp, Real dt, Real t0)
Create solve object with given parameters.
boost::numeric::odeint::runge_kutta4< std::vector< Real > > stepper
Stepper needed by ODEint.
Real mTimestep
Constant time step.
Real step(Real time)
Solve system for the current time.
std::vector< std::vector< Real > > solution
Vector containing the solution at every timestep.
~ODEintSolver()
Deallocate all memory.
std::vector< Real > curSolution
Current solution vector.
CPS::ODEintInterface::Ptr mComponent
Pointer to current Component.