RobotStudio event

Handle LOTS of signals

Options
Hi!
I'm facing this situation: i want to be able to set specific virtual signals without huge TEST-CASE structures.

I'll try yo explain this better:
I'm receiving from an external source (e.g. the flexpendant or an external software via socket) the number of the signal i want to change. In order to maintain this structure flexible i want to manage something like 1000 signals equally divided in input and output ones.
Now, the number i received has to correspond to a specific signal. I would like to identify this signal without using a huge test-case structure. Is it possible in any ways? The name or the label of the signals are not important for my purpose.

Thanks,
Matteo

Comments

  • soup
    soup ✭✭✭
    Options
    Interesting problem. Never done it in production, but making a string from the number then aliasing to that output seems to work in a virtual test.

        PROC SignalNameFromNum()

            !made virtual digital outputs = "do_61", "do_62", "do_63"
            VAR signaldo aliasOutput;
            VAR num signalNumber;
            VAR string SignalName;
           
            signalNumber:=62;
            SignalName:="do_"+NumToStr(signalNumber,0);
            AliasIO SignalName, aliasOutput;
           
            SetDO aliasOutput, 1;

        ENDPROC

  • Boteon
    Options
    Wow, brilliant solution! I didn't consider AliasIO because i thought it would accept only Signado variables. I'll try it. Thanks!!