LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate triangular signal with ramp signal.

Hi, I want to solve the following problem, but I would like to generate the signal without using predestined blocks. I need 2 parameters that can be modified:
T - signal period; (road sign)
h - signal height; (control)
Te - sampling period; (control)
And as an indication of this the problem is: Consider the signal period to be an integer number of sampling periods T = n x Te. Thus n becomes an input parameter that will have to be read from the graphic interface (control), based on which T is calculated.

I would like a ramp to be generated up to a certain height "h" set by me, and when it reaches that height to go back to 0 with the reverse slope.

mihairusu11yahoocom_0-1703089106566.png

 

0 Kudos
Message 1 of 18
(2,471 Views)

Seems easy enough! What have you tried and where did you get stuck?

 

What is a "road sign"? (Do you mean "indicator:?

 

Your number of inputs is confusing, because there seem to be more than two based on the description: n, Te, h.

Is Te an integer? Even or odd?

0 Kudos
Message 2 of 18
(2,458 Views)

Yes, is indicator and Te it's the sampling time and it is U32 type.

0 Kudos
Message 3 of 18
(2,439 Views)

You said no "predestined blocks" (we usually call them primitives 😉), yet you want to use a ramp signal.  Does that mean you can use the Ramp Pattern.vi?

 

Either way, you did not tell us how you want to store the signal.  Arrays, clusters or waveforms are all possible. 

 

The simplest way is to build an array of increasing numbers based on your two parameters.  Then use Reverse Array.vi to concatenate those two together for one cycle.  Then, you can concatenate the desired number of cycles together to create your full signal.  (Hint: Words in bold are VIs you can use)

 

This is obviously homework, so we won't just code a solution for you.  Try out some ideas and post questions if you get stuck...

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 4 of 18
(2,411 Views)

Hi mihairusu,

 


mihairusu11@yahoo.com wrote:

Consider the signal period to be an integer number of sampling periods T = n x Te. Thus n becomes an input parameter that will have to be read from the graphic interface (control), based on which T is calculated.

I would like a ramp to be generated up to a certain height "h" set by me, and when it reaches that height to go back to 0 with the reverse slope.


  • You know the duration of one signal period: T = n × Te.
  • You know the duration of the rising and falling ramps: T/2 = n/2 × Te.
  • You know the parameter "n" describes the number of samples per signal period.
  • You know there are n/2 samples to ramp up and n/2 samples to ramp down.
  • You know the start and end of each ramp (0, h).
  • You (probably) know the simple linear equation: y = a × x + b.
  • Now all you need to do is to replace "x" by the values from 0 to n/2, a&b by correct values determined by h and n/2 to calculate the ramps…

What have you tried so far and where are you stuck?

Mind to attach your VI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 18
(2,386 Views)

I can't use already prefabricated blocks, I need them to be at the basic level, that is, to be a formula for calculating the slope, the ramp signal. I have to do everything from 0 as if I didn't have those blocks.

0 Kudos
Message 6 of 18
(2,359 Views)

Hi mihairusu,

 


mihairusu11@yahoo.com wrote:

I can't use already prefabricated blocks, I need them to be at the basic level,


And what's wrong with my description?

 

What have you tried so far?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 18
(2,357 Views)

I don't know how to do this, I can attach a .vi in which all the signals are made, namely, sinusoidal signal, ramp and step. From that .vi, I would be interested in the ramp signal, but I don't know how to modify it to display what I want. Please help me.

0 Kudos
Message 8 of 18
(2,356 Views)

If you are looking to create a ramp, then use the following:

  • Positive Ramp ==> y = mx + b (where b is the offset set to 0 originally; therefore, y=mx)
  • Negative Ramp ==> y = -mx + h for the negative slope
  • Positive Ramp ==> m = h / (T/2)
  • Negative Ramp ==> -m = -h / (T/2)

Now alternate between the two formulas every half period

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 9 of 18
(2,341 Views)

Can you give me a vi for this because I don't know how to work very well with labview being a beginner. Please!

0 Kudos
Message 10 of 18
(2,339 Views)