48 std::string m_name, m_unit;
50 Component(
const std::string & name,
const std::string & unit) :
51 m_stateSpace(), m_fdm(), m_name(name), m_unit(unit) {};
53 virtual double get()
const = 0;
54 virtual void set(
double val) = 0;
55 virtual double getDeriv()
const
58 std::vector<double> x0 = m_stateSpace->x.get();
62 m_fdm->
Setdt(1./120.);
66 m_stateSpace->x.set(x0);
69 std::cout << std::scientific
74 <<
"\tdf/dt: " << (f1-f0)/m_fdm->
GetDeltaT()
75 << std::fixed << std::endl;
77 double deriv = (f1-f0)/m_fdm->
GetDeltaT();
85 m_stateSpace = stateSpace;
91 const std::string & getName()
const
95 const std::string & getUnit()
const
106 m_stateSpace(stateSpace), m_fdm(fdm), m_components() {}
109 m_stateSpace = componentVector.m_stateSpace;
110 m_fdm = componentVector.m_fdm;
111 m_components = componentVector.m_components;
115 m_stateSpace(componentVector.m_stateSpace),
116 m_fdm(componentVector.m_fdm),
117 m_components(componentVector.m_components)
122 comp->setStateSpace(m_stateSpace);
124 m_components.push_back(comp);
126 size_t getSize()
const
128 return m_components.size();
132 return m_components[i];
136 return m_components[i];
138 double get(
int i)
const
140 return m_components[i]->get();
142 void set(
int i,
double val)
144 m_components[i]->set(val);
149 return m_components[i]->get();
151 std::vector<double> get()
const
153 std::vector<double> val;
154 for (
unsigned int i=0;i<getSize();i++) val.push_back(m_components[i]->get());
157 void get(
double * array)
const
159 for (
unsigned int i=0;i<getSize();i++) array[i] = m_components[i]->get();
161 double getDeriv(
int i)
163 return m_components[i]->getDeriv();
165 std::vector<double> getDeriv()
const
167 std::vector<double> val;
168 for (
unsigned int i=0;i<getSize();i++) val.push_back(m_components[i]->getDeriv());
171 void getDeriv(
double * array)
const
173 for (
unsigned int i=0;i<getSize();i++) array[i] = m_components[i]->getDeriv();
175 void set(std::vector<double> vals)
177 for (
unsigned int i=0;i<getSize();i++) m_components[i]->set(vals[i]);
180 void set(
double * array)
182 for (
unsigned int i=0;i<getSize();i++) m_components[i]->set(array[i]);
185 std::string getName(
int i)
const
187 return m_components[i]->getName();
189 std::vector<std::string> getName()
const
191 std::vector<std::string> name;
192 for (
unsigned int i=0;i<getSize();i++) name.push_back(m_components[i]->getName());
195 std::string getUnit(
int i)
const
197 return m_components[i]->getUnit();
199 std::vector<std::string> getUnit()
const
201 std::vector<std::string> unit;
202 for (
unsigned int i=0;i<getSize();i++) unit.push_back(m_components[i]->getUnit());
206 m_components.clear();
211 std::vector<Component *> m_components;
278 void linearize(std::vector<double> x0, std::vector<double> u0, std::vector<double> y0,
305 return m_fdm->GetAuxiliary()->GetVt();
309 m_fdm->GetIC()->SetVtrueFpsIC(val);
311 double getDeriv()
const
314 return (m_fdm->GetPropagate()->GetUVW(1)*m_fdm->GetAccelerations()->GetUVWdot(1) +
315 m_fdm->GetPropagate()->GetUVW(2)*m_fdm->GetAccelerations()->GetUVWdot(2) +
316 m_fdm->GetPropagate()->GetUVW(3)*m_fdm->GetAccelerations()->GetUVWdot(3))/
317 m_fdm->GetAuxiliary()->GetVt();
384 return m_fdm->GetAuxiliary()->Getalpha();
388 double beta = m_fdm->GetIC()->GetBetaDegIC();
389 double psi = m_fdm->GetIC()->GetPsiRadIC();
390 double theta = m_fdm->GetIC()->GetThetaRadIC();
391 m_fdm->GetIC()->SetAlphaRadIC(val);
392 m_fdm->GetIC()->SetBetaRadIC(beta);
393 m_fdm->GetIC()->SetPsiRadIC(psi);
394 m_fdm->GetIC()->SetThetaRadIC(theta);
396 double getDeriv()
const
398 return m_fdm->GetAuxiliary()->Getadot();
463 return m_fdm->GetAuxiliary()->Getbeta();
467 double psi = m_fdm->GetIC()->GetPsiRadIC();
468 m_fdm->GetIC()->SetBetaRadIC(val);
469 m_fdm->GetIC()->SetPsiRadIC(psi);
471 double getDeriv()
const
473 return m_fdm->GetAuxiliary()->Getbdot();
902 return atan2(m_fdm->GetPropagate()->GetVel(2),m_fdm->GetPropagate()->GetVel(1));
907 m_fdm->GetIC()->SetVNorthFpsIC(m_fdm->GetAuxiliary()->GetVground()*cos(val));
908 m_fdm->GetIC()->SetVEastFpsIC(m_fdm->GetAuxiliary()->GetVground()*sin(val));
910 double getDeriv()
const
912 double Vn = m_fdm->GetPropagate()->GetVel(1);
913 double Vndot = (m_fdm->GetPropagate()->GetTb2l()*m_fdm->GetAccelerations()->GetUVWdot())(1);
914 double Ve = m_fdm->GetPropagate()->GetVel(2);
915 double Vedot = (m_fdm->GetPropagate()->GetTb2l()*m_fdm->GetAccelerations()->GetUVWdot())(2);