DPsim
ODEintInterface.h
1 /* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2  * EONERC, RWTH Aachen University
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7  *********************************************************************************/
8 
9 #pragma once
10 
11 #include <dpsim-models/Definitions.h>
12 #include <vector>
13 
14 namespace CPS {
16 public:
17  typedef std::shared_ptr<ODEintInterface> Ptr;
18  using stateFnc = std::function<void(const double *, double *, const double)>;
19 
20  // #### ODE Section ####
22  virtual int num_states() const = 0;
24  virtual void odeint(const double y[], double ydot[], double t) = 0;
25 
27  virtual void pre_step() = 0;
29  virtual void post_step() = 0;
31  virtual double *state_vector() = 0;
33  virtual void set_state_vector(std::vector<double> y) = 0;
34 };
35 } // namespace CPS
virtual int num_states() const =0
Returns number of differential variables.
virtual void post_step()=0
Writes the values from the constructed state vector back into the original fields.
virtual double * state_vector()=0
Returns Pointer to state Vector of the componente.
virtual void pre_step()=0
Needed for computations which have to be carried out before the numerical approximation step.
virtual void set_state_vector(std::vector< double > y)=0
Writes the computed solution to the component.
virtual void odeint(const double y[], double ydot[], double t)=0
Sets up ODE system in ydot.