Scheduled Cicode

Hi;

I want a function in Cicode to run continuously for a time period that I set. For example, the code I wrote will run every 20sec in the background . How do I make this application?

I am using Power Scada Operation to develop my project.

The function will be as follows;

/////////////////////////////////////////////////////////////
FUNCTION
Schedule()
INT nIntTagValue;
WHILE 1 DO
nIntTagValue = TagRead("VALUE");
nIntTagValue = (nIntTagValue/2) * 3;
TagWrite("VALUE_CALC", nIntTagValue);
END
END
/////////////////////////////////////////////////////////////

Thank you for your reply.

Parents
  • Firstly, you can't use blocking code in background tasks, for example, TagWrite is a blocking function (the help will tell you if a function is blocking). You'll need to replace that with simply Value_calc = value. TagRead is blocking as well in certain modes.

    To schedule cicode, you can use either an event or a report. You can configure an event to run on servers or clients, but an event will run anywhere it's configured to run, and won't care about redundancy. In order to configure a redundant task that will run only on the primary in a redundant system, and run on the stnabdy only if there s no access to the primary, then you should setup a report. The report file should contain the cicode to run.
    Eg
    {CICODE}
    Schedule()
    {END}

    Read up in the help about the report file format for more details
Reply
  • Firstly, you can't use blocking code in background tasks, for example, TagWrite is a blocking function (the help will tell you if a function is blocking). You'll need to replace that with simply Value_calc = value. TagRead is blocking as well in certain modes.

    To schedule cicode, you can use either an event or a report. You can configure an event to run on servers or clients, but an event will run anywhere it's configured to run, and won't care about redundancy. In order to configure a redundant task that will run only on the primary in a redundant system, and run on the stnabdy only if there s no access to the primary, then you should setup a report. The report file should contain the cicode to run.
    Eg
    {CICODE}
    Schedule()
    {END}

    Read up in the help about the report file format for more details
Children
No Data