How best to proceed?

Forum Home Forums Development and Integration How best to proceed?

Tagged: , , ,

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #15269
    johnkay
    Participant

    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,

    #15271
    manjey73
    Participant

    How do you receive data via the COM port?

    #15275
    Mikhail
    Moderator

    Hi,
    Could you provide an example of a data packet or protocol description?

    #15278
    johnkay
    Participant

    It’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 database

    I’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.

    #15279
    manjey73
    Participant

    C# 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.

    #15280
    manjey73
    Participant

    Here 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.
    #15284
    Mikhail
    Moderator

    I 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.

    #15285
    Mikhail
    Moderator

    How many data points you need to collect per minute or second?

    #15286
    johnkay
    Participant

    ** 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 Header

    uint8_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.

    #15301
    Mikhail
    Moderator

    Rapid SCADA is written in C#, dotNet.
    Probably, implementing the driver, including the above structure, in C# would be smoother.

    #15302
    Mikhail
    Moderator

    C# struct layout article may be useful.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.