Template Class KModel#
Defined in File KModel.h
Inheritance Relationships#
Base Type#
public Karana::Models::BaseKModel(Class BaseKModel)
Class Documentation#
-
template<class T, class P = NoParams, class Sc = NoScratch, class S = NoDiscreteStates, class C = NoContinuousStates>
class KModel : public Karana::Models::BaseKModel# KModel<T,P,Sc,S,C> uses the curiously recurring template pattern (CRTP) to determine what methods the derived class has, and make the appropriate calls. All C++ models should derive from this. Python models will have a different class to derive from. See the KModel component models section for more discussion about the KModel class.
Public Functions
-
inline virtual bool isFinalized() const override#
Checks whether the model is finalized.
- Returns:
bool - Returns false if the params pointer is emtpy or if the parameters are not finalize. Returns true otherwise.
-
inline virtual std::optional<km::Ktime> getNextModelStepTime(const km::Ktime &t) final#
Get the model’s next time step after t.
- Parameters:
t – The t to use when calculating the next time step.
- Returns:
The model’s next time step.
-
inline virtual km::Ktime getPeriod() final override#
Get the model’s period.
- Returns:
The model’s period.
-
inline virtual void setPeriod(const km::Ktime &t) override#
Set the model’s period.
- Parameters:
t – - The value to set the model’s period to.
-
BaseKModel(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp)#
KModel constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.
- Parameters:
name – - The name of the model
sp – - The StatePropgator associated with the model.
Public Members
Protected Functions
-
inline virtual void _registerModel() override#
Register this model instance with the state propagator. See the.
Registering and unregistering models for details.
-
inline virtual void _unregisterModel() override#
Unregister this model instance from the state propagator. See the.
Registering and unregistering models for details.
-
inline virtual const Eigen::Ref<const km::Vec> _getContinuousStates() const override#
-
inline virtual const Eigen::Ref<const km::Vec> _getContinuousStatesDeriv() override#
Get the derivative of the continuous states. Overriden by KModel if appropriate.
- Returns:
The model’s continuous states’ derivatives.
-
inline virtual void _setContinuousStates(const Eigen::Ref<const km::Vec> x) override#
Set the continous model states.
- Parameters:
x – The new continuous model states.
-
inline std::string dumpString(std::string_view prefix = "", const Base::DumpOptions* = nullptr) const override#
-
inline virtual bool isFinalized() const override#