mbsimcontrol  4.0.0
MBSim Control Module
nonlinear_transfer_system.h
1/* Copyright (C) 204-2020 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 _NONLINEAR_TRANSFER_SYSTEM_
21#define _NONLINEAR_TRANSFER_SYSTEM_
22
23#include "mbsimControl/signal_.h"
24#include "mbsim/functions/function.h"
25
26namespace MBSimControl {
27
33
34 public:
35 NonlinearTransferSystem(const std::string& name="") : Signal(name) { }
36
37 void initializeUsingXML(xercesc::DOMElement * element) override;
38
39 void calcxSize() override { xSize = F->getRetSize().first; }
40
41 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
42
43 void setInitialState(const fmatvec::Vec &x0_) { x0 <<= x0_; }
44
45 void updateSignal() override;
46 void updatexd() override;
47
48 void setSystemFunction(MBSim::Function<fmatvec::VecV(fmatvec::VecV,fmatvec::VecV)> *F_) {
49 F=F_;
50 F->setParent(this);
51 F->setName("SystemFunction");
52 };
53 void setOutputFunction(MBSim::Function<fmatvec::VecV(fmatvec::VecV,fmatvec::VecV)> *H_) {
54 H=H_;
55 H->setParent(this);
56 H->setName("OutputFunction");
57 };
58
59 void setInputSignal(Signal * inputSignal_) { inputSignal = inputSignal_; }
60 int getSignalSize() const override { return H?H->getRetSize().first:F->getArg1Size(); }
61
62 protected:
63 Signal* inputSignal{nullptr};
64 std::string inputSignalString;
65 MBSim::Function<fmatvec::VecV(fmatvec::VecV,fmatvec::VecV)> *F{nullptr};
66 MBSim::Function<fmatvec::VecV(fmatvec::VecV,fmatvec::VecV)> *H{nullptr};
67 };
68
69}
70
71#endif
Nonlinear tansfer system.
Definition: nonlinear_transfer_system.h:32
Signal.
Definition: signal_.h:38
std::string name
void setName(const std::string &str)