00001 #ifndef MECHANICAL_H
00002 #define MECHANICAL_H
00003
00008 #include <string>
00009 #include <stdexcept>
00010 #include <boost/numeric/ublas/matrix.hpp>
00011 #include "dynamic/object.h"
00012 namespace dynamic
00013 {
00018 class Mechanical : public Object
00019 {
00023 double m_mass;
00027 double m_rigidity;
00031 double m_damping;
00036 double m_defle;
00037 double m_speed;
00038 double m_accel;
00039
00043 double* p_defle_rel;
00044 double* p_speed_rel;
00045 double* p_accel_rel;
00046 protected:
00052 double force_spring_activity() const;
00058 double force_damper_activity() const;
00059 public:
00061 Mechanical();
00063 ~Mechanical();
00064
00065
00066
00067
00073 class LessZero: public std::invalid_argument{
00074 public:
00078 LessZero(const std::string& msg = "value") : std::invalid_argument("The " + msg + " is less then zero."){}
00079 };
00085
00086 double mass() const;
00092 double rigidity() const;
00098 double damping() const;
00103 double defle() const;
00108 double speed() const;
00113 double accel() const;
00118 double defle_rel() const;
00123 double speed_rel() const;
00128 double accel_rel() const;
00132 void defle(double defle);
00136 void speed(double speed);
00140
00144 void mass(double mass) throw(std::invalid_argument);
00148 void rigidity(double rigidity) throw(std::invalid_argument);
00152 void damping(double damping) throw(std::invalid_argument);
00157 double power() const;
00162 void calculation_const() throw(std::runtime_error,std::invalid_argument);
00166 void calculation() throw(std::runtime_error,std::invalid_argument);
00167 };
00168 }
00169 #endif //MECHANICAL_H