mbsiminterface  1.0.0
MBSim Interface Module
interface_integrator.h
1/* Copyright (C) 2013 Markus Schneider
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 *
18 * Contact:
19 * markus.ms.schneider@live.de
20 *
21 */
22
23#ifndef _INTERFACE_INTEGRATOR_H_
24#define _INTERFACE_INTEGRATOR_H_
25
26#include <mbsim/integrators/integrator.h>
27
28namespace MBSimControl {
29 class Signal;
30 class ExternSignalSource;
31}
32
33namespace MBSimInterface {
34
35 class MBSimServer;
36
40
41 protected:
42 std::ofstream integPlot;
43
44 public:
45
47 ~InterfaceIntegrator() override = default;
48
49 void setMBSimServer(MBSimServer* m_) {mbsimServer=m_; }
50
51 void integrate() override;
52
53 void initializeUsingXML(xercesc::DOMElement *element) override;
54
55 void integratorCommunication(const char* requestIdentifier, const char* interface2mbsim, unsigned int interface2mbsimLength, std::ostringstream* mbsim2interface);
56 bool getExitRequest() {return exitRequest; }
57
58 private:
59 // get values
60 void getz(double** z_);
61 void getzdot(double** zdot_);
62 void getsv(double** sv_);
63
64 // set values
65 void setTime(double t_);
66 void setz(const fmatvec::Vec& z_);
67
68 // internal routines
69 int zSize{0}, svSize{0};
70
71 bool printCommunication{true};
72
73 void dumpMemory(std::ostringstream *out, void *p, unsigned int N);
74 void double2str(std::ostringstream *out, double *p, unsigned int N);
75 void int2str(std::ostringstream *out, int *p, unsigned int N);
76
77 bool exitRequest{false};
78
79 MBSimServer* mbsimServer;
80 std::vector<std::string> outputSignalRef, inputSignalRef, outputSignalName, inputSignalName;
81 std::vector<MBSimControl::Signal*> outputSignal;
82 std::vector<MBSimControl::ExternSignalSource*> inputSignal;
83 fmatvec::VecInt outputSignalSize, inputSignalSize;
84 void resolveInputOutputNames();
85 fmatvec::Vec outputVector, inputVector;
86 };
87}
88
89#endif // _SERVER_INTEGRATOR_H_
Dummy-Integrator InterfaceIntegrator This integrator is an interface for other integration tool.
Definition: interface_integrator.h:39
Definition: mbsim_server.h:34