Sine wave generator
Block name
B3_SINUS_GENERATOR
ST call
PROGRAM B3_TEST VAR O1,O2: REAL; FB: LIB.CORE.V1_1.B3_SINUS_GENERATOR:= (T:= T#10S, MINIMUM:= -10, MAXIMUM:= 10); END_VAR FB(OUT => O1, TRES => O2); END_PROGRAM
Library
LIB\CORE
Version
V1.1
Description
The block generates a sine signal at which period, and minimum and maximum values can be set. Remaining time until end of the period is also indicated at the output.
Version V1.1
Correction of a combination of short cycles and long periods (eg cycle 1 ms and period 60 s). The generator did not hold time base and generated incorrect timing.
Inputs
Input | Type | Description | Default value |
ENABLE | BOOL | Block function enable | True |
T | TIME | Output signal period | 5s |
MINIMUM | REAL | Minimum value (low peak) of the output signal | 0 |
MAXIMUM | REAL | Maximum value (high peak) of the output signal | 1 |
PAUSING | BOOL | Behaviour when Disabled | True |
Outputs
Output | Type | Description |
OUT | REAL | Output sine signal |
TRES | TIME | Time remaining until the end of the period |
Function
The output signal OUT provides a sine wave signal with period of T a and lower/upper peaks MINIMUM and MAXIMUM respectively. There is a Tres signal which is time remaining until the end of the period T, see figure below. The block has a Boolean input ENABLE, which stops the generator (stopped: ENABLE: = false). The behavior after the block has been stopped depends on the PAUSING parameter (see figure below):
- PAUSING=FALSE and ENABLE=FALSE: the output OUT is set to MINIMUM + MAXIMUM / 2. As soon as ENABLE goes to TRUE, the period time starts from the beginning.
- PAUSING=TRUE and ENABLE=FALSE: the output OUT is frozen. As soon as ENABLE goes to TRUE, the sine wave continues from where it has been stopped.