Problem in Sending Modbus (Command) Float32 data

Forum Home Forums Communicating with Devices Modbus Problem in Sending Modbus (Command) Float32 data

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #2294
    raazsi
    Participant

    Thanks, Manjey n Mikhail… It really helped. Now that I got to know that we can write our own script in RapidScada. It’s really helpful.

    Meanwhile, i tried a bit on my own for generating reset output. I wrote a script wherein, the output is 1 for a specified duration and then it gets to zero. But I am facing a difficulty.

    The input parameter for the function is a coil channel read via Modbus from the Modbus device. Is there any way to set the values of output/Input channel dynamically through a code??? I tried with CnlValSet(Int Cnl, Double Value) & SetVal(Int Cnl, Double Value) But I am getting an error with it…

    Line 496, column 1: error CS0103: The name ‘CnlValSet’ does not exist in the current context

    Below is the snippet of the code I am using. The algorithm which I intend to use is that if the value of coil register is 1, then the function will return value of 1 for 5 seconds and then it will return zero. Then I’ll make the value of coil register to zero inside the function itself to reset it.

    bool Getreset (bool a,int InCnl )
    {
    // bool a is the value of coil register

    int result;
    DateTime now = DateTime.Now;
    DateTime now2 = now.AddSeconds(5);
    if (a==Convert.ToBoolean(1))
    {
    do
    {
    result = DateTime.Compare(DateTime.Now, now2);
    if (result < 0)
    return (Convert.ToBoolean(1));
    else
    return (Convert.ToBoolean(0));
    } while (result < 0);
    return (Convert.ToBoolean(0));
    CnlValSet(Incnl,0);
    }
    else
    {
    return(a);
    }
    }

    #2296
    Mikhail
    Moderator

    You should use SetVal or SetData according to http://doc.rapidscada.net/content/en/software-configuration/using-formulas.html
    There is no function named CnlValSet unless you define it by yourself.

    #14751
    Octavio F
    Participant

    Hello

    great interaction that have helped me a lot.

    i have a similar issue, trying to read uint32 type of data.

    | 39 | EPAImp | EPAImp | 200000h | 2000 |

    Tha value 200000h should be 239.6

    Thanks for helping

    #14752
    manjey73
    Participant

    @octavio-f I use this converter to determine the permutation

    https://www.scadacore.com/tools/programming-calculators/online-hex-converter/

    See Float – Mid-Big Endian (BADC) In theory, you need to specify a byte permutation for your case = 1032

    #14753
    manjey73
    Participant

    And possibly with subsequent multiplication by 100 in the Cnl*100 channel formula

    #14768
    Octavio F
    Participant

    Hello

    thanks for the response.

    Let me try to be more specific

    The Device sends UInt32, but Rapid Scada wont read it, but with ModbusPoll, i can read it without problem.

    The things is how can i configure the template in rapid scada to get the actual value of the reading.

    thanks again!

    #14771
    Mikhail
    Moderator

    Hello,
    What data packet do you receive?
    Please provide screenshots and logs.

Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.