DPsim
InterfaceVillas.cpp
1 // SPDX-License-Identifier: Apache-2.0
2 
3 #include <dpsim-villas/InterfaceVillas.h>
4 #include <dpsim-villas/InterfaceWorkerVillas.h>
5 
6 using namespace villas;
7 
8 namespace DPsim {
9 
10 InterfaceVillas::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) {
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 
37 void InterfaceVillas::printVillasSignals() const {
38  std::dynamic_pointer_cast<InterfaceWorkerVillas>(mInterfaceWorker)
39  ->printSignals();
40 }
41 
42 } // namespace DPsim
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
virtual void exportAttribute(CPS::AttributeBase::Ptr attr, UInt idx, Bool waitForOnWrite, const String &name="", const String &unit="")
configure an attribute export