DPsim
Loading...
Searching...
No Matches
ODEInterface.h
Go to the documentation of this file.
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
13#include <vector>
14
15namespace CPS {
17public:
18 using Ptr = std::shared_ptr<ODEInterface>;
19 //typedef std::vector<Ptr> List;
20
22
25
27 using StSpFn = std::function<void(double, const double *, double *)>;
28
29 using JacFn = std::function<void(double, const double *, double *, double *,
30 double *, double *, double *)>;
31
32 // #### ODE Section ####
34 virtual void odeStateSpace(double t, const double y[], double ydot[]) = 0;
35
37 virtual void odeJacobian(double t, const double y[], double fy[], double J[],
38 double tmp1[], double tmp2[], double tmp3[]) = 0;
39
40protected:
42 : mAttributeList(attrList),
43 mOdePreState(attrList->create<Matrix>("ode_pre_state")),
44 mOdePostState(attrList->create<Matrix>("ode_post_state")) {}
45};
46} // namespace CPS
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
std::shared_ptr< AttributeList > Ptr
const CPS::Attribute< Matrix >::Ptr mOdePostState
ODEInterface(AttributeList::Ptr attrList)
virtual void odeStateSpace(double t, const double y[], double ydot[])=0
State Space Equation System for ODE Solver.
const CPS::Attribute< Matrix >::Ptr mOdePreState
std::function< void(double, const double *, double *)> StSpFn
Use this to pass the individual components StateSpace implementation to the ODESolver class.
std::function< void(double, const double *, double *, double *, double *, double *, double *)> JacFn
const CPS::AttributeList::Ptr mAttributeList
std::shared_ptr< ODEInterface > Ptr
virtual void odeJacobian(double t, const double y[], double fy[], double J[], double tmp1[], double tmp2[], double tmp3[])=0
Jacobian Matrix (of State Space System) needed for implicit solve.
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:81