185 [[nodiscard]] std::uint16_t
Position() const noexcept;
194 [[nodiscard]]
bool Moving() const noexcept;
197 [[nodiscard]] const std::
string&
Name() const noexcept;
203 [[nodiscard]] std::uint16_t
InputSlot() const noexcept;
206 [[nodiscard]] std::uint16_t
InputSubslot() const noexcept;
209 [[nodiscard]] std::uint16_t
OutputSlot() const noexcept;
215 [[nodiscard]] const io::IoSignalCatalog&
SignalCatalog() const noexcept;
219 void OnFrame(std::function<
void(const
Bytes&)> callback);
276 std::string_view textId) const;
279 [[nodiscard]] const io::IoSignal&
RequireSignal(std::string_view textId,
280 io::IoSignalDirection direction) const;
284 std::uint8_t errorCode2) const;
306 std::unique_ptr<InMemoryEthernetSocket>
socket;
Defines the GSDML-derived logical process-data signal catalogue.
Builds and owns the logical sensor and actuator signals described by a GSDML device.
Small virtual Ethernet switch suitable for deterministic tests and demos.
AUMA SGx application model that behaves as a real RTC1 peer in memory.
const MacAddress & DeviceMac() const noexcept
Return the simulated device MAC address.
const gsdml::GSDMLDevice & gsdml
io::IoSignalCatalog catalog
std::uint16_t OutputSubslot() const noexcept
Return the configured output subslot.
std::uint16_t targetPosition
Bytes OutputProcessData() const
Return the most recent output process-data object.
const std::string & Name() const noexcept
Return the configured simulator name.
void SetScenario(VirtualAumaScenario scenario)
Set the current simulator scenario.
void SendInputFrame()
Send one device-to-controller RTC1 input frame.
rt::IOCRConfig outputIocr
VirtualAumaScenario Scenario() const noexcept
Return the current scenario.
VirtualAumaValve & operator=(const VirtualAumaValve &)=delete
std::uint16_t InputSlot() const noexcept
Return the configured input slot.
void ProcessOutputFrame(const Bytes &frame)
Decode and apply one controller RTC1 output frame.
void SetBitSignal(Bytes &data, std::string_view textId, bool value) const
Set one Boolean input signal.
std::uint64_t ReadScalarSignal(const Bytes &data, std::string_view textId) const
Read a big-endian unsigned output signal.
std::function< void(const Bytes &)> onFrame
VirtualAumaValveConfiguration config
std::function< void(const VirtualAumaAlarmEvent &)> onAlarm
std::uint16_t alarmSequence
Bytes InputProcessData() const
Return the most recent input process-data object.
void Stop()
Stop cyclic simulation.
std::uint32_t inputFrameNumber
void DecodeCommands(const Bytes &outputData)
Decode command bits and optional setpoints from an output object.
void OnAlarm(std::function< void(const VirtualAumaAlarmEvent &)> callback)
Register a callback for generated scenario alarm events.
void Run()
Main worker loop receiving controller outputs and sending device inputs.
void NotifyFrame(const Bytes &frame) const
Invoke the frame callback outside the state mutex.
VirtualAumaValve(const VirtualAumaValve &)=delete
const io::IoSignalCatalog & SignalCatalog() const noexcept
Return the GSDML-derived signal catalogue.
bool FaultActive() const noexcept
Return whether an application or mechanical fault is active.
std::unique_ptr< InMemoryEthernetSocket > socket
Bytes BuildAlarmNotificationBlock(std::uint16_t alarmSpecifier) const
Build a PROFINET AlarmNotification block for a scenario.
std::uint16_t OutputSlot() const noexcept
Return the configured output slot.
std::uint16_t rxCycleCounter
bool Moving() const noexcept
Return whether the valve model is moving toward its target.
std::uint16_t InputSubslot() const noexcept
Return the configured input subslot.
std::atomic< bool > running
Bytes BuildRtaErrorFrame(std::uint8_t errorCode1, std::uint8_t errorCode2) const
Build the raw RTA 0x0F scenario error frame.
const io::IoSignal & RequireSignal(std::string_view textId, io::IoSignalDirection direction) const
Resolve a unique GSDML signal or throw a configuration error.
void UpdateProcessModel(double elapsedSeconds)
Advance the valve application model for one elapsed interval.
bool ReadBitSignal(const Bytes &data, std::string_view textId) const
Read a Boolean output signal.
std::uint16_t TargetPosition() const noexcept
Return the current requested target position.
void BuildInputProcessData()
Rebuild all AUMA input measurement and status signals.
std::uint16_t Position() const noexcept
Return the current simulated position.
void EmitScenarioAlarms(VirtualAumaScenario scenario)
Emit enabled scenario alarms and notify callbacks.
VirtualAumaScenario scenario
void OnFrame(std::function< void(const Bytes &)> callback)
Register a callback for every Ethernet frame emitted by the device.
void SetScalarSignal(Bytes &data, std::string_view textId, std::uint64_t value) const
Set one big-endian unsigned input signal.
void NotifyAlarm(const VirtualAumaAlarmEvent &event) const
Invoke the alarm callback outside the state mutex.
~VirtualAumaValve()
Stop the simulator and release the virtual transport.
Declares the GSDML parser and PROFINET device-description data model.
Thread-safe in-memory Layer-2 Ethernet switch for PROFINET simulation.
VirtualAumaScenario
Deterministic operating and communication scenarios for a virtual AUMA valve.
@ Fault
Application fault: movement stops, IOPS becomes BAD and alarms are emitted.
@ BadIops
Input frames continue, but the input provider reports BAD IOPS.
@ DuplicateInput
Input frames repeat their previous cycle counter.
@ SlowValve
Valve travels using the configured reduced speed multiplier.
@ OutOfOrderInput
Input frames occasionally move the cycle counter backwards.
@ Normal
Fully healthy operation with normal travel speed.
@ NoInput
Input frames stop completely so the controller watchdog expires.
@ InvalidInput
Input frames remain valid but carry an invalid RTC1 DATA_STATUS.
@ Jammed
Valve accepts commands but the mechanical position does not change.
const char * ToString(VirtualAumaScenario scenario) noexcept
Convert a virtual AUMA scenario into its stable CLI spelling.
std::array< std::uint8_t, macAddressLength > MacAddress
A 6-byte Ethernet MAC address.
std::vector< std::uint8_t > Bytes
Generic byte buffer alias used throughout the library for raw wire data.
Declares PROFINET RT_CLASS_1 cyclic frame and IOCR data structures.
Complete parsed GSDML device profile.
IOCR configuration derived from AR setup: timing parameters and IO object mappings needed for cyclic ...
Captured alarm traffic produced by a virtual AUMA scenario.
Bytes rtaErrorFrame
Complete RTA 0x0F Ethernet frame; empty when disabled.
VirtualAumaScenario scenario
Scenario that caused this event.
std::uint8_t errorCode1
First simulator-defined RTA error code byte.
std::uint16_t alarmSpecifier
AlarmSpecifier placed in the AlarmNotification block.
std::uint8_t errorCode2
Second simulator-defined RTA error code byte.
Bytes alarmNotificationFrame
Complete RTA DATA AlarmNotification Ethernet frame; empty when disabled.
Application-level signal mapping and motion settings for a virtual AUMA SGx.
std::string speedSetpoint
Optional speed setpoint signal, interpreted as 0..100 percent.
std::uint32_t alarmModuleIdent
Module identifier used by the simulated input alarm.
std::string faultSignal
Generic fault indication signal.
std::uint32_t alarmSubmoduleIdent
Submodule identifier used by the simulated input alarm.
std::string positionSetpoint
Optional position setpoint signal.
std::string openCommand
OPEN command bit in the AUMA output process data.
bool emitAlarmNotification
Whether a parseable AlarmNotification is emitted for scenarios.
std::uint16_t alarmSourceReference
Source RTA alarm endpoint reference.
std::string stopCommand
STOP command bit in the AUMA output process data.
bool emitRtaError
Whether an RTA 0x0F error PDU is emitted for scenarios.
std::string actualPosition
Actual position sensor signal.
double slowValveMultiplier
Speed multiplier for the SlowValve scenario.
std::string closeCommand
CLOSE command bit in the AUMA output process data.
std::uint32_t alarmApi
AlarmNotification API used by the simulated device.
double travelUnitsPerSecond
Nominal travel speed in position units per second.
std::uint16_t alarmDestinationReference
Destination RTA alarm endpoint reference.
std::string warningSignal
Generic warning indication signal.
std::uint16_t initialPosition
Initial valve position in the AUMA 0..10000 application range.
std::uint16_t outputSubslot
Output process-data subslot.
std::uint16_t inputSlot
Input process-data slot.
std::uint16_t outputSlot
Output process-data slot.
std::uint16_t inputSubslot
Input process-data subslot.
Declares Linux Ethernet, addressing, timing, and utility helpers used by the PROFINET stack.