TOF
Timer Off Delay
Libraries:
Description
The TOF block implements the TOF ladder logic
      instruction. When the rung conditions are true, the block accumulates time until: 
- The timer is disabled 
- The timer completes 
Ports
Input
Controls the execution of the block. EnableIn reflects the rung state preceding the block. If the rung state preceding the block is false, EnableIn is false, the block does not execute and the outputs are not updated.
Output
By default, EnableOut follows the state of EnableIn. If the EnableIn input to the block is false, the logic implemented by the block is not executed and EnableOut signal is set to false.
Parameters
Specify the timer parameters in the format of tags. In Ladder
            Diagrams, tags (variables) are used to represent inputs, outputs, and internal memory
            with attributes such as Data Type, Initial Value,
            and size. To change the attributes of the Operand
              Tag, open the Program Variables table within the
              Ladder Diagram Program block. The Data Type of the
            timer tag is of the Bus:TIMER type with its initial value specified
            as a structure containing the following fields:
| Field | Description | Default Value | 
|---|---|---|
| PRE | The preset value specifies the value (1 millisecond units) which the accumulated value must reach before the instruction indicates it is done | 0 | 
| ACC | The accumulated value specifies the number of milliseconds that
                        have elapsed since the  | 0 | 
| EN | The enable bit contains rung-condition-in when the instruction was last executed. | 0 | 
| TT | The timing bit when set indicates the timing operation is in process. | 0 | 
| DN | The done bit when set indicates the timing operation is complete (or paused). | 0 | 
Programmatic Use
| Block Parameter: PLCOperandTag | 
| Type: character vector | 
| Value: character vector | 
| Default: 'T' | 
More About
When setting the fields in the Timer Tag parameter,
            you must set the timer preset value, PRE, in milliseconds. When the
            value of the timer accumulated value field, ACC, equals the preset
            value, the block sets the DN bit to 1 for the
                TON and RTO blocks and 0 for the
                TOF block.
Before you set the timer preset values:
- Load the built-in timer data types by using the - plcloadtypesfunction. At the MATLAB® command line, enter:- plcloadtypes 
- Open the ladder diagram block library. At the MATLAB command line, enter: - plcladderlib 
- Select a PLC Controller Suite block and add it to your model. Navigate to the ladder diagram program by double-clicking PLC Controller Suite > Task > Program. Alternatively, you can: - Add a JSR (RTN) Subroutine block and navigate to the ladder diagram program block by double-clicking JSR (RTN) Subroutine > Routine Logic. 
- Add a Function Block (AOI) block and navigate to the ladder diagram program block by double-clicking Function Block (AOI) > Logic Routine. 
 
- Add a TON, TOF, or RTO block to the ladder diagram program. Double-click the TON, TOF, or RTO block and enter a name. For example, name your block as - T1.
- When you add a TON, TOF, or RTO block, Simulink® PLC Coder™ creates the associated timer structure and names your structure as - TimerName_InitialValue. For example, if your timer block name is- T1, the structure name is- T1_InitialValue.
To set the timer preset values you can:
- Assign the timer preset values at the MATLAB command line. For example, if your block names are - T1,- T2, and- T3, at the MATLAB command line, enter:- T1_InitialValue = FB_TON.InitialValue; T1_InitialValue.PRE = 5000; T2_InitialValue = FB_TOF.InitialValue; T2_InitialValue.PRE = 5000; T3_InitialValue = FB_RTO.InitialValue; T3_InitialValue.PRE = 5000; 
- Use a MATLAB script that executes when the model loads. For example, if your block names are - T1,- T2, and- T3, in the- InitFcnmodel callback property, enter:- T1_InitialValue = FB_TON.InitialValue; T1_InitialValue.PRE = 5000; T2_InitialValue = FB_TOF.InitialValue; T2_InitialValue.PRE = 5000; T3_InitialValue = FB_RTO.InitialValue; T3_InitialValue.PRE = 5000; 
- Set the timer preset values by using a MATLAB script file. You must first create a script file and then call the script file in the - LoadFcnmodel callback. For example, create a script file called- mytimerpresets. In this script file, enter:- T1_InitialValue = FB_TON.InitialValue; T1_InitialValue.PRE = 5000; T2_InitialValue = FB_TOF.InitialValue; T2_InitialValue.PRE = 5000; T3_InitialValue = FB_RTO.InitialValue; T3_InitialValue.PRE = 5000; - To programmaticaly assign the - mytimerpresetsscript file to the- LoadFcncallback, at the MATLAB command line, enter:- set_param(gcb,'LoadFcn',mytimerpresets);
Version History
Introduced in R2019a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
