Triangle wave generator in Activate

Minoru Yubuchi_21921
Minoru Yubuchi_21921 Altair Community Member
edited March 2023 in Community Q&A

Are there any ways to generate triangle wave in Activate? I know the Signal Generators library contains Sawtooth block but I cannot find any triangle wave generators.  I want to use it to generate PWM for an electric circuit.

Best Answer

  • Minoru Yubuchi_21921
    Minoru Yubuchi_21921 Altair Community Member
    edited March 2023 Answer ✓

    Ronald,

     

    Thank you so much for your support. I originally used a sawtooth wave but its result didn't look correct PWM wave and so I asked this question.

     

    Minoru

Answers

  • João Marabisa
    João Marabisa
    Altair Employee
    edited September 2022

    Hi Minoru-san,

    There is not a direct block for that, but you can easily generate Triangle wave form using some of the native blocks on Activate. I'm attaching a model that reproduce what you want.

    image

  • RoKet
    RoKet
    Altair Employee
    edited September 2022

    Hi Yubuchi-san,

    I don't know exactly your application, but a PWM can be modelled easily with a sawtooth signal. The attached model shows an example.

    Regards

  • Minoru Yubuchi_21921
    Minoru Yubuchi_21921 Altair Community Member
    edited September 2022

    João,

     

    Thank you so much! I got that the wave can be generated by integrating a pulse wave.

     

    Minoru

  • Minoru Yubuchi_21921
    Minoru Yubuchi_21921 Altair Community Member
    edited March 2023 Answer ✓

    Ronald,

     

    Thank you so much for your support. I originally used a sawtooth wave but its result didn't look correct PWM wave and so I asked this question.

     

    Minoru

  • Minoru Yubuchi_21921
    Minoru Yubuchi_21921 Altair Community Member
    edited September 2022

    João,

     

    I used MathExpression block to generate triangle wave directly as you see in the attached Activate model. Its expression used in the block is as follows:

     

    (rem(tm,1/f)<=1/(2*f))*(2*f*rem(tm,1/f))+(rem(tm,1/f)>1/(2*f))*(-2*f*rem(tm,1/(2*f))+1)

     

    where the tm is time and f is frequency. Its results when input frequency is constant looks correct as follows:

     

    image

    but if a RampSaturate block used instead of the Constant block, its result becomes strange as seen below:

    image

    That is, the first line is not linear and the part of 8-10 sec has strange frequency.

     

    I don't know if I can ask you such a support, but if you have any advice, please let me know.

     

    Regards,

     

  • João Marabisa
    João Marabisa
    Altair Employee
    edited September 2022

    João,

     

    I used MathExpression block to generate triangle wave directly as you see in the attached Activate model. Its expression used in the block is as follows:

     

    (rem(tm,1/f)<=1/(2*f))*(2*f*rem(tm,1/f))+(rem(tm,1/f)>1/(2*f))*(-2*f*rem(tm,1/(2*f))+1)

     

    where the tm is time and f is frequency. Its results when input frequency is constant looks correct as follows:

     

    image

    but if a RampSaturate block used instead of the Constant block, its result becomes strange as seen below:

    image

    That is, the first line is not linear and the part of 8-10 sec has strange frequency.

     

    I don't know if I can ask you such a support, but if you have any advice, please let me know.

     

    Regards,

     

    Hi Minoru-san,

    Regarding the beginning: I think this is due to not starting with a constant value. Give a try increasing the "Output = offset for time <startTime" and see that you'll have a linear output:

    Regarding the end: It looks good. Your final frequency is equal to "2", if you see the period, it's 0.5 sec (P = 1/f), so it's expected.

    Example below:

    image