LGF_SawTooth (FB / V3.0.1)


Author: Siemens Digital Industries

Short description

This function generates a sawtooth-shaped signal profile. Each sawtooth consists of a defined number of steps (increments).

NOTE
LEGACY FUNCTION
Please update and use the FB with the same name LGF_CountRisInDWord in the future!
This function is no longer maintained!

Block Interface

LGF_SawTooth (FB)
Int  startValue value  Int
    
Time  timeRange   
    
Int  incrementRange   
    
Int  numberSteps   
    
Bool  endlessSteps   
    
Bool  reset   
    
   

Input parameter

IdentifierData typeDefault valueDescription
startValueInt0Start value at which the signal begins.
timeRangeTimeT#0sTime after which the output parameter `value` is incremented
incrementRangeInt0Size of the jump from one increment to the next.
numberStepsInt0Number of increments per sawtooth. (In the case of an endless sawtooth signal, this information is not necessary).
endlessStepsBoolFALSESpecifies whether an endless sawtooth signal will be generated.
`TRUE` - Activated, `FALSE` - Disabled
resetBoolFALSESawtooth starts again at the start value, `startValue`.

Output parameter

IdentifierData typeDescription
valueIntCurrent value of the sawtooth signal.

Functional description

NOTE
Please note that changes at the input parameters only become effective with reset.

The block calculates the values for a sawtooth-shaped signal profile, which is output to the output parameter value. The signal begins with the start value startValue and is added with the value increment after each elapse of the time interval timeRange. The value can also be negative.

If the variable endlessSteps is set to FALSE, the number of add operations is counted. If this exceeds the value numberSteps, the output parameter value is set back to the start value. A new sawtooth begins.

If the variable endlessSteps is set to TRUE, the value increment is added without interruption, starting once at startValue. If the maximum positive INT value range (32767) of the output parameter value is exceeded, value changes to the maximum negative INT value range (-32768) and will continue to be added up.


NOTE
The duration of a sawtooth at endlessSteps on FALSE is calculated as follows:
Duration = #timeRange * (#numberSteps + 1)

LGF_SawTooth - Signal profile of the output value

Change log

Version & DateChange description
01.00.00Siemens Industry Online Support
19.08.2015First released version
01.00.01Siemens Industry Online Support
02.11.2015Bug fix
01.00.02Siemens Industry Online Support
02.01.2017Upgrade: TIA Portal V14 Update 1
01.00.03Siemens Industry Online Support
17.08.2018Upgrade: TIA V15 Update 2
01.00.04Siemens Industry Online Support
23.11.2018Upgrade: TIA V15.1
01.00.10Simatic Systems Support
23.09.2019Code refactoring, regions and more comments added
03.00.01Simatic Systems Support
15.02.2021Insert documentation