|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
Owns one shared Ethernet bus plus any number of virtual PLCs and AUMA valves. More...
#include <virtual_pn_lab.h>
Collaboration diagram for profinet::sim::VirtualProfinetLab:Classes | |
| struct | AumaEntry |
| struct | PlcEntry |
Public Member Functions | |
| VirtualProfinetLab ()=default | |
| Create an empty virtual network. | |
| ~VirtualProfinetLab () | |
| VirtualProfinetLab (const VirtualProfinetLab &)=delete | |
| VirtualProfinetLab & | operator= (const VirtualProfinetLab &)=delete |
| VirtualAumaValve & | AddAumaValve (std::string name, const gsdml::GSDMLDevice &gsdml, MacAddress deviceMac, rt::IOCRConfig inputIocr, rt::IOCRConfig outputIocr, VirtualAumaValveConfiguration config={}) |
| Add one AUMA valve instance. | |
| VirtualPhoenixPlc & | AddPhoenixPlc (std::string name, const gsdml::GSDMLDevice &gsdml, MacAddress controllerMac) |
| Add one Phoenix AXC F 1252 controller instance. | |
| void | Connect (asio::io_context &ioContext, const std::string &plcName, const std::string &valveName, rt::IOCRConfig inputIocr, rt::IOCRConfig outputIocr, int maxConsecutiveTimeouts=cyclic::DEFAULT_MAX_CONSECUTIVE_TIMEOUTS) |
| Connect a PLC to an AUMA valve. | |
| void | SetAumaScenario (const std::string &valveName, VirtualAumaScenario scenario) |
| Set one valve scenario. | |
| InMemoryEthernetBus & | Bus () noexcept |
| Return the shared virtual bus. | |
| VirtualAumaValve & | Valve (const std::string &name) |
| Find a valve by name. | |
| const VirtualAumaValve & | Valve (const std::string &name) const |
| Find a valve by name from a const lab. | |
| VirtualPhoenixPlc & | Plc (const std::string &name) |
| Find a PLC by name. | |
| const VirtualPhoenixPlc & | Plc (const std::string &name) const |
| Find a PLC by name from a const lab. | |
| std::vector< std::string > | ValveNames () const |
| Return all valve names. | |
| std::vector< std::string > | PlcNames () const |
| Return all PLC names. | |
| std::string | StatusReport () const |
| Render a compact multi-device status dashboard. | |
| void | Stop () |
| Stop all devices and controllers. | |
Private Member Functions | |
| bool | IsMacInUse (const MacAddress &mac) const noexcept |
| Determine whether a node MAC is already used by this lab. | |
Private Attributes | |
| InMemoryEthernetBus | bus |
| std::vector< AumaEntry > | valves |
| std::vector< PlcEntry > | plcs |
Owns one shared Ethernet bus plus any number of virtual PLCs and AUMA valves.
Definition at line 21 of file virtual_pn_lab.h.
|
default |
Create an empty virtual network.
| profinet::sim::VirtualProfinetLab::~VirtualProfinetLab | ( | ) |
Definition at line 13 of file virtual_pn_lab.cpp.
References Stop().
Here is the call graph for this function:
|
delete |
| VirtualAumaValve & profinet::sim::VirtualProfinetLab::AddAumaValve | ( | std::string | name, |
| const gsdml::GSDMLDevice & | gsdml, | ||
| MacAddress | deviceMac, | ||
| rt::IOCRConfig | inputIocr, | ||
| rt::IOCRConfig | outputIocr, | ||
| VirtualAumaValveConfiguration | config = {} |
||
| ) |
Add one AUMA valve instance.
| name | Stable logical instance name. |
| gsdml | Parsed AUMA GSDML. |
| deviceMac | Unique device MAC. |
| inputIocr | Device input IOCR. |
| outputIocr | Device output IOCR. |
| config | Valve application configuration. |
Definition at line 18 of file virtual_pn_lab.cpp.
References bus, IsMacInUse(), profinet::Mac2String(), and valves.
Referenced by profinet::sim::TEST(), profinet::sim::TEST(), and profinet::sim::TEST().
Here is the call graph for this function:
Here is the caller graph for this function:| VirtualPhoenixPlc & profinet::sim::VirtualProfinetLab::AddPhoenixPlc | ( | std::string | name, |
| const gsdml::GSDMLDevice & | gsdml, | ||
| MacAddress | controllerMac | ||
| ) |
Add one Phoenix AXC F 1252 controller instance.
Definition at line 47 of file virtual_pn_lab.cpp.
References IsMacInUse(), profinet::Mac2String(), and plcs.
Referenced by profinet::sim::TEST(), profinet::sim::TEST(), and profinet::sim::TEST().
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Return the shared virtual bus.
Definition at line 87 of file virtual_pn_lab.cpp.
References bus.
Referenced by profinet::sim::TEST().
Here is the caller graph for this function:| void profinet::sim::VirtualProfinetLab::Connect | ( | asio::io_context & | ioContext, |
| const std::string & | plcName, | ||
| const std::string & | valveName, | ||
| rt::IOCRConfig | inputIocr, | ||
| rt::IOCRConfig | outputIocr, | ||
| int | maxConsecutiveTimeouts = cyclic::DEFAULT_MAX_CONSECUTIVE_TIMEOUTS |
||
| ) |
Connect a PLC to an AUMA valve.
Definition at line 66 of file virtual_pn_lab.cpp.
References bus, profinet::sim::VirtualPhoenixPlc::Connect(), ioContext, Plc(), and Valve().
Referenced by profinet::sim::TEST().
Here is the call graph for this function:
Here is the caller graph for this function:
|
privatenoexcept |
Determine whether a node MAC is already used by this lab.
Definition at line 185 of file virtual_pn_lab.cpp.
Referenced by AddAumaValve(), and AddPhoenixPlc().
Here is the caller graph for this function:
|
delete |
| VirtualPhoenixPlc & profinet::sim::VirtualProfinetLab::Plc | ( | const std::string & | name | ) |
Find a PLC by name.
Definition at line 103 of file virtual_pn_lab.cpp.
References plcs.
Referenced by Connect(), and profinet::sim::TEST().
Here is the caller graph for this function:| const VirtualPhoenixPlc & profinet::sim::VirtualProfinetLab::Plc | ( | const std::string & | name | ) | const |
Find a PLC by name from a const lab.
Definition at line 125 of file virtual_pn_lab.cpp.
References plcs.
| std::vector< std::string > profinet::sim::VirtualProfinetLab::PlcNames | ( | ) | const |
Return all PLC names.
Definition at line 147 of file virtual_pn_lab.cpp.
References plcs.
Referenced by profinet::sim::TEST(), and profinet::sim::TEST().
Here is the caller graph for this function:| void profinet::sim::VirtualProfinetLab::SetAumaScenario | ( | const std::string & | valveName, |
| VirtualAumaScenario | scenario | ||
| ) |
Set one valve scenario.
Definition at line 81 of file virtual_pn_lab.cpp.
References profinet::sim::VirtualAumaValve::SetScenario(), and Valve().
Referenced by profinet::sim::TEST().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string profinet::sim::VirtualProfinetLab::StatusReport | ( | ) | const |
Render a compact multi-device status dashboard.
Definition at line 158 of file virtual_pn_lab.cpp.
References bus, profinet::sim::InMemoryEthernetBus::EndpointCount(), profinet::Mac2String(), plcs, profinet::sim::ToString(), and valves.
Referenced by profinet::sim::TEST().
Here is the call graph for this function:
Here is the caller graph for this function:| void profinet::sim::VirtualProfinetLab::Stop | ( | ) |
Stop all devices and controllers.
Definition at line 204 of file virtual_pn_lab.cpp.
Referenced by ~VirtualProfinetLab(), profinet::sim::TEST(), and profinet::sim::TEST().
Here is the caller graph for this function:| VirtualAumaValve & profinet::sim::VirtualProfinetLab::Valve | ( | const std::string & | name | ) |
Find a valve by name.
Definition at line 92 of file virtual_pn_lab.cpp.
References valves.
Referenced by Connect(), SetAumaScenario(), profinet::sim::TEST(), and profinet::sim::TEST().
Here is the caller graph for this function:| const VirtualAumaValve & profinet::sim::VirtualProfinetLab::Valve | ( | const std::string & | name | ) | const |
Find a valve by name from a const lab.
Definition at line 114 of file virtual_pn_lab.cpp.
References valves.
| std::vector< std::string > profinet::sim::VirtualProfinetLab::ValveNames | ( | ) | const |
Return all valve names.
Definition at line 136 of file virtual_pn_lab.cpp.
References valves.
Referenced by profinet::sim::TEST(), and profinet::sim::TEST().
Here is the caller graph for this function:
|
private |
Definition at line 90 of file virtual_pn_lab.h.
Referenced by AddAumaValve(), Bus(), Connect(), and StatusReport().
|
private |
Definition at line 102 of file virtual_pn_lab.h.
Referenced by AddPhoenixPlc(), Plc(), Plc(), PlcNames(), StatusReport(), and Stop().
|
private |
Definition at line 101 of file virtual_pn_lab.h.
Referenced by AddAumaValve(), StatusReport(), Stop(), Valve(), Valve(), and ValveNames().