PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
profinet::sim::test Namespace Reference

Functions

gsdml::GSDMLDataItem MakeScalarItem (const std::string &dataType, const int length, const std::string &textId)
 Create a scalar GSDML DataItem.
 
gsdml::GSDMLDataItem MakeBitByte (const std::string &parentTextId, const std::string &bitPrefix)
 Create a GSDML Boolean byte containing eight BitDataItems.
 
gsdml::GSDMLDevice MakeAumaGsdml ()
 Build a compact GSDML model using the real AUMA signal identifiers.
 
gsdml::GSDMLDevice MakePhoenixGsdml ()
 Build a compact Phoenix GSDML model with four-byte DI/DO process data.
 
VirtualAumaIocrConfiguration MakeTestAumaIocrs (const gsdml::GSDMLDevice &device)
 Build matching compact RTC1 IOCR configurations for the AUMA test model.
 
bool WaitUntil (const std::function< bool()> &predicate, std::chrono::milliseconds timeout=std::chrono::milliseconds(500))
 Wait until a predicate becomes true or the timeout expires.
 
MacAddress MakeIndexedMac (const std::uint8_t prefix, const std::size_t index)
 Allocate a deterministic locally administered MAC address for an instance index.
 

Variables

constexpr MacAddress kControllerMac {0x02, 0x00, 0x00, 0x10, 0x00, 0x01}
 
constexpr MacAddress kValveMac {0x02, 0x00, 0x00, 0x20, 0x00, 0x01}
 

Function Documentation

◆ MakeAumaGsdml()

◆ MakeBitByte()

gsdml::GSDMLDataItem profinet::sim::test::MakeBitByte ( const std::string &  parentTextId,
const std::string &  bitPrefix 
)
inline

Create a GSDML Boolean byte containing eight BitDataItems.

Parameters
parentTextIdParent DataItem TextId.
bitPrefixPrefix for each BitDataItem TextId.
Returns
Initialized bit DataItem.

Definition at line 42 of file virtual_sim_test_helpers.h.

References MakeScalarItem().

Referenced by MakeAumaGsdml(), and MakePhoenixGsdml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeIndexedMac()

MacAddress profinet::sim::test::MakeIndexedMac ( const std::uint8_t  prefix,
const std::size_t  index 
)
inline

Allocate a deterministic locally administered MAC address for an instance index.

Parameters
prefixFourth MAC byte used to identify the simulator class.
indexZero-based instance index.
Returns
Unique test MAC address for indices below 256.

Definition at line 201 of file virtual_sim_test_helpers.h.

References MakeIndexedMac().

Referenced by MakeIndexedMac().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakePhoenixGsdml()

gsdml::GSDMLDevice profinet::sim::test::MakePhoenixGsdml ( )
inline

Build a compact Phoenix GSDML model with four-byte DI/DO process data.

Returns
Synthetic Phoenix Contact GSDML suitable for controller-side unit tests.

Definition at line 122 of file virtual_sim_test_helpers.h.

References profinet::gsdml::GSDMLDevice::dapModuleId, profinet::gsdml::GSDMLDevice::deviceId, profinet::gsdml::GSDMLDevice::deviceName, profinet::gsdml::GSDMLModuleReference::fixedSlots, profinet::gsdml::GSDMLSubmodule::id, MakeBitByte(), MakeScalarItem(), profinet::gsdml::GSDMLModuleReference::moduleId, profinet::gsdml::GSDMLDevice::moduleReferences, profinet::gsdml::GSDMLDevice::modules, and profinet::gsdml::GSDMLDevice::vendorId.

Referenced by profinet::sim::TEST(), and profinet::sim::TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeScalarItem()

gsdml::GSDMLDataItem profinet::sim::test::MakeScalarItem ( const std::string &  dataType,
const int  length,
const std::string &  textId 
)
inline

Create a scalar GSDML DataItem.

Parameters
dataTypeGSDML DataType.
lengthData length in bytes.
textIdGSDML TextId.
Returns
Initialized DataItem.

Definition at line 27 of file virtual_sim_test_helpers.h.

References profinet::gsdml::GSDMLDataItem::dataType, profinet::gsdml::GSDMLDataItem::length, length, and profinet::gsdml::GSDMLDataItem::textId.

Referenced by MakeAumaGsdml(), MakeBitByte(), and MakePhoenixGsdml().

+ Here is the caller graph for this function:

◆ MakeTestAumaIocrs()

VirtualAumaIocrConfiguration profinet::sim::test::MakeTestAumaIocrs ( const gsdml::GSDMLDevice &  device)
inline

Build matching compact RTC1 IOCR configurations for the AUMA test model.

Parameters
deviceAUMA GSDML model.
Returns
Input and output configurations.

Definition at line 166 of file virtual_sim_test_helpers.h.

References MakeTestAumaIocrs(), and profinet::sim::MakeVirtualAumaIocrConfiguration().

Referenced by MakeTestAumaIocrs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WaitUntil()

bool profinet::sim::test::WaitUntil ( const std::function< bool()> &  predicate,
std::chrono::milliseconds  timeout = std::chrono::milliseconds(500) 
)
inline

Wait until a predicate becomes true or the timeout expires.

Parameters
predicateCondition to evaluate.
timeoutMaximum wait time.
Returns
True when the condition became true.

Definition at line 182 of file virtual_sim_test_helpers.h.

References WaitUntil().

Referenced by WaitUntil().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ kControllerMac

constexpr MacAddress profinet::sim::test::kControllerMac {0x02, 0x00, 0x00, 0x10, 0x00, 0x01}
inlineconstexpr

Definition at line 19 of file virtual_sim_test_helpers.h.

Referenced by profinet::sim::TEST().

◆ kValveMac

constexpr MacAddress profinet::sim::test::kValveMac {0x02, 0x00, 0x00, 0x20, 0x00, 0x01}
inlineconstexpr

Definition at line 20 of file virtual_sim_test_helpers.h.

Referenced by profinet::sim::TEST().