mbsimcontrol  4.0.0
MBSim Control Module
linear_system_analyzer.h
1/* Copyright (C) 2004-2021 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: martin.o.foerg@gmail.com
18 */
19
20#ifndef _LINEAR_SYSTEM_ANALYZER_H_
21#define _LINEAR_SYSTEM_ANALYZER_H_
22
23#include "mbsim/solver.h"
24#include "mbsim/functions/function.h"
25#include "mbsim/utils/index.h"
26#include <mbsim/utils/boost_parameters.h>
27
28namespace MBSim {
29
30 BOOST_PARAMETER_NAME(modeNumbers)
31 BOOST_PARAMETER_NAME(frequencyRange)
32
33}
34
35namespace MBSimControl {
36
42 public:
43 LinearSystemAnalyzer() : fRange("[0;1e4]") { }
44 ~LinearSystemAnalyzer() override;
45 void execute() override;
46 void setInitialTime(double t0_) { t0 = t0_; }
47 void setInitialInput(const fmatvec::Vec &u0_) { u0 <<= u0_; }
48 void setMinimumNaturalFrequency(double fmin_) { fmin = fmin_; }
49 void setMaximumNaturalFrequency(double fmax_) { fmax = fmax_; }
50 void setNormalModeScaleFactor(double modeScaleFactor_) { modeScaleFactor = modeScaleFactor_; }
51 void setNormalModeScale(const fmatvec::VecV &modeScale_) { modeScale <<= modeScale_; }
52 void setExcitationFrequencies(const fmatvec::VecV &fex_) { fex <<= fex_; }
53 void setExcitationAmplitudeFunction(MBSim::Function<fmatvec::VecV(double)> *Amp_) { Amp = Amp_; }
54 void setExcitationPhaseFunction(MBSim::Function<fmatvec::VecV(double)> *Phi_) { Phi = Phi_; }
55 void setPlotStepSize(double dtPlot_) { dtPlot = dtPlot_; }
56 void setLoops(double loops_) { loops = loops_; }
57 void initializeUsingXML(xercesc::DOMElement *element) override;
58
59 BOOST_PARAMETER_MEMBER_FUNCTION( (void), visualizeNormalModes, MBSim::tag, (optional (modeNumbers,(fmatvec::VecVI),fmatvec::VecVI()))) {
60 msv = true;
61 modes = modeNumbers;
62 }
63
64 BOOST_PARAMETER_MEMBER_FUNCTION( (void), visualizeFrequencyResponse, MBSim::tag, (optional (frequencyRange,(fmatvec::Vec2),"[0;1e4]"))) {
65 frv = true;
66 fRange = frequencyRange;
67 }
68
69 protected:
70 double t0{0};
71 double fmin{1e-2};
72 double fmax{1e5};
73 double modeScaleFactor{1};
74 fmatvec::VecV modeScale;
75 MBSim::Function<fmatvec::VecV(double)> *Amp{nullptr};
76 MBSim::Function<fmatvec::VecV(double)> *Phi{nullptr};
77 fmatvec::VecV amp, phi;
78 fmatvec::Vec zEq, u0, fex;
79 bool msv{false};
80 bool frv{false};
81 bool srv{false};
82 bool its{true};
83 double tSpan{1};
84 fmatvec::VecVI modes;
85 fmatvec::Vec2 fRange;
86 std::vector<fmatvec::MatVx3> fap;
87 int loops{5};
88 double dtPlot{1e-2};
89 };
90
91}
92
93#endif
Linear system analyzer.
Definition: linear_system_analyzer.h:41