Vai al contenuto

eTON does not clear on IN input deactivation

Home Forum Programmazione IEC 61131 (LogicLab) eTON does not clear on IN input deactivation

Stai visualizzando 5 post - dal 1 a 5 (di 5 totali)
  • Autore
    Post
  • #35961
    Gregory
    Partecipante

    eTON is acting like a retentive time by remembering ET from on/off/on activation of IN. Need a NON-RETENTIVE TIMER or eTON needs to be fixed to match documentation.

    #39427
    Sergio Bertana
    Amministratore del forum

    The behaviour of eTON is been treated in this topic, unfortunately is an Italian topic. The eTON Q output works according the On-delay (TON) timing IEC-61131 raccomandation (Here the logic diagram) the only difference is in the ET output that it’s not reset, but the time is not remembered at the new IN activation. When the IN is been deactivated it stops the count (ET remains at its value) but when the IN is activated again the ET is reset and starts to count from 0. Here the eTON FB source code, on red the modify to be written to match the IEC raccomandation.

    (* If the IN is not active resets the ouput and save time. *)

    IF NOT(IN) THEN
      ET:=0; (* Executing time (mS) to be inserted to exactly match the IEC raccomandation *)
      TimeBf:=SysTime; (* Time buffer *)
      Q:=FALSE; (* Delayed output *)
      RETURN;
    END_IF;

    (* IN active, and if Q is active checks if PT is greather than ET and resets Q. *)

    IF (Q) THEN
      IF (PT > ET) THEN Q:=FALSE; END_IF;
      RETURN;
    END_IF;

    (* Checks if time is been elapsed. *)

    ET:=SysTime-TimeBf; (* Executing time (mS) *)
    IF (ET >= PT) THEN
      Q:=TRUE; (* Delayed output *)
      ET:=PT; (* Executing time (mS) *)
    END_IF;

    To help you, here the print of a sample project with the eTON source code, so you can modify it according the IEC raccomandations.

    #39428
    Sergio Bertana
    Amministratore del forum

    The new eLLabStdLib_B200 library with the eTON FB modified according the IEC raccomandations is available for the download from the LogicLab page.

    #39430
    Gregory
    Partecipante

    Thanks for your quick response and solution.

    Where can I find documentation for internal functions such as SysTime?  I thought I had seen this documentation somewhere (in Italian) but I can’t seem to find it anywhere now.

    #39431
    Sergio Bertana
    Amministratore del forum

    The forum has been created to support customers in using our products and we try to give our best effort in quickly answer.

    About the SysTime it is a global variable, there are many others global variables, are all explained in the IEC 61131-3 programming Manual (Refer to the chapter 4, System variables).

    Shortly, the SysTime is a UDINT variable that automatically increment each 1 mS, reached the maximum the value is reinitialized. Comparing its actual value with a saved value, it’s possible to generate or measure delay times. If more precision is required the SysGetSysTime, get system time function must be used. It returns a UDINT variable that automatically increment each 1 uS, reached the maximum the value is reinitialized. Here a sample program that calculates the time the Di00 on CPU module remains active.

      IF (%IX255.0 <> Pulse) THEN
        Pulse:=%IX255.0; (* Input pulse *)

        IF (Pulse) THEN
          TimeBf:=SysGetSysTime(TRUE); (* Time reference (uS) *)
        ELSE
          OnTimeCalc:=SysGetSysTime(TRUE)-TimeBf; (* On time calculation (uS) *)
        END_IF;
      END_IF;

    Here the InputOnTime project printout and project download.

Stai visualizzando 5 post - dal 1 a 5 (di 5 totali)
  • Devi essere connesso per rispondere a questo topic.