Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Problem on generate SINE wave in GEN

Francis-JJ
2016-11-16
2016-11-16
  • Francis-JJ - 2016-11-16

    Dear 3S colleague:

    I have inquiry which related to function block named 'GEN' in 'Util.library'.

    I try to called the function block like as below,

    fb_Gen(
    Β  Β MODE:=sinus , 
    Β  Β BASE:=TRUE , 
    Β  Β PERIOD:=tFreq , 
    Β  Β CYCLES:= , 
    Β  Β AMPLITUDE:= 10000, 
    Β  Β RESET:= , 
    Β  Β OUT=> );
    

    After that I found the trace file was not so smooth, and every cycle are the same, please check the file I attached named '1.jpg'.
    Since I used this sine wave as master position, and I used an realo axis to follow this master, every cycle I can see the jerk and hear the noise.
    So I try to modify the parameter 'Base' to false, and it seems better, and I try to directly call the function 'sin' also can works well. the drives also can works fine without any noise.

    Could you help explain why this jerk will happened? Since I can't find more detailed information in help documentation. So your explaination will be very helpful to solved this issue and let me know more about this library.

    Thanks in advance!
    Hope you can have a nice day!

    BR
    Francis

    IMG: 1.jpg

     
  • josepmariarams - 2016-11-16

    It seems that if you use bade=true sin is calculated with the time in execution time. With base false uses the beguin cycle time( ncycles x cycletime).

    For me is better the second one. The output is updated syncronous with cycle.

     
  • Francis-JJ - 2016-11-16

    Josep M. Rams hat geschrieben:
    It seems that if you use bade=true sin is calculated with the time in execution time. With base false uses the beguin cycle time( ncycles x cycletime).
    For me is better the second one. The output is updated syncronous with cycle.

    Dear Josep,

    Thanks for your quick reply, I used the t#500ms in this application. I try to make cycle time faster, and make it to 1ms, and it's looks better.
    So this was cause by the time gap between the Task cycle time and parameter named 'Period'?

    Besides, I have a question when 'Base' was set to 'False', for example, my cycle time is 8ms, and I want it to generate the sine wave 1Hz frequency, so how I should calculate this 'Cycle'?

    Thanks in advance!

    BR
    Fancis

     
  • josepmariarams - 2016-11-16

    Francis.

    In principle the software would has ask the task about his cycletime and about the cyclenumber => time_i=cycletime x ncycles.

    I recomend to you to read oscat basic documentation is more clear.( Has this block)

    For your tests see too the drive cycle time and if the drive could interpolate his consign. If not the drive see an stair not a sinus curve

     
  • Francis-JJ - 2016-11-16

    Josep M. Rams hat geschrieben:
    Francis.
    In principle the software would has ask the task about his cycletime and about the cyclenumber => time_i=cycletime x ncycles.
    I recomend to you to read oscat basic documentation is more clear.( Has this block)
    For your tests see too the drive cycle time and if the drive could interpolate his consign. If not the drive see an stair not a sinus curve

    Dear Josep,

    Clear, many thanks.
    BTW, for this problem I already had the solution, And I tried to use the FB from OSCAT, and it also can works fine.
    I just curious why official FB from 3S had this kind of issue.

    BR
    Francis

     

Log in to post a comment.