Class SpringDamper#
Defined in File SpringDamper.h
Inheritance Relationships#
Base Type#
public Karana::Models::KModel< SpringDamper, SpringDamperParams, SpringDamperScratch >(Template Class KModel)
Class Documentation#
-
class SpringDamper : public Karana::Models::KModel<SpringDamper, SpringDamperParams, SpringDamperScratch>#
Adds a spring-damper between two nodes.
Public Functions
-
SpringDamper(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp, const kc::ks_ptr<kd::Node> nd1, const kc::ks_ptr<kd::Node> nd2)#
SpringDamper constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance. The SpringDamper model applies an equal and opposing force to two nodes based on their current distance apart.
- Parameters:
name – The name of the model.
sp – The StatePropagator to register this model with.
nd1 – The first node in the spring damper model.
nd2 – The second node in the spring damper model.
-
~SpringDamper()#
Destructor for SpringDamper.
-
void preDeriv(const km::Ktime &t, const km::Vec &x)#
Calculate and apply the spring/damper force.
- Parameters:
t – Current time. Not used.
x – Current state. Not used.
-
std::vector<kc::id_t> getNodeIds()#
Get node IDs for DataStruct.
This method retrieves the IDs of the two nodes. This is designed primarily for use with the SpringDamperDS DataStruct.
- Returns:
Nodes’ IDs.
-
const kc::ks_ptr<kd::Node> &sourceNode() const#
Get the first node of the spring-damper.
- Returns:
The node
-
const kc::ks_ptr<kd::Node> &targetNode() const#
Get the second node of the spring-damper.
- Returns:
The node
Public Static Functions
-
static kc::ks_ptr<SpringDamper> create(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp, const kc::ks_ptr<kd::Node> nd1, const kc::ks_ptr<kd::Node> nd2)#
Constructor. The SpringDamper model applies an equal and opposing force to two nodes based on their current distance apart.
- Parameters:
name – The name of the model.
sp – The StatePropagator to register this model with.
nd1 – The first node in the spring damper model.
nd2 – The second node in the spring damper model.
- Returns:
A ks_ptr to the newly created instance of the SpringDamper model.
-
SpringDamper(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp, const kc::ks_ptr<kd::Node> nd1, const kc::ks_ptr<kd::Node> nd2)#