mbsimcontrol 4.0.0 MBSim Control Module

linear_transfer_system.h
1 /* Copyright (C) 204-2009 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_TRANSFER_SYSTEM_
21 #define _LINEAR_TRANSFER_SYSTEM_
22
23 #include "mbsimControl/signal_.h"
24
25 namespace MBSimControl {
26
31 class LinearTransferSystem : public Signal {
32
33 public:
34 LinearTransferSystem(const std::string& name="") : Signal(name) { }
35
36 void initializeUsingXML(xercesc::DOMElement * element) override;
37
38 void calcxSize() override { xSize = A.rows(); }
39
40 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
41
42 void setInitialState(const fmatvec::Vec &x0_) { x0 <<= x0_; }
43
44 void updateSignal() override;
45 void updatexd() override;
46
47 void setSystemMatrix(const fmatvec::SqrMatV &A_) { A <<= A_; }
48 void setInputMatrix(const fmatvec::MatV &B_) { B <<= B_; }
49 void setOutputMatrix(const fmatvec::MatV &C_) { C <<= C_; }
50 void setFeedthroughMatrix(const fmatvec::MatV &D_) { D <<= D_; }
51
52 void setInputSignal(Signal * inputSignal_) { inputSignal = inputSignal_; }
53 int getSignalSize() const override { return C()?C.rows():A.size(); }
54
55 protected:
56 Signal* inputSignal{nullptr};
57 std::string inputSignalString;
58 fmatvec::SqrMatV A;
59 fmatvec::MatV B, C, D;
60 bool feedthrough{true};
61 };
62
63 }
64
65 #endif
MBSim::Link::x0
fmatvec::Vec x0
MBSim::Link::xSize
int xSize
MBSimControl::Signal
Signal.
Definition: signal_.h:38
MBSim::Element::InitStage
InitStage
MBSim::Element::name
std::string name
MBSimControl::LinearTransferSystem
Linear tansfer system.
Definition: linear_transfer_system.h:31