mbsimcontrol  4.0.0
MBSim Control Module
signal_.h
1/* Copyright (C) 2004-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: markus.ms.schneider@gmail.com
18 */
19
20#ifndef _SIGNALMBSIM_H_
21#define _SIGNALMBSIM_H_
22
23#include "mbsim/links/link.h"
24#include "mbsimControl/namespace.h"
25
26namespace MBSim {
27 class DynamicSystem;
28}
29
30namespace MBSimControl {
31
32 extern const MBSim::PlotFeatureEnum signal;
33
38 class Signal : public MBSim::Link {
39
40 public:
41 Signal(const std::string &name) : Link(name), upds(true) { }
42
43 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
44
45 void updateg() override { }
46 void updategd() override { }
47 virtual void updateSignal() { }
48
49 void updateWRef(fmatvec::Mat& ref, int i=0) override { }
50 void updateVRef(fmatvec::Mat& ref, int i=0) override { }
51 void updatehRef(fmatvec::Vec &hRef, int i=0) override { }
52 virtual void updatedhdqRef(fmatvec::Mat& ref, int i=0) { }
53 virtual void updatedhduRef(fmatvec::SqrMat& ref, int i=0) { }
54 virtual void updatedhdtRef(fmatvec::Vec& ref, int i=0) { }
55 void updaterRef(fmatvec::Vec &ref, int i=0) override { }
56 bool isActive() const override { return false; }
57 bool gActiveChanged() override { return false; }
58 bool isSingleValued() const override { return true; }
59 void updaterFactors() override { }
60 void solveConstraintsFixpointSingle() override { }
61 void checkConstraintsForTermination() override { }
62
63 void plot() override;
64
65 const fmatvec::VecV& getSignal(bool check=true) { assert((not check) or (not upds)); return s; }
66 const fmatvec::VecV& evalSignal() { if(upds) updateSignal(); return s; }
67 virtual int getSignalSize() const { return 0; }
68
69 void resetUpToDate() override { upds = true; }
70
71 protected:
72 fmatvec::VecV s;
73 bool upds;
74 };
75
76}
77
78#endif /* _SIGNALMBSIM_H_ */
Signal.
Definition: signal_.h:38
std::string name