19#ifndef _DIRECTIONAL_SPRING_DAMPER_H_
20#define _DIRECTIONAL_SPRING_DAMPER_H_
22#include "mbsim/links/floating_frame_link.h"
23#include "mbsim/functions/function.h"
25#include "mbsim/utils/boost_parameters.h"
26#include "mbsim/utils/openmbv_utils.h"
37 Function<double(
double,
double)> *func;
39 std::shared_ptr<OpenMBVCoilSpring> ombvCoilSpring;
40 std::shared_ptr<OpenMBV::CoilSpring> coilspringOpenMBV;
44 double evalNone() {
return 0; }
45 double evalDeflection() {
return evalGeneralizedRelativePosition()(0)-l0; }
46 double evalTensileForce() {
return -evalGeneralizedForce()(0); }
47 double evalCompressiveForce() {
return evalGeneralizedForce()(0); }
48 double evalAbsoluteForce() {
return fabs(evalGeneralizedForce()(0)); }
54 void updateGeneralizedPositions()
override;
55 void updateGeneralizedVelocities()
override;
56 void updatelaF()
override;
59 bool isActive()
const override {
return true; }
62 void init(
InitStage stage,
const InitConfigSet &config)
override;
72 func->setParent(
this);
85 void initializeUsingXML(xercesc::DOMElement *element)
override;
87 BOOST_PARAMETER_MEMBER_FUNCTION( (
void), enableOpenMBV, tag, (optional (numberOfCoils,(
int),3)(springRadius,(
double),1)(crossSectionRadius,(
double),-1)(nominalLength,(
double),-1)(type,(OpenMBVCoilSpring::Type),OpenMBVCoilSpring::tube)(colorRepresentation,(OpenMBVCoilSpring::ColorRepresentation),OpenMBVCoilSpring::none)(minimalColorValue,(
double),0)(maximalColorValue,(
double),1)(diffuseColor,(
const fmatvec::Vec3&),fmatvec::Vec3(std::vector<double>{-1,1,1}))(transparency,(
double),0)(pointSize,(
double),0)(lineWidth,(
double),0))) {
88 ombvCoilSpring = std::shared_ptr<OpenMBVCoilSpring>(
new OpenMBVCoilSpring(springRadius,crossSectionRadius,1,numberOfCoils,nominalLength,type,colorRepresentation,minimalColorValue,maximalColorValue,diffuseColor,transparency,pointSize,lineWidth));
A spring damper force law. This class connects two frames and applies a force in it,...
Definition: directional_spring_damper.h:34
bool isActive() const override
Definition: directional_spring_damper.h:59
bool gActiveChanged() override
Definition: directional_spring_damper.h:60
void setForceFunction(Function< double(double, double)> *func_)
Set function for the force calculation. The first input parameter to that function is the distance re...
Definition: directional_spring_damper.h:70
void setForceDirection(const fmatvec::Vec3 &dir)
Definition: directional_spring_damper.h:82
void setUnloadedLength(double l0_)
Set unloaded length.
Definition: directional_spring_damper.h:77
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: directional_spring_damper.cc:69
bool isSingleValued() const override
asks the link if it contains single valued force laws that contribute to the right-hand side vector h
Definition: directional_spring_damper.h:61
void plot() override
plots time dependent data
Definition: directional_spring_damper.cc:81
InitStage
The stages of the initialization.
Definition: element.h:62
std::string name
name of element
Definition: element.h:260
void setName(const std::string &str)
Definition: element.h:115
floating frame link
Definition: floating_frame_link.h:32
fmatvec::Mat3xV forceDir
directions of force and moment in frame of reference
Definition: floating_frame_link.h:80
std::vector< Frame * > frame
array in which all frames are listed, connecting bodies via a link
Definition: frame_link.h:83
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
Definition: function.h:53
namespace MBSim
Definition: bilateral_constraint.cc:30