Triangle wave generator in Activate

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
-
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
0
Answers
-
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.
0 -
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
0 -
João,
Thank you so much! I got that the wave can be generated by integrating a pulse wave.
Minoru
0 -
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
0 -
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:
but if a RampSaturate block used instead of the Constant block, its result becomes strange as seen below:
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,
0 -
Minoru Yubuchi_21921 said:
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:
but if a RampSaturate block used instead of the Constant block, its result becomes strange as seen below:
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:
0