I want to display text from decimal numbers.

Forum Home Forums Uncategorized Issues I want to display text from decimal numbers.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #15352
    sab
    Participant

    Hello,
    I am currently using Rapid SCADA version 5.
    I am importing data as decimal numbers through Modbus TCP.
    How can I convert those numbers into text and display them in the scheme view?

    #15368
    Mikhail
    Moderator

    Hello,
    Channel values are converted to strings automatically when displayed. If you face displaying issues, please provide screenshots.

    #15397
    sab
    Participant
    #15398
    sab
    Participant

    I want to display text from decimal numbers, but I don’t know where I made a mistake. Could you please guide me?

    #15407
    manjey73
    Participant

    Do you want to have 8 channels with a number display 111, 114, 98, 111, 108, 108, 101 and 72 ?
    5th version does not support arrays. You will have to get everything into the input channel in double, then make 8 calculation channels and write a script that will pull out the required from the total “number” either in the form of strings or in the form of numbers.

    #15417
    sab
    Participant

    Hello manjey73

    Do you have a sample script to extract the required data from the “number”?

    • This reply was modified 1 month ago by sab.
    #15420
    manjey73
    Participant

    Well, do you want exactly what I assumed?

    #15421
    manjey73
    Participant
    public double GetByte(double val, int n)
    {
        UInt64 uintVal = (UInt64)val;
        return (uintVal >> (n * 8)) & 0xFF;
    }

    I’m not sure if this will work correctly. I’ll try to check in VisualStudio

    #15422
    manjey73
    Participant
    public double GetByte1(int num, int bytenum)
    {
    byte[] mass = BitConverter.GetBytes(Val(num));
    if (bytenum >= 0 && bytenum <= 7)
    {
        return Convert.ToDouble(mass[bytenum]);
    }
    else return double.NaN;
    }

    This formula will probably be more correct with your values

    #15423
    manjey73
    Participant
    #15424
    manjey73
    Participant

    This is a test of the second formula.
    You need to create 8 calculation channels and specify in the formula which channel to take data from and which byte to take.
    GetByte1(105, 6) is an example to take the 6th byte. The value can be from 0 to 7

    #15428
    Mikhail
    Moderator

    Do you use MQTT or Modbus protocol?
    Could you make a screenshot of a device data page from Communicator?

    #15475
    sab
    Participant

    I am using Node-RED to send Modbus TCP data to Rapid SCADA.
    https://ibb.co/zn2G3fG
    https://ibb.co/17VGh2S
    https://ibb.co/0Gj1LkW
    Is this what you were asking about?

    #15478
    Mikhail
    Moderator

    Data polling seems OK.

    I recommend:
    1. Use Rapid SCADA 6, because Rapid SCADA 5 is outdated.
    2. Provide names for the elements in the Modbus template.
    3. Create a simple table view to check data displaying. Then create a scheme view.

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