Forum Home › Forums › Understanding the Software › Reading event log from modbus device
- This topic has 26 replies, 3 voices, and was last updated 1 month ago by
Mikhail.
-
AuthorPosts
-
July 22, 2025 at 12:00 pm #16689
oley
ParticipantHi,
I have got some information from the manufacturer of the device.
Address 0x0501 contains count of the new events since last reading.
Address 0x0502 contains total count of the events, max 1024.Address range 0x1000-0x13FF contains events from the most recent and it is locked until the register 0x0501 or 0x0502 is read again.
What if I create group of channels from 0x1000 to 0x13FF and every channel will have formula:
channel 0x1000 -> if (channel0x0501 > 0 and channel0x0502 > 0)
channel 0x1001 -> if (channel0x0501 > 1 and channel0x0502 > 1)and so on?
If I activate the events for each channel, so they will appear in the event log.
Is this possible?Best regards
July 23, 2025 at 11:54 am #16695Mikhail
ModeratorHi,
Probably, you can read the most recent event from the fixed Modbus address. Then you will get it as channel values. How will you process those channel values?July 23, 2025 at 12:21 pm #16696oley
ParticipantHi,
it would be good to generate SCADA events based on those events, so I have it in standard event list.
July 23, 2025 at 12:33 pm #16697oley
ParticipantThis is a bit complicated, so I’ll try to explain again.
I read 0x0501 and can get:
– 0, that is, no new event has occurred since the last reading of 0x0501
– a value greater than 0, such as 5, and then I have to read addresses 0x1000 to 0x1005 to get 5 eventsJuly 23, 2025 at 2:15 pm #16700manjey73
Participantand if the value is 5 but you read 10, will there be an error or just zeros? and how are the events arranged? are these consistent occurrences? how will you identify them?
July 23, 2025 at 2:24 pm #16701oley
ParticipantNext registers contains events from the previous reading.
0x0006 will be the 0x0000 from the previous reading of 0x0501 because 5 new events have been created in the meantime and have been placed at the top of the list.
Next ones are historical data up to the value of 0x0502 (max 1024).
After restart of the device the list is empty and both 0x0501 and 0x0502 contains 0. After first event created both 0x0501 and 0x0502 contains 1, but if we read 0x0501 or 0x0502 and no event occurred 0x0501 is 0 and 0x0502 is 1.July 23, 2025 at 4:16 pm #16702oley
ParticipantSince I am familiar with the .net framework and the C# programming language, I would most like to program the handling of these events as a driver.
From such a driver, would I be able to read any ModBus device registers and generate SCADA events based on them?
I understand that I need to create the device logic by creating a class inherited from DeviceLogic, access the data via class inherited from DeviceData and creating events using a class derived from DeviceEvent.
The question is, is there a minimal example of a ModBus device driver available that I could follow?July 24, 2025 at 9:43 am #16707Mikhail
Moderatora value greater than 0, such as 5, and then I have to read addresses 0x1000 to 0x1005 to get 5 events
You can send a command to poll the device using Automatic Control Module. Then try to generate events with the same module. Before developing a new driver, it’s worth trying.
From such a driver, would I be able to read any ModBus device registers and generate SCADA events based on them?
Yes.
is there a minimal example of a ModBus device driver available that I could follow?
Check the existing drivers, especially DrvModbus, DrvEnronModbus and DrvSimulator.
-
This reply was modified 1 month ago by
Mikhail.
July 24, 2025 at 11:23 am #16716oley
ParticipantThank you. To clarify: you mean to define 2 device pollings, first for data and second for this log events. Second one should poll only for command?
July 24, 2025 at 11:49 am #16718manjey73
ParticipantAnother example of event generation from the driver
You probably need to make a derived driver for events from the device. Connect the DrvModbus driver as required. As a channel, make something like an indicator of the presence of an event to save the time of occurrence in the database. Maybe an event counter.
If the events that have occurred are sequentially arranged in the event buffer, and their sequence may be different, this is probably the best option. Creating a list of events should probably be done through for(foreach) and selecting them from the list of possible ones.July 24, 2025 at 12:26 pm #16719oley
ParticipantThank you.
Yes, the events are sequentially arranged in the buffer.
The new ones are written at the top of the buffer.
I have to read as many, as value of 0x0501 register, which stores the count of the events written to the buffer since last read.July 25, 2025 at 12:47 pm #16732Mikhail
ModeratorTo clarify: you mean to define 2 device pollings, first for data and second for this log events. Second one should poll only for command?
That’s right.
-
This reply was modified 1 month ago by
-
AuthorPosts
- You must be logged in to reply to this topic.