9 #include "../continuous_time/ControlledSystem.h" 16 #define SYMPLECTIC_ENABLED \ 17 template <size_t V, size_t P, size_t ST> \ 18 typename std::enable_if<(V > 0 && P > 0 && (V + P == ST)), void>::type 19 #define SYMPLECTIC_DISABLED \ 20 template <size_t V, size_t P, size_t ST> \ 21 typename std::enable_if<(V <= 0 || P <= 0 || (V + P != ST)), void>::type 39 template <
size_t STATE_DIM,
41 size_t P_DIM = STATE_DIM / 2,
42 size_t V_DIM = STATE_DIM / 2,
53 std::shared_ptr<ct::core::IntegratorSymplecticEuler<P_DIM, V_DIM, CONTROL_DIM, SCALAR>>;
55 std::shared_ptr<ct::core::IntegratorSymplecticRk<P_DIM, V_DIM, CONTROL_DIM, SCALAR>>;
60 using SubstepRecorderPtr = std::shared_ptr<ct::core::SubstepRecorder<STATE_DIM, CONTROL_DIM, SCALAR>>;
78 const int& K_sim = 1);
91 const int& K_sim = 1);
145 const double& dt_sim)
const;
151 const double& dt_sim)
const;
191 #undef SYMPLECTIC_ENABLED 192 #undef SYMPLECTIC_DISABLED SCALAR dt_
the time discretization interval
Definition: SystemDiscretizer.h:157
#define SYMPLECTIC_DISABLED
Definition: SystemDiscretizer.h:19
virtual ~SystemDiscretizer()
destructor
Definition: SystemDiscretizer-impl.h:53
An discrete array (vector) of a particular data type.
Definition: DiscreteArray.h:22
SCALAR getSimulationTimestep()
compute the simulation timestep
Definition: SystemDiscretizer-impl.h:73
SYMPLECTIC_ENABLED integrateSymplectic(ct::core::StateVector< STATE_DIM, SCALAR > &x0, const double &t, const size_t &steps, const double &dt_sim) const
integrateSymplectic, gets instantiated if the system is symplectic
Definition: SystemDiscretizer-impl.h:181
DiscreteControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > Base
Definition: SystemDiscretizer.h:48
std::shared_ptr< ct::core::IntegratorSymplecticRk< P_DIM, V_DIM, CONTROL_DIM, SCALAR > > IntegratorSymplecticRkPtr
Definition: SystemDiscretizer.h:55
void setIntegrationType(const ct::core::IntegrationType &integratorType)
update integration type
Definition: SystemDiscretizer-impl.h:80
IntegratorSymplecticRkPtr integratorRkSymplectic_
an integrator for forward integrating a symplectic continuous-time system with symplectic RK methods ...
Definition: SystemDiscretizer.h:181
ct::core::IntegrationType integratorType_
the integration type for forward integration
Definition: SystemDiscretizer.h:166
IntegratorPtr integrator_
an integrator for forward integrating a general continuous-time system with standard RK methods ...
Definition: SystemDiscretizer.h:175
ContinuousSystemPtr cont_time_system_
the continuous-time system to be discretized
Definition: SystemDiscretizer.h:169
SCALAR dt_sim_
the integration sub-step size, which is a function of dt_ and K_sim_
Definition: SystemDiscretizer.h:163
std::shared_ptr< ConstantController< STATE_DIM, CONTROL_DIM, SCALAR > > ContinuousConstantControllerPtr
Definition: SystemDiscretizer.h:58
virtual void propagateControlledDynamics(const StateVector< STATE_DIM, SCALAR > &state, const time_t n, const ControlVector< CONTROL_DIM, SCALAR > &control, StateVector< STATE_DIM, SCALAR > &stateNext) override
propagate discrete-time dynamics by performing a numerical forward integration of the continuous-time...
Definition: SystemDiscretizer-impl.h:121
Discretize a general, continuous-time non-linear dynamic system using forward integration.
Definition: SystemDiscretizer.h:44
void initialize()
initialize class
Definition: SystemDiscretizer-impl.h:96
std::shared_ptr< ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > > ContinuousSystemPtr
Definition: SystemDiscretizer.h:57
Base::time_t time_t
Definition: SystemDiscretizer.h:49
#define SYMPLECTIC_ENABLED
Definition: SystemDiscretizer.h:16
Definition: ControlVector.h:12
SubstepRecorderPtr substepRecorder_
substep recorder which logs all the substeps required for later computing exact sensitivities ...
Definition: SystemDiscretizer.h:184
void setParameters(const SCALAR &dt, const int &K_sim=1)
update parameters
Definition: SystemDiscretizer-impl.h:87
A general, non-linear discrete dynamic system with a control input.
Definition: DiscreteControlledSystem.h:40
CppAD::AD< CppAD::cg::CG< double > > SCALAR
virtual SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR > * clone() const override
deep cloning
Definition: SystemDiscretizer-impl.h:66
void changeContinuousTimeSystem(ContinuousSystemPtr newSystem)
update the SystemDiscretizer with a new nonlinear, continuous-time system
Definition: SystemDiscretizer-impl.h:111
std::shared_ptr< Integrator< STATE_DIM, SCALAR > > IntegratorPtr
Definition: SystemDiscretizer.h:51
constexpr size_t n
Definition: MatrixInversionTest.cpp:14
Definition: StateVector.h:12
int K_sim_
the forward simulation can be discretized finer than dt_. K_sim_ is an integer number representing th...
Definition: SystemDiscretizer.h:160
SystemDiscretizer()
default constructor
Definition: SystemDiscretizer-impl.h:19
Definition: Integrator.h:33
ContinuousConstantControllerPtr cont_constant_controller_
the continuous-time constant controller to be applied to the continuous-time dynamics ...
Definition: SystemDiscretizer.h:172
std::shared_ptr< ct::core::IntegratorSymplecticEuler< P_DIM, V_DIM, CONTROL_DIM, SCALAR > > IntegratorSymplecticEulerPtr
Definition: SystemDiscretizer.h:53
std::shared_ptr< ControlVectorArray > ControlVectorArrayPtr
Definition: SystemDiscretizer.h:65
IntegratorSymplecticEulerPtr integratorEulerSymplectic_
an integrator for forward integrating a symplectic continuous-time system with symplectic Euler ...
Definition: SystemDiscretizer.h:178
std::shared_ptr< ct::core::SubstepRecorder< STATE_DIM, CONTROL_DIM, SCALAR > > SubstepRecorderPtr
Definition: SystemDiscretizer.h:60
std::shared_ptr< StateVectorArray > StateVectorArrayPtr
Definition: SystemDiscretizer.h:63
SYMPLECTIC_ENABLED initializeSymplecticIntegrator()
initialize the symplectic integrator, if the system is symplectic
Definition: SystemDiscretizer-impl.h:153
const StateVectorArrayPtr & getSubstates() const
return a pointer to the substates recorded during integration
Definition: SystemDiscretizer-impl.h:216
int time_t
the type of the time variable
Definition: DiscreteSystem.h:15
const ControlVectorArrayPtr & getSubcontrols() const
reuturn a pointer to the subcontrols recorded during integration
Definition: SystemDiscretizer-impl.h:223
IntegrationType
The available integration types.
Definition: Integrator.h:30