DPsim
Loading...
Searching...
No Matches
InterfaceVillas.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
5
6using namespace villas;
7
8namespace DPsim {
9
10InterfaceVillas::InterfaceVillas(const String &nodeConfig, UInt queueLength,
11 UInt sampleLength, const String &name,
12 UInt downsampling,
13 spdlog::level::level_enum logLevel)
14 : InterfaceQueued(InterfaceWorkerVillas::make(nodeConfig, queueLength,
15 sampleLength, logLevel),
16 name, downsampling) {}
17
19 Bool blockOnRead,
20 Bool syncOnSimulationStart,
21 const String &name, const String &unit) {
22 Interface::addImport(attr, blockOnRead, syncOnSimulationStart);
23 std::dynamic_pointer_cast<InterfaceWorkerVillas>(mInterfaceWorker)
24 ->configureImport((UInt)mImportAttrsDpsim.size() - 1, attr->getType(),
25 idx, name, unit);
26}
27
29 Bool waitForOnWrite, const String &name,
30 const String &unit) {
32 std::dynamic_pointer_cast<InterfaceWorkerVillas>(mInterfaceWorker)
33 ->configureExport((UInt)mExportAttrsDpsim.size() - 1, attr->getType(),
34 idx, waitForOnWrite, name, unit);
35}
36
38 std::dynamic_pointer_cast<InterfaceWorkerVillas>(mInterfaceWorker)
39 ->printSignals();
40}
41
42} // namespace DPsim
virtual const std::type_info & getType()=0
Get the type of this attribute.
AttributePointer< AttributeBase > Ptr
Definition Attribute.h:122
std::vector< std::tuple< CPS::AttributeBase::Ptr, UInt, bool, bool > > mImportAttrsDpsim
Definition Interface.h:49
virtual void addImport(CPS::AttributeBase::Ptr attr, bool blockOnRead=false, bool syncOnSimulationStart=true)
Definition Interface.cpp:9
virtual void addExport(CPS::AttributeBase::Ptr attr)
Definition Interface.cpp:20
std::vector< std::tuple< CPS::AttributeBase::Ptr, UInt > > mExportAttrsDpsim
Definition Interface.h:51
InterfaceQueued(std::shared_ptr< InterfaceWorker > intf, const String &name="", UInt downsampling=1)
std::shared_ptr< InterfaceWorker > mInterfaceWorker
virtual void printVillasSignals() const
virtual void importAttribute(CPS::AttributeBase::Ptr attr, UInt idx, Bool blockOnRead=false, Bool syncOnSimulationStart=true, const String &name="", const String &unit="")
configure an attribute import
InterfaceVillas(const String &nodeConfig, UInt queueLength=512, UInt sampleLength=64, const String &name="", UInt downsampling=1, spdlog::level::level_enum logLevel=spdlog::level::level_enum::info)
create a new InterfaceVillas instance
virtual void exportAttribute(CPS::AttributeBase::Ptr attr, UInt idx, Bool waitForOnWrite, const String &name="", const String &unit="")
configure an attribute export
static std::shared_ptr< InterfaceVillas > make(Args &&...args)
Definition PtrFactory.h:19
CPS::String String
Definition Definitions.h:20
CPS::Bool Bool
Definition Definitions.h:21
CPS::UInt UInt
Definition Definitions.h:23