29 const std::string& textId)
43 const std::string& bitPrefix)
46 item.useAsBits =
true;
47 for (std::uint8_t bit = 0; bit < 8U; ++bit)
49 item.bitDataItems.push_back({bit, bitPrefix + std::to_string(bit)});
65 inputModule.
id =
"ID_MODULE_ADI_IN_0";
69 inputSubmodule.
id =
"ID_SUBMOD_ADI_IN_0";
76 MakeBitByte(
"T_ID_DEVICESTATUS",
"T_ID_DEVICESTATUS_"),
77 MakeBitByte(
"T_ID_OPERATIONSTATUS",
"T_ID_OPERATIONSTATUS_"),
84 inputModule.
submodules.emplace(inputSubmodule.
id, inputSubmodule);
85 device.
modules.emplace(inputModule.
id, inputModule);
88 outputModule.
id =
"ID_MODULE_ADI_OUT_0";
92 outputSubmodule.
id =
"ID_SUBMOD_ADI_OUT_0";
104 outputModule.
submodules.emplace(outputSubmodule.
id, outputSubmodule);
105 device.
modules.emplace(outputModule.
id, outputModule);
131 module.id = "PNSlot1";
132 module.moduleIdentNumber = 0x00000001U;
135 submodule.
id =
"PNIO0202";
136 submodule.submoduleIdentNumber = 0x00000009U;
137 submodule.fixedSubslots = {1};
138 submodule.inputItems = {
145 submodule.outputItems = {
150 submodule.inputLength = 13;
151 submodule.outputLength = 9;
152 module.submodules.emplace(submodule.id, submodule);
153 device.
modules.emplace(module.id, module);
169 result.input.dataLength = 16U;
170 result.output.dataLength = 16U;
171 result.input.objects[0].frameOffset = 0U;
172 result.input.objects[0].offsetIOPS = 9U;
173 result.output.objects[0].frameOffset = 0U;
174 result.output.objects[0].offsetIOPS = 7U;
182inline bool WaitUntil(
const std::function<
bool()>& predicate,
183 std::chrono::milliseconds timeout = std::chrono::milliseconds(500))
185 const auto deadline = std::chrono::steady_clock::now() + timeout;
186 while (std::chrono::steady_clock::now() < deadline)
192 std::this_thread::sleep_for(std::chrono::milliseconds(2));
204 static_cast<std::uint8_t
>((index >> 8U) & 0xFFU),
205 static_cast<std::uint8_t
>(index & 0xFFU)};
Declares the GSDML parser and PROFINET device-description data model.
constexpr MacAddress kControllerMac
MacAddress MakeIndexedMac(const std::uint8_t prefix, const std::size_t index)
Allocate a deterministic locally administered MAC address for an instance index.
gsdml::GSDMLDevice MakePhoenixGsdml()
Build a compact Phoenix GSDML model with four-byte DI/DO process data.
gsdml::GSDMLDataItem MakeScalarItem(const std::string &dataType, const int length, const std::string &textId)
Create a scalar GSDML DataItem.
VirtualAumaIocrConfiguration MakeTestAumaIocrs(const gsdml::GSDMLDevice &device)
Build matching compact RTC1 IOCR configurations for the AUMA test model.
gsdml::GSDMLDevice MakeAumaGsdml()
Build a compact GSDML model using the real AUMA signal identifiers.
constexpr MacAddress kValveMac
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.
gsdml::GSDMLDataItem MakeBitByte(const std::string &parentTextId, const std::string &bitPrefix)
Create a GSDML Boolean byte containing eight BitDataItems.
VirtualAumaIocrConfiguration MakeVirtualAumaIocrConfiguration(const gsdml::GSDMLDevice &device, std::uint16_t inputFrameId=0x9000, std::uint16_t outputFrameId=0x8001, std::uint16_t sendClockFactor=32, std::uint16_t reductionRatio=8, std::uint16_t watchdogFactor=3, std::uint16_t dataHoldFactor=3)
Build the standard two-module AUMA SGx process-data layout from its GSDML.
std::array< std::uint8_t, macAddressLength > MacAddress
A 6-byte Ethernet MAC address.
One I/O data item within a submodule's cyclic data (GSDML DataItem element).
int length
Length in bytes of this item.
std::string dataType
GSDML DataType attribute, e.g. "Unsigned8", "Integer16", "OctetString".
std::string textId
Human-readable text ID/name for this item, if the GSDML supplied one.
Complete parsed GSDML device profile.
std::map< std::string, GSDMLModule > modules
Every module declared in the GSDML's ModuleList, keyed by GSDML ID.
std::vector< GSDMLModuleReference > moduleReferences
Modules referenced by the DAP's UseableModules list.
std::uint16_t vendorId
PROFINET vendor ID from the GSDML's DeviceIdentity (VendorID attribute).
std::uint16_t deviceId
PROFINET device ID from the GSDML's DeviceIdentity (DeviceID attribute).
std::string deviceName
Device name from the GSDML's DeviceIdentity / DeviceFunction.
std::string dapModuleId
The device access point's own (built-in) identifier to matchs with the submodule.
Reference describing how a module may be used by the DAP.
std::string moduleId
Referenced ModuleItem ID.
std::vector< int > fixedSlots
Slots where the module is fixed.
A GSDML module definition (ModuleItem), possibly offering multiple virtual submodules.
std::string id
GSDML ID attribute (used to resolve ModuleItemTarget references).
std::map< std::string, GSDMLSubmodule > submodules
Virtual submodules this module offers, keyed by their GSDML ID.
std::uint32_t moduleIdentNumber
Module ident number (hex value from the GSDML, parsed to an integer).
A GSDML virtual submodule definition (VirtualSubmoduleItem).
std::uint32_t submoduleIdentNumber
Submodule ident number (hex value from the GSDML, parsed to an integer).
std::vector< GSDMLDataItem > inputItems
Individual input data items, in wire order.
std::string id
GSDML ID attribute (used to resolve VirtualSubmoduleItemTarget references).
int outputLength
Total output data length in bytes (sum of Output DataItems).
std::vector< GSDMLDataItem > outputItems
Individual output data items, in wire order.
int inputLength
Total input data length in bytes (sum of Input DataItems).
std::vector< int > fixedSubslots
Subslots where this inline virtual submodule is fixed.
Input and output RTC1 configurations used by the virtual AUMA peer.
Declares Linux Ethernet, addressing, timing, and utility helpers used by the PROFINET stack.
Helpers for constructing a GSDML-derived AUMA SGx RTC1 test configuration.