Com Ports ?

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #9627
    Rich Ex
    Participant

    Hi All

    Is it possible for RapidScada to read data from a com port connected to the PC that is running RapidScada .

    I have an old device that sends a stream of ASCII characters over the com port every 5 minutes and I want capture these with my RapidScada .

    The stream is like 10/10/21 10:18 21.2 23.4 5 18 20 ( it sends date time and some measurements )

    I know its not a SCADA format but any thoughts please .

    Thanks as always
    Rich

    #9630
    Mikhail
    Moderator

    Hi,

    Rapid SCADA supports COM ports. But you also need a driver (dll) for Communicator that implements recognizing the data in a particular format. It’s possible to develop such driver.

    #9635
    Rich Ex
    Participant

    Hi Mikhail,
    Thank you for the information .

    Is there an existing example to give me an idea of where to start will a dll for the COM port .

    Thanks
    Richard

    #9637
    Mikhail
    Moderator

    Hi,

    Please check the driver development article and the existing driver as an example (link 1, link 2).

    #9640
    Rich Ex
    Participant

    Mikhail ,
    Thats brilliant thank you .

    I have written a stand alone program that now gets the RS232 data from the device and writes it into a text file like ‘mydata.txt’, its simple the text file just shows a single number like 22.3

    Could I not just write a formula to read this ‘mydata.txt’ file into RapidScada and then return this number from the file or am I going about it the wrong way?

    Maybe theres a driver to read a .txt file already ?

    Thanks
    Rich

    #9641
    kumajaya
    Participant

    If I was in your situation, since I have Mqtt broker (Mosquitto) and Node-RED installed:
    Solution 1: Use python to read serial data and push it to Mqtt broker, RS as Mqtt client
    Solution 2: Use Node-RED to read serial data and also set it as OPCUA server, RS as OPCUA client

    #9642
    manjey73
    Participant

    @rich-ex I have a driver for reading 1Wire temperature sensors on a Raspberry Pi. I didn’t manage to process 1Wire directly, so I had to write the value to txt through crontab and then process this txt from the driver. If this option is suitable, I can give you the source code of the driver.

    #9644
    Mikhail
    Moderator

    Hi,

    and writes it into a text file like ‘mydata.txt’, its simple the text file just shows a single number like 22.3

    Could I not just write a formula to read this ‘mydata.txt’ file into RapidScada and then return this number from the file

    This is not optimal, however, it’s possible if the file contains only 1 number.

    Create a formula and use it for an input channel of the Calculated real type.

    #9645
    Mikhail
    Moderator

    The formula would be something like:

    double ReadNum()
    {
      try
      {
        string s = System.IO.File.ReadAllText(@"C:\mydata.txt");
        double val;
        return double.TryParse(s, out val) ? val : -1;
      }
      catch
      {
        return -2;
      }
    }
    • This reply was modified 7 months, 3 weeks ago by Mikhail.
    • This reply was modified 7 months, 3 weeks ago by Mikhail.
    #9651
    Rich Ex
    Participant

    Mikhail , manjey73 , kumajaya .

    Thanks very much for you great suggestions . I will have a go and see how I get on with the different solutions … what a great forum this is ..

    Kind Regards , Rich

    #9654
    Rich Ex
    Participant

    @manjay73

    Yes if you could copy your driver and paste it here that would be very interesting .
    Thanks
    Rich

    #9655
    manjey73
    Participant

    https://cloud.mail.ru/public/rZdp/o5aELSXvM

    Sensor IDs are added to the text file, and the script reads them using crontab. The driver polls the specified file and outputs a list of channels. In some places, comments in Russian may not be reflected in you.

    #9657
    Rich Ex
    Participant

    Mikhail ,
    You said “Rapid SCADA supports COM ports. But you also need a driver (dll) ”
    So would device type be ‘ACC-RS232’ , I am struggling to find any documentation on the setting up of the device types .

    Sorry to be a pain but my system so far is all Scada driven which I understand , the RS232 device is turning into a pain !!

    Thanks
    Rich

    #9658
    Mikhail
    Moderator

    Hi Rich,

    RS-232 is just a communication interface. The most important is how data is encoded when transmitted.

    Do you successfully write values to a text file?
    Does the above formula to retrieve data from text file work?

    #9660
    Rich Ex
    Participant

    Hi Mikhail ,

    Yes I can write my data to a text file no problem .
    I have a compiled a .exe file to do this now .

    I have not tried your formula yet , I don’t want to put it onto my live system incase I have issues as we use it our factory to monitor many devices .
    I will have to build Rapid Scada on another machine to use as a “test rig” i think .
    I will let you know .

    Thanks
    Richard

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