- 3.0.2 core module.
System.h
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
8 #include <ct/core/types/Time.h>
10 
11 namespace ct {
12 namespace core {
13 
16 {
17  GENERAL = 0,
19 };
20 
22 
37 template <size_t STATE_DIM, typename SCALAR = double>
38 class System
39 {
40 public:
41  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
42 
43  typedef SCALAR S;
44  typedef SCALAR time_t;
45 
47 
53  System(const SYSTEM_TYPE& type = SYSTEM_TYPE::GENERAL) : type_(type) {}
55  System(const System& other) : type_(other.type_) {}
57  virtual ~System() {}
59  virtual System* clone() const { throw std::runtime_error("clone not implemented"); };
61 
67  virtual void computeDynamics(const StateVector<STATE_DIM, SCALAR>& state,
68  const time_t& t,
69  StateVector<STATE_DIM, SCALAR>& derivative) = 0;
70 
72 
75  SYSTEM_TYPE getType() const { return type_; }
81  virtual bool isSymplectic() const { return false; }
82 protected:
84 };
85 
86 } // core
87 } // ct
SCALAR time_t
the type of the time variable
Definition: System.h:44
System(const System &other)
copy constructor
Definition: System.h:55
virtual void computeDynamics(const StateVector< STATE_DIM, SCALAR > &state, const time_t &t, StateVector< STATE_DIM, SCALAR > &derivative)=0
computes the system dynamics
clear all close all load ct GNMSLog0 mat reformat t
a pure second-order system
Definition: System.h:18
SYSTEM_TYPE getType() const
get the type of system
Definition: System.h:75
CppAD::AD< CppAD::cg::CG< double > > SCALAR
SYSTEM_TYPE type_
type of system
Definition: System.h:83
System(const SYSTEM_TYPE &type=SYSTEM_TYPE::GENERAL)
default constructor
Definition: System.h:53
Definition: StateVector.h:12
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef SCALAR S
the scalar type
Definition: System.h:43
SYSTEM_TYPE
type of system
Definition: System.h:15
any non-specific system
Definition: System.h:17
Interface class for a general system described by an ordinary differential equation (ODE) ...
Definition: System.h:38
virtual System * clone() const
deep copy
Definition: System.h:59
virtual ~System()
destructor
Definition: System.h:57
virtual bool isSymplectic() const
Determines if the system is in symplectic form.
Definition: System.h:81