Forum Home › Forums › Development and Integration › Custom modbus driver
- This topic has 5 replies, 2 voices, and was last updated 2 months, 1 week ago by
Mikhail.
-
AuthorPosts
-
January 18, 2026 at 6:51 pm #17573
oley
ParticipantHi,
I have successfully created a driver that is an extension of DrvModbus. Unfortunately, the generated events do not appear in the web application or in the server log.
I can see them in the device, e.g.Recent Events +---------------------+-----+-------------------------------------+ | Timestamp | Tag | Description | +---------------------+-----+-------------------------------------+ | 18/01/2026 19:18:54 | | ODWZB. WE 31 | +---------------------+-----+-------------------------------------+ | 18/01/2026 19:18:54 | | POB. WE 18 | +---------------------+-----+-------------------------------------+ | 18/01/2026 19:18:54 | | ZAMKNIĘCIE OPERACYJNE ŁĄCZNIKA 1 7 | +---------------------+-----+-------------------------------------+ | 18/01/2026 19:21:45 | | POB. WE 31 | +---------------------+-----+-------------------------------------+ | 18/01/2026 19:21:45 | | ODWZB. WE 18 | +---------------------+-----+-------------------------------------+ | 18/01/2026 19:21:45 | | OTWARCIE OPERACYJNE ŁĄCZNIKA 1 7 | +---------------------+-----+-------------------------------------+ | 18/01/2026 19:22:07 | | ODWZB. WE 31 | +---------------------+-----+-------------------------------------+ | 18/01/2026 19:22:07 | | POB. WE 18 | +---------------------+-----+-------------------------------------+ | 18/01/2026 19:22:07 | | ZAMKNIĘCIE OPERACYJNE ŁĄCZNIKA 1 7 | +---------------------+-----+-------------------------------------+
The code I use to generate the event is:
DeviceEvent devEvent = new DeviceEvent { Timestamp = eventUtcTime, CnlVal = code, CnlStat = CnlStatusID.Defined, Descr = descr }; DeviceData.EnqueueEvent(devEvent);January 19, 2026 at 1:03 pm #17580
MikhailModeratorHi,
An event generated from the driver should be bound to a device tag.
A device tag should be bound to a channel.
Check this example.January 20, 2026 at 6:19 pm #17584oley
ParticipantHi Mikhail,
I tried to do this similar to DrvSimulator.
internal static class TagCode { public const string TangoEventCode = nameof(TangoEventCode); }public static List<CnlPrototypeGroup> GetGroups() { List<CnlPrototypeGroup> groups = new List<CnlPrototypeGroup>(); CnlPrototypeGroup group = new CnlPrototypeGroup("Events"); group.AddCnlPrototype(TagCode.TangoEventCode, "TangoEvent"); groups.Add(group); return groups; }DeviceTag eventTag = null; if (DeviceTags != null) { eventTag = DeviceTags[TagCode.TangoEventCode]; } DeviceEvent devEvent = eventTag != null ? new DeviceEvent(eventTag) : new DeviceEvent(); devEvent.Timestamp = eventUtcTime; devEvent.CnlVal = code; devEvent.CnlStat = CnlStatusID.Defined; devEvent.Descr = descr; DeviceData.EnqueueEvent(devEvent);I have created a channel in Scada bound to TangoEventCode tag.
Now I become an event in web app, but this containsDefined, <code>not my description of the event.Do I need to create a channel in Scada? If I use this driver for all my devices I have to gave this tag unique name with device number coded or similar.
I want to see my generated event with the description I created for it.
January 21, 2026 at 9:16 am #17588
MikhailModeratorA device tag is not null event if it is not bound to a channel.
You should initialize device tags in the driver logic in the InitDeviceTags method.
According to your first message, you already have device tags. For tests, try DeviceTags[0]January 21, 2026 at 9:38 am #17590oley
ParticipantMy problem now is that now I become evens which looks like defined channel data event:
21/01/2026 07:07:13 PV TANGO TangoEventCode Defined, 311.000 21/01/2026 07:07:13 PV TANGO TangoEventCode Defined, 310.000 21/01/2026 07:07:13 PV TANGO TangoEventCode Defined, 271.000 21/01/2026 07:07:13 PV TANGO TangoEventCode Defined, 270.000But I create a proper description for my device event in the driver (event is simple code, but has its meaning).
Recent Events +---------------------+----------------+-------------------------------------+ | Timestamp | Tag | Description | +---------------------+----------------+-------------------------------------+ | 20/01/2026 19:08:04 | TangoEventCode | <strong>ODWZB. WE 31</strong> | +---------------------+----------------+-------------------------------------+ | 20/01/2026 19:08:04 | TangoEventCode | POB. WE 18 | +---------------------+----------------+-------------------------------------+ | 20/01/2026 19:08:04 | TangoEventCode | ZAMKNIĘCIE OPERACYJNE ŁĄCZNIKA 1 7 | +---------------------+----------------+-------------------------------------+ | 21/01/2026 07:07:13 | TangoEventCode | ODWZB. ZAB. f<2 | +---------------------+----------------+-------------------------------------+ | 21/01/2026 07:07:13 | TangoEventCode | POB. ZAB. f<2 0 -100270580 2 | +---------------------+----------------+-------------------------------------+ | 21/01/2026 07:07:13 | TangoEventCode | ODWZB. ZAB. f>2 | +---------------------+----------------+-------------------------------------+ | 21/01/2026 07:07:13 | TangoEventCode | POB. ZAB. f>2 0 -8.214282E+11 2 | +---------------------+----------------+-------------------------------------+I want to see the description in rapid scada event table, in column description. Is this possible?
January 22, 2026 at 11:35 am #17594 -
AuthorPosts
- You must be logged in to reply to this topic.