OMSimulatorLib
The OMSimulator project is a FMI-based co-simulation environment.
Loading...
Searching...
No Matches
ComponentDCP.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenModelica.
3 *
4 * Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
5 * c/o Linköpings universitet, Department of Computer and Information Science,
6 * SE-58183 Linköping, Sweden.
7 *
8 * All rights reserved.
9 *
10 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
11 * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
12 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
13 * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
14 * ACCORDING TO RECIPIENTS CHOICE.
15 *
16 * The OpenModelica software and the Open Source Modelica
17 * Consortium (OSMC) Public License (OSMC-PL) are obtained
18 * from OSMC, either from the above address,
19 * from the URLs: http://www.ida.liu.se/projects/OpenModelica or
20 * http://www.openmodelica.org, and in the OpenModelica distribution.
21 * GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
22 *
23 * This program is distributed WITHOUT ANY WARRANTY; without
24 * even the implied warranty of MERCHANTABILITY or FITNESS
25 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
26 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
27 *
28 * See the full OSMC Public License conditions for more details.
29 *
30 */
31
32#ifndef _OMS_COMPONENT_DCP_H_
33#define _OMS_COMPONENT_DCP_H_
34
35
36
37#include "Component.h"
38#include "ComRef.h"
39#include "DCPInfo.h"
40#include "ResultWriter.h"
41#include "Snapshot.h"
42#include "Values.h"
43#include "Variable.h"
44
45#include <fmi4c.h>
46#include <map>
47#include <pugixml.hpp>
48#include <string>
49#include <unordered_map>
50#include <vector>
51#include <cmath>
52#include <dcp/driver/ethernet/udp/UdpDriver.hpp> //Must be included first because of include conflict with Asio and windows.h
53#include <dcp/logic/DcpManagerMaster.hpp>
54
55class SlaveDescription_t;
56
57namespace oms
58{
59class System;
60
61class ComponentDCP : public Component
62{
63public:
65
66 static Component* NewComponent(const ComRef& cref, System* parentSystem, const std::string& dcpPath, std::string replaceComponent = "");
67 static Component* NewComponent(const pugi::xml_node& node, System* parentSystem, const std::string& sspVersion, const Snapshot& snapshot, std::string variantName);
68 const DCPInfo* getDCPInfo() const {return &(this->dcpInfo);}
69
70
71 oms_status_enu_t addSignalsToResults(const char* regex);
72 oms_status_enu_t exportToSSD(pugi::xml_node& node, Snapshot& snapshot, std::string variantName) const;
73 oms_status_enu_t initialize();
74 oms_status_enu_t instantiate();
75 oms_status_enu_t stepUntil(double stopTime) { return oms_status_ok; }
76 oms_status_enu_t registerSignalsForResultFile(ResultWriter& resultFile);
77 oms_status_enu_t removeSignalsFromResults(const char* regex);
78 oms_status_enu_t reset();
79 oms_status_enu_t terminate();
80 oms_status_enu_t updateSignals(ResultWriter& resultWriter);
82 void getFilteredSignals(std::vector<Connector>& filteredSignals) const;
83 oms_status_enu_t initializeDependencyGraph_outputs();
84
85protected:
86 ComponentDCP(const ComRef& cref, System* parentSystem, const std::string& fmuPath);
87
88 // stop the compiler generating methods copying the object
91
92private:
94 std::shared_ptr<SlaveDescription_t> dcpSlaveDescription;
95 std::vector<Variable> allVariables;
96 std::vector<unsigned int> calculatedParameters;
97 std::vector<unsigned int> derivatives;
98 std::vector<unsigned int> inputs;
99 std::vector<unsigned int> outputs;
100 std::vector<unsigned int> parameters;
101 std::vector<bool> exportVariables;
103
104 double time;
105
107};
108}
109
110#endif
ComRef - component reference.
Definition ComRef.h:51
Definition ComponentDCP.h:62
std::vector< Variable > allVariables
Definition ComponentDCP.h:95
oms_status_enu_t stepUntil(double stopTime)
Definition ComponentDCP.h:75
Values values
start values defined before instantiating the FMU and external inputs defined after initialization
Definition ComponentDCP.h:102
std::vector< unsigned int > derivatives
Definition ComponentDCP.h:97
oms_status_enu_t registerSignalsForResultFile(ResultWriter &resultFile)
Definition ComponentDCP.cpp:312
oms::ComRef getValidCref(ComRef cref)
double time
Definition ComponentDCP.h:104
ComponentDCP & operator=(ComponentDCP const &copy)
not implemented
oms_status_enu_t updateSignals(ResultWriter &resultWriter)
Definition ComponentDCP.cpp:334
ComponentDCP(ComponentDCP const &copy)
not implemented
oms_status_enu_t reset()
Definition ComponentDCP.cpp:324
oms_status_enu_t initialize()
Definition ComponentDCP.cpp:301
std::shared_ptr< SlaveDescription_t > dcpSlaveDescription
Definition ComponentDCP.h:94
std::vector< unsigned int > outputs
Definition ComponentDCP.h:99
void getFilteredSignals(std::vector< Connector > &filteredSignals) const
Definition ComponentDCP.cpp:340
oms_status_enu_t instantiate()
Definition ComponentDCP.cpp:307
DCPInfo dcpInfo
Definition ComponentDCP.h:93
oms_status_enu_t initializeDependencyGraph_outputs()
Definition ComponentDCP.cpp:351
std::vector< bool > exportVariables
Definition ComponentDCP.h:101
~ComponentDCP()
Definition ComponentDCP.cpp:58
static Component * NewComponent(const ComRef &cref, System *parentSystem, const std::string &dcpPath, std::string replaceComponent="")
Definition ComponentDCP.cpp:62
std::vector< unsigned int > inputs
Definition ComponentDCP.h:98
oms_status_enu_t addSignalsToResults(const char *regex)
Definition ComponentDCP.cpp:263
std::vector< unsigned int > parameters
Definition ComponentDCP.h:100
std::vector< unsigned int > calculatedParameters
Definition ComponentDCP.h:96
const DCPInfo * getDCPInfo() const
Definition ComponentDCP.h:68
oms_status_enu_t removeSignalsFromResults(const char *regex)
Definition ComponentDCP.cpp:318
Variable * getVariable(const ComRef &cref)
Definition ComponentDCP.cpp:345
oms_status_enu_t exportToSSD(pugi::xml_node &node, Snapshot &snapshot, std::string variantName) const
Definition ComponentDCP.cpp:282
oms_status_enu_t terminate()
Definition ComponentDCP.cpp:329
Definition Component.h:65
ComRef cref
Definition Component.h:190
System * parentSystem
Definition Component.h:189
DCP info.
Definition DCPInfo.h:48
Definition ResultWriter.h:73
Definition Snapshot.h:51
Definition System.h:72
Definition Values.h:50
Definition Variable.h:58
Definition AlgLoop.h:52