DPsim
Public Member Functions | List of all members
DPsim::InterfaceVillas Class Reference

Interface type that can be used to import and export simulation attributes over any node type supported by VILLASnode. More...

#include <InterfaceVillas.h>

Inheritance diagram for DPsim::InterfaceVillas:
[legend]
Collaboration diagram for DPsim::InterfaceVillas:
[legend]

Public Member Functions

 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 More...
 
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 More...
 
virtual void exportAttribute (CPS::AttributeBase::Ptr attr, UInt idx, Bool waitForOnWrite, const String &name="", const String &unit="")
 configure an attribute export More...
 
virtual void printVillasSignals () const
 
- Public Member Functions inherited from DPsim::InterfaceQueued
 InterfaceQueued (std::shared_ptr< InterfaceWorker > intf, const String &name="", UInt downsampling=1)
 
virtual void open () override
 
virtual void close () override
 
virtual void pushDpsimAttrsToQueue ()
 
virtual void popDpsimAttrsFromQueue (bool isSync=false)
 
virtual void syncExports () override
 
virtual void syncImports () override
 Function called by the Simulation to perform interface synchronization.
 
virtual CPS::Task::List getTasks () override
 
virtual void setLogger (CPS::Logger::Log log) override
 
- Public Member Functions inherited from DPsim::Interface
 Interface (const String &name="", spdlog::level::level_enum logLevel=spdlog::level::level_enum::info)
 
virtual String & getName ()
 
virtual void addImport (CPS::AttributeBase::Ptr attr, bool blockOnRead=false, bool syncOnSimulationStart=true)
 
virtual void addExport (CPS::AttributeBase::Ptr attr)
 

Additional Inherited Members

- Public Types inherited from DPsim::InterfaceQueued
enum  AttributePacketFlags { PACKET_NO_FLAGS = 0 , PACKET_CLOSE_INTERFACE = 1 }
 
typedef std::shared_ptr< InterfaceQueuedPtr
 
using AttributePacket = struct AttributePacket { CPS::AttributeBase::Ptr value
 
- Public Types inherited from DPsim::Interface
typedef std::shared_ptr< InterfacePtr
 
- Static Public Member Functions inherited from SharedFactory< Interface >
static std::shared_ptr< Interface > make (Args &&...args)
 
- Static Public Member Functions inherited from SharedFactory< InterfaceQueued >
static std::shared_ptr< InterfaceQueued > make (Args &&...args)
 
- Static Public Member Functions inherited from SharedFactory< InterfaceVillas >
static std::shared_ptr< InterfaceVillas > make (Args &&...args)
 
- Public Attributes inherited from DPsim::InterfaceQueued
UInt attributeId
 
UInt sequenceId
 
unsigned char flags
 
- Public Attributes inherited from DPsim::Interface
std::vector< std::tuple< CPS::AttributeBase::Ptr, UInt, bool, bool > > mImportAttrsDpsim
 
std::vector< std::tuple< CPS::AttributeBase::Ptr, UInt > > mExportAttrsDpsim
 
- Protected Attributes inherited from DPsim::InterfaceQueued
std::shared_ptr< InterfaceWorkermInterfaceWorker
 
UInt mDownsampling
 
std::thread mInterfaceWriterThread
 
std::thread mInterfaceReaderThread
 
std::shared_ptr< moodycamel::BlockingReaderWriterQueue< AttributePacket > > mQueueDpsimToInterface
 
std::shared_ptr< moodycamel::BlockingReaderWriterQueue< AttributePacket > > mQueueInterfaceToDpsim
 
- Protected Attributes inherited from DPsim::Interface
CPS::Logger::Log mLog
 
String mName
 
bool mSyncOnSimulationStart
 
UInt mCurrentSequenceDpsimToInterface = 1
 
UInt mNextSequenceInterfaceToDpsim = 1
 
std::atomic< bool > mOpened
 

Detailed Description

Interface type that can be used to import and export simulation attributes over any node type supported by VILLASnode.

Definition at line 21 of file InterfaceVillas.h.

Constructor & Destructor Documentation

◆ InterfaceVillas()

DPsim::InterfaceVillas::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

Parameters
nodeConfigVILLASnode node configuration in JSON format
queueLengthqueue lenght configured for the node
sampleLengthsample length configured for the node
nameName of this interface. Currently only used for naming the simulation tasks
downsamplingOnly import and export attributes on every nth timestep

Definition at line 10 of file InterfaceVillas.cpp.

Member Function Documentation

◆ exportAttribute()

void DPsim::InterfaceVillas::exportAttribute ( CPS::AttributeBase::Ptr  attr,
UInt  idx,
Bool  waitForOnWrite,
const String &  name = "",
const String &  unit = "" 
)
virtual

configure an attribute export

Parameters
attrthe attribute which's value should be exported
idxThe id given to the attribute within VILLASnode samples
waitForOnWriteWhether a sample that is sent from this interface is required to contain an updated value of this attribute
nameName given to the attribute within VILLASnode samples
unitUnit given to the attribute within VILLASnode samples

Definition at line 28 of file InterfaceVillas.cpp.

◆ importAttribute()

void DPsim::InterfaceVillas::importAttribute ( CPS::AttributeBase::Ptr  attr,
UInt  idx,
Bool  blockOnRead = false,
Bool  syncOnSimulationStart = true,
const String &  name = "",
const String &  unit = "" 
)
virtual

configure an attribute import

Parameters
attrthe attribute that should be updated with the imported values
idxThe id given to the attribute within VILLASnode samples
blockOnReadWhether the simulation should block on every import until the attribute has been updated
syncOnSimulationStartWhether the simulation should block before the first timestep until this attribute has been updated

Definition at line 18 of file InterfaceVillas.cpp.


The documentation for this class was generated from the following files: