DPsim
Loading...
Searching...
No Matches
InterfaceVillas.cpp
1// SPDX-License-Identifier: Apache-2.0
2
3#include <dpsim-villas/InterfaceVillas.h>
4#include <dpsim-villas/InterfaceWorkerVillas.h>
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
18void InterfaceVillas::importAttribute(CPS::AttributeBase::Ptr attr, UInt idx,
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
28void InterfaceVillas::exportAttribute(CPS::AttributeBase::Ptr attr, UInt idx,
29 Bool waitForOnWrite, const String &name,
30 const String &unit) {
31 Interface::addExport(attr);
32 std::dynamic_pointer_cast<InterfaceWorkerVillas>(mInterfaceWorker)
33 ->configureExport((UInt)mExportAttrsDpsim.size() - 1, attr->getType(),
34 idx, waitForOnWrite, name, unit);
35}
36
37void InterfaceVillas::printVillasSignals() const {
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.
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