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  : Interface(
14  InterfaceWorkerVillas::make(nodeConfig, queueLength, sampleLength),
15  name, downsampling) {}
16 
18  Bool blockOnRead,
19  Bool syncOnSimulationStart,
20  const String &name, const String &unit) {
21  Interface::addImport(attr, blockOnRead, syncOnSimulationStart);
22  std::dynamic_pointer_cast<InterfaceWorkerVillas>(mInterfaceWorker)
23  ->configureImport((UInt)mImportAttrsDpsim.size() - 1, attr->getType(),
24  idx, name, unit);
25 }
26 
28  Bool waitForOnWrite, const String &name,
29  const String &unit) {
30  Interface::addExport(attr);
31  std::dynamic_pointer_cast<InterfaceWorkerVillas>(mInterfaceWorker)
32  ->configureExport((UInt)mExportAttrsDpsim.size() - 1, attr->getType(),
33  idx, waitForOnWrite, name, unit);
34 }
35 
36 void InterfaceVillas::printVillasSignals() const {
37  std::dynamic_pointer_cast<InterfaceWorkerVillas>(mInterfaceWorker)
38  ->printSignals();
39 }
40 
41 } // namespace DPsim
void importAttribute(CPS::AttributeBase::Ptr attr, UInt idx, Bool blockOnRead=false, Bool syncOnSimulationStart=true, const String &name="", const String &unit="")
configure an attribute import
void exportAttribute(CPS::AttributeBase::Ptr attr, UInt idx, Bool waitForOnWrite, const String &name="", const String &unit="")
configure an attribute export