Setting multiple channels at once.

Forum Home Forums Understanding the Software Formulas Setting multiple channels at once.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #17874
    oley
    Participant

    Hi,

    I have an object with 34 devices.
    In RapidSCADA, I have a communication line with 34 modbus devices, each with addresses 1 through 34. I need to control the power, and for each device this involves setting a percentage value in a specific register and then acknowledging it in another register.

    Two questions: Will RapidSCADA work with broadcast address 0?
    I tried with a device at address 0, but I’m getting connection errors.

    The second approach is a calculated channel. I tried with the following script:

    
    public double SetPowerAll()
    {
        double value = Val;
    
        // Inverter loop 801–834
        for (int dev = 801; dev <= 834; dev++)
        {
            int cnlEnable  = dev * 1000 + 205; // xxx205
            int cnlPercent = dev * 1000 + 204; // xxx204
    
            // 1. Reset
            SetVal(cnlEnable, 0);
    
            // 2. Set percent
            SetVal(cnlPercent, value);
    
            // 3. Ack
            SetVal(cnlEnable, 1);
        }
    
        return value;
    }
    

    This doesn’t work either: I expected the same value on all channels.
    Do I need to set some delays here?

    #17875
    manjey73
    Participant

    Scripts can’t transfer data to devices. It is only possible to transfer to the device via the AutoControl Module, which can be configured to work in channels.

    I can’t tell you about the broadcast address, probably not than yes. This should be built into the driver and is not so easy to implement (I did this on one device, but not Modbus)

    #17879
    Mikhail
    Moderator

    Hi,

    The formula looks incorrect. It should return a double value or byte array, and used as an output formula of the channel. SetVal and SetData are used to set channel value, not for sending commands.
    To use address 0, there should be a separate device. Try sending commands by the Administrator app to that device, and control the results in communication line log.

    #17880
    oley
    Participant

    Hi,

    it works indeed with broadcast address 0 on separate device and without polling (only on command).
    Now I do not need the loop, but unfortunately the device need this acknowledgment on separate channel.
    What do you mean with “The formula looks incorrect. It should return a double value or byte array”? SetPowerAll() is used as an output formula. I will try it for one pair of channels.

    #17882
    oley
    Participant

    I put this as output formula:

    public double SetPowerAll()
    {
        double value = CmdVal;
    
        SetData(800205, 0, 1);
        SetData(800204, value, 1);
        SetData(800205, 1, 1);
    
        return value;
    }
    

    and it does not work.

    #17883
    Mikhail
    Moderator

    I suppose, SetData should not be there.
    An output formula just returns a command value that is passed to Communicator.

    #17884
    Mikhail
    Moderator

    // 1. Reset
    // 2. Set percent
    // 3. Ack

    If you need to send 3 values to the device by a single command, definitely you need Auto Control Module. It splits an initial command into 3 commands.

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