Forum Home › Forums › Development and Integration › How best to proceed?
- This topic has 10 replies, 3 voices, and was last updated 1 week, 3 days ago by Mikhail.
-
AuthorPosts
-
September 2, 2024 at 1:39 am #15269johnkayParticipant
Hello,
I am receiving a C data structure through a Windows COM port at 10Hz.
I will parse this structure into 20 elements.
I would like to push these elements into Rapid SCADA database so they can be used in my Views.
What is the easiest way to for me to poke this data into the database?
Regards,
September 2, 2024 at 5:53 am #15271manjey73ParticipantHow do you receive data via the COM port?
September 2, 2024 at 9:28 am #15275MikhailModeratorHi,
Could you provide an example of a data packet or protocol description?September 2, 2024 at 4:13 pm #15278johnkayParticipantIt’s not a protocol, per se, it’s just i open ten (10) serial ports, each of which receives a different serial data packet ending with a CRC32; if the CRC is ok, i use data data, otherwise, i discard it.
All of the data is described in tables like this and I am just starting to
build the c structs…
So, let’s say I receive and validate a battery voltage, amperage, temperature using a standalone C program running on the same computer as RapidSCADA is installed.
From here, I see multiple approaches
1/ use POST? PUT? commands to put the data in the database
2/ create a simulated MODBUS rtu for each COM channel and follow the video
3/ write my updates into a separate database and sync with the RapidSCADA databaseI’m hoping to use RS for collecting and displaying rocket launch telemetry data so ALL my data comes in on RS-422 serial ports, so ingest speed would be my main goal.
Thank you.
September 3, 2024 at 6:38 am #15279manjey73ParticipantC# allows you to use a dll in C if all the necessary functions are exported in the C library. Probably the best approach would be to write a driver for RS that will work with your C libraries and load data directly into the scada database.
There are examples of how to use the C library in the RS driver. If necessary, I will give you links.
September 3, 2024 at 6:42 am #15280manjey73ParticipantHere I used to import a function from the library for the driver of the 5th version of scada.
By itself, the import probably will not be different for version 6, there are differences in the construction of the driver itself.https://github.com/Manjey73/OpnenKPs/blob/master/KpRpi3/KpRpi3/WiringPi.cs
Oh, well, here’s an example for the Linux library.
- This reply was modified 1 week, 4 days ago by manjey73.
September 3, 2024 at 8:59 am #15284MikhailModeratorI suppose, you should develop a driver for the Communicator application. Collected data then transferred by Communicator to Server, which writes it to the archives.
Check this article. In the driver, you can use a connection provided by Communicator engine, or open serial ports from your code.If you need to poll all ports in parallel, each port will relate to its communication line that uses a separate thread.
September 3, 2024 at 9:00 am #15285MikhailModeratorHow many data points you need to collect per minute or second?
September 3, 2024 at 3:16 pm #15286johnkayParticipant** Thanks for the good advice**
I don’t know the total data point count/rate at this moment.
I think I will create a C library for each of the serial inputs, so I can do the required endian and engineering units conversion locally.
For example, I receive the following struct at 10Hz on COM1:
typedef struct Status_Packet_T0_Plus
{
// Packet Headeruint8_t Start_Flag; // Always 0xAD
uint8_t Packet_Type;
uint8_t Message_Sequence_Number; // Start at 0 and rolls over at 255.// SSI Timer Identification
uint16_t SSI_Timer_Serial_Number;
// SSI Timer State
uint8_t Timer_State;
uint8_t Timer_Count[3];
uint8_t Fire_Switch_Excitation_Flags;
uint8_t Flight_Computer_Bad_Flags;
uint8_t Trigger_Before_T1_Flags;// Hardware State
uint8_t Hardware_State;
uint8_t Flight_Computer_Triggers;// Battery State
uint8_t Battery_State_Information[3]; // Little Endian[3];
// Power Supply and Temperature
uint8_t Volts_28_Supply; // 1 count equals 150 mV
uint8_t Volts_4_Digital_Supply; // 1 count equals 150 mV// Pressure Sensor Information
uint8_t Absolute_pressure_reading_from_MEMS[3];
uint16_t Temperature_reading_from_MEMS;
uint8_t Computed_altitude_based_on_pressure[3];// SSI Channel Information
T0_Plus_SSI_Timer_Channel_Information Channel_1;
T0_Plus_SSI_Timer_Channel_Information Channel_2;
T0_Plus_SSI_Timer_Channel_Information Channel_3;
T0_Plus_SSI_Timer_Channel_Information Channel_4;uint16_t Packet_CRC; // Big endian, poly = 0x1021, all bytes
} Status_Packet_T0_Plus;I’ll do the CRC check, voltage calculations, and endian swaps in the C driver BEFORE committing to the database.
The other input channels are mostly just dumping floating point data.
I’m going to write some code but I’ll be back.
September 4, 2024 at 11:41 am #15301MikhailModeratorRapid SCADA is written in C#, dotNet.
Probably, implementing the driver, including the above structure, in C# would be smoother.September 4, 2024 at 11:43 am #15302 -
AuthorPosts
- You must be logged in to reply to this topic.