[COLOR=#0000ff]FUNCTION_BLOCK [/COLOR] FB295
[COLOR=#0000ff]VAR_INPUT[/COLOR]
[COLOR=#999900]Amplitude:[/COLOR] [COLOR=#0000ff]REAL:[/COLOR] [COLOR=#999900]=[/COLOR] [COLOR=#FF00FF]1.0;[/COLOR] [COLOR=#999933]/ / input: output amplitude[/COLOR]
[COLOR=#999900]Period:[/COLOR] [COLOR=#0000ff]REAL:[/COLOR] [COLOR=#999900]=[/COLOR] [COLOR=#FF00FF]1.0;[/COLOR] [COLOR=#999933]/ / Input: Output period[/COLOR]
[COLOR=#999900]d_T:[/COLOR] [COLOR=#0000ff]REAL:[/COLOR] [COLOR=#999900]=[/COLOR] [COLOR=#FF00FF]0.1;[/COLOR] [COLOR=#999933]/ / Input: runtime[/COLOR]
[COLOR=#0000ff]END_VAR[/COLOR]
[COLOR=#0000ff]VAR[/COLOR]
[COLOR=#999900]X:[/COLOR] [COLOR=#0000ff]REAL:[/COLOR] [COLOR=#999900]=[/COLOR] [COLOR=#FF00FF]0.0;[/COLOR] [COLOR=#999933]/ / St.Perem.: The value argument[/COLOR]
[COLOR=#0000ff]END_VAR[/COLOR]
[COLOR=#0000ff]VAR_OUTPUT[/COLOR]
Out: [COLOR=#0000ff]REAL;[/COLOR] [COLOR=#999933]/ / output: the output[/COLOR]
[COLOR=#0000ff]END_VAR[/COLOR]
[COLOR=#0000ff]BEGIN[/COLOR]
[COLOR=#999933](*[/COLOR] [COLOR=#999933]
[/COLOR] [COLOR=#999933]Building the argument of SIN H.[/COLOR] [COLOR=#999933]
[/COLOR] [COLOR=#999933]*)[/COLOR] [COLOR=#999933]
[/COLOR] [COLOR=#0000ff]IF[/COLOR] [COLOR=#999900]X> =[/COLOR] Period [COLOR=#0000ff]THEN[/COLOR] [COLOR=#999900]X: =[/COLOR] [COLOR=#FF00FF]0.0;[/COLOR]
[COLOR=#0000ff]ELSE[/COLOR] [COLOR=#999900]X: =[/COLOR] X + d_T;
[COLOR=#0000ff]END_IF;[/COLOR]
[COLOR=#999933](*[/COLOR] [COLOR=#999933]
[/COLOR] [COLOR=#999933]Implementation of output in the form of a sinewave (formula y = A * sin (wt), where w = (2n / T), according to the predefined amplitude and period.[/COLOR] [COLOR=#999933]
[/COLOR] [COLOR=#999933]*)[/COLOR] [COLOR=#999933]
[/COLOR] [COLOR=#999900]Out: =[/COLOR] Amplitude [COLOR=#999900]*[/COLOR] [COLOR=#0000ff]SIN[/COLOR] [COLOR=#FF00FF](6.28[/COLOR] [COLOR=#999900]/[/COLOR] Period [COLOR=#999900]*[/COLOR] X);
[COLOR=#0000ff]END_FUNCTION_BLOCK[/COLOR]