TemporalHybridSimulation< Model1, Model2, ResultType1, ResultType2 > Class Template Reference
|
CPP API
|
A temporal-hybrid simulation. More...
#include <temporal_hybrid_model.h>
Public Types | |
| using | result1_function = std::function< ResultType1(const Model1 &, ScalarType t)> |
| using | result2_function = std::function< ResultType2(const Model2 &, ScalarType t)> |
| using | switching_condition = std::function< bool(const ResultType1 &state_model1, const ResultType2 &state_model2, bool model1_used)> |
Public Member Functions | |
| void | advance (ScalarType tmax, const switching_condition &switch_model) |
| Advance simulation to tmax. More... | |
| auto & | get_model1 () |
| const auto & | get_model1 () const |
| Returns first model used for the simulation. More... | |
| auto & | get_model2 () |
| const auto & | get_model2 () const |
| Returns second model used for the simulation. More... | |
| ResultType1 | get_result_model1 () const |
| Get the result of model 1. More... | |
| ResultType2 | get_result_model2 () const |
| Get the result of model 2. More... | |
| TemporalHybridSimulation (Model1 &&model1, Model2 &&model2, const result1_function &result1, const result2_function &result2, bool initially_use_model1, ScalarType t0=0, ScalarType dt=0.1) | |
| Create a temporal-hybrid simulation. More... | |
| auto & | using_model1 () |
| const auto & | using_model1 () const |
| Returns whether the first model is currently used for simulation. More... | |
Private Attributes | |
| ScalarType | m_dt |
| Step size with which the switching condition is checked. More... | |
| Model1 | m_model1 |
| First model used for the simulation. More... | |
| Model2 | m_model2 |
| Second model used for the simulation. More... | |
| result1_function | m_result1 |
| Result function of first model. More... | |
| result2_function | m_result2 |
| Result function of second model. More... | |
| ScalarType | m_t |
| Current time step. More... | |
| bool | m_using_model1 |
| Boolean specifying whether model 1 is currently used for simulation. More... | |
Detailed Description
template<class Model1, class Model2, class ResultType1, class ResultType2>
class mio::hybrid::TemporalHybridSimulation< Model1, Model2, ResultType1, ResultType2 >
A temporal-hybrid simulation.
The temporal-hybrid simulation switches between two models during the course of time according to a given condition. This requires a specilization of the convert_model function for the two models used.
- Template Parameters
-
Model1 (Simulation) Type of the first model used. Model2 (Simulation) Type of the second model used. ResultType1 Result type of the first model. The results of both models are needed to evalute the switching condition. ResultType2 Result type of the second model. The results of both models are needed to evalute the switching condition.
Member Typedef Documentation
◆ result1_function
| using mio::hybrid::TemporalHybridSimulation< Model1, Model2, ResultType1, ResultType2 >::result1_function = std::function<ResultType1(const Model1&, ScalarType t)> |
◆ result2_function
| using mio::hybrid::TemporalHybridSimulation< Model1, Model2, ResultType1, ResultType2 >::result2_function = std::function<ResultType2(const Model2&, ScalarType t)> |
◆ switching_condition
| using mio::hybrid::TemporalHybridSimulation< Model1, Model2, ResultType1, ResultType2 >::switching_condition = std::function<bool(const ResultType1& state_model1, const ResultType2& state_model2, bool model1_used)> |
Constructor & Destructor Documentation
◆ TemporalHybridSimulation()
|
inline |
Create a temporal-hybrid simulation.
- Parameters
-
[in] model1 First model/simulation used for the hybrid simulation. [in] model2 Second model/simulation used for the hybrid simulation. [in] result1 Function returning the result/current state of first model. [in] result2 Function returning the result/current state of second model. [in] initially_use_model1 Boolean specifying which model to use at simulation start. [in] t0 Start time of the simulation. [in] dt Timestep with which the switching is checked.
Member Function Documentation
◆ advance()
|
inline |
Advance simulation to tmax.
- Parameters
-
[in] tmax End time point of the simulation [in] switch_model Switching condition that is checked every m_dt step.
◆ get_model1() [1/2]
|
inline |
◆ get_model1() [2/2]
|
inline |
Returns first model used for the simulation.
◆ get_model2() [1/2]
|
inline |
◆ get_model2() [2/2]
|
inline |
Returns second model used for the simulation.
◆ get_result_model1()
|
inline |
Get the result of model 1.
- Returns
- Result of model 1 using the function m_result1.
◆ get_result_model2()
|
inline |
Get the result of model 2.
- Returns
- Result of model 2 using the function m_result1.
◆ using_model1() [1/2]
|
inline |
◆ using_model1() [2/2]
|
inline |
Returns whether the first model is currently used for simulation.
Member Data Documentation
◆ m_dt
|
private |
Step size with which the switching condition is checked.
◆ m_model1
|
private |
First model used for the simulation.
◆ m_model2
|
private |
Second model used for the simulation.
◆ m_result1
|
private |
Result function of first model.
◆ m_result2
|
private |
Result function of second model.
◆ m_t
|
private |
Current time step.
◆ m_using_model1
|
private |
Boolean specifying whether model 1 is currently used for simulation.
Generated by