FB_GseSvFunctionGeneratorClass

This function block implements a simple sine function test signal generator. The generated sample values can be used to simulate SV communication.
Namespace: Tc3_Gse
Library: Tc3_Gse (Tc3_Gse.compiled-library)
FUNCTION_BLOCK FB_GseSvFunctionGeneratorClass
VAR_OUTPUT
bValid : BOOL;
fSignal : LREAL;
nSmpRate : UINT;
nSample : UDINT;
END_VAR
Outputs
Name | Type | Description |
|---|---|---|
bValid | BOOL | This output is TRUE if the signal generator configuration is valid, and FALSE if one or more parameter values are invalid. Examples of invalid parameter values: nOversampleFactor = 0, fFrequency <= 0, nSpecifiedSmpRate = 0, or fCycleTimeCorrectionFactor <= 0. |
fSignal | LREAL | Returns the most recent signal sample value of the sine function generated by the method call. |
nSmpRate | UINT | Effective sampling rate. In sampling mode: ’AtSmpRateProPeriod‘ is the specified number of samples per period. In sampling mode: ’AtSmpRateProSecond’ is the specified number of samples per second. In sampling mode: 'AtPlcTaskCycleTime', this parameter value is not used, and the effective sampling rate is calculated based on the PLC task cycle time, the frequency, and the configured oversampling factor. |
nSample | UDINT | Sample value number. The value increments on each method call. The first sample has the number 0, and the last sample has the number nSmpRate – 1. When the nSmpRate call is made, the sample number overflows and returns to 0. |
Methods
Name | Description |
|---|---|
The method generates a new signal sample. In the signal sampling mode 'AtPlcTaskCycleTime', this method is normally called nOversampleFactor times in each PLC task cycle. | |
This method configures the function generator based on the selected signal sampling mode (eMode), the PLC cycle time, the PLC cycle time correction factor (fCycleTimeCorrectionFactor), the configured oversampling factor (nOversampleFactor), the configured sampling rate (nSpecifiedSmpRate), and the signal frequency (fFrequency). The Config method is automatically called internally whenever these configuration parameters are changed. | |
The method resets the initial value fSignal to 0 and the sample number nSample to 0. After this method call, the next call to the method generates the first sample value with the number 0 again. If the configuration parameters are changed, the reset method is automatically called internally by the config method. |
Properties
Name | Type | Access | Description |
|---|---|---|---|
eMode | Set | Signal sampling mode. Default value: 'AtPlcTaskCycleTime' => Sampling within the PLC task cycle. | |
fAmplitude | LREAL | Set | Sets the peak amplitude of the signal. For example, in V or A. Default value: 230 V * √2 => ~ 325 V. |
fCycleTimeCorrectionFactor | LREAL | Set | Sets the correction factor for the PLC task cycle time. Default value: 1.0 (no correction). Values <= 0 are invalid. |
fFrequency | LREAL | Set | Sets the signal frequency in Hz. Default value: 50.0 Hz. Values <= 0 are invalid. |
fOffset | LREAL | Set | Specifies the signal offset. Default value: 0 (no offset). |
fPhi | LREAL | Set | Sets the signal phase shift in degrees. Default value: 0°. |
nOversampleFactor | UINT(1..128) | Set | Sets the oversampling factor of the signal generator. The value 0 is invalid. Default value: 1 (no oversampling). In the UCA 61850-9-2LE configuration, an SV message from the MSVCB01 contains only one signal sample (no oversampling), and an SV message from the MSVCB02 contains eight signal samples (oversampling factor: 8). To generate 8 samples per PLC cycle, configure the oversampling factor to 8 for the MSVCB08 signal generator, for example, and to 1 for the MSVCB01 signal generator. The call method of MSVCB02 is called eight times per PLC cycle, and the call method of MSVCB01 is called once per PLC cycle. The cycle time of the PLC task then determines the effective sampling rate. |
nSpecifiedSmpRate | UINT | Set | The sampling rate specified for the sampling mode: ’AtSmpRatePerPeriod‘ or ‘AtSmpRatePerSecond’. Default value: 80. A value of 0 is invalid. In sampling mode: 'AtPlcTaskCycleTime', this parameter value is ignored and not used. |