🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Triangle wave generator in Activate

User: "Minoru Yubuchi_21921"
Altair Community Member
Updated by Minoru Yubuchi_21921

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.

Find more posts tagged with

Sort by:
1 - 6 of 61
    User: "João Marabisa"
    Altair Employee
    Updated by João Marabisa

    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

    User: "RoKet"
    Altair Employee
    Updated by RoKet

    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

    User: "Minoru Yubuchi_21921"
    Altair Community Member
    OP
    Updated by Minoru Yubuchi_21921

    João,

     

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

     

    Minoru

    User: "Minoru Yubuchi_21921"
    Altair Community Member
    OP
    Accepted Answer
    Updated by Minoru Yubuchi_21921

    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

    User: "Minoru Yubuchi_21921"
    Altair Community Member
    OP
    Updated by Minoru Yubuchi_21921

    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,

     

    User: "João Marabisa"
    Altair Employee
    Updated by João Marabisa

    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