02-11-2025 06:30 AM
Hi GerdW,
When I give all the needed data as array, the loop is finishing all the iterations and only it is passing the array with last ramp values.
02-11-2025 07:17 AM
Right click on that tunnel inside the red rectangle and choose Tunnel Mode->Indexing. Et voilà!
02-11-2025 07:39 AM - edited 02-11-2025 07:44 AM
Hi Varghese,
@Varghese89 wrote:
the loop is finishing all the iterations and only it is passing the array with last … values.
To put it in other words than Rolf: this is because YOU set the output tunnel to "last value" mode!
02-11-2025 09:49 AM
FYI, if anyone posts code snippets that look like below, you can drag and drop them onto your block diagram, see this article about using code snipits:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2PkCAI&l=en-US
Drag this image onto your block diagram:
If dragging and dropping does not work download the image and drag the PNG onto the block diagram.
02-12-2025 03:52 AM
Hi Jay,
Thank you for your help. This is working for both ramp up and ramp down. I also need constant ramp with zero ramp rate.
02-12-2025 04:14 AM
Hi GerdW,
I sincerely thank you for your valuable help. concatenating served the purpose. I have also cleaned up the block diagram.
02-12-2025 04:41 AM
Hi Varghese,
@Varghese89 wrote:
This is working for both ramp up and ramp down. I also need constant ramp with zero ramp rate.
A "constant" ramp uses a step width of 0 (aka "zero ramp rate").
Hint: You can define a ramp also by start, end and number of steps…
02-12-2025 05:09 AM
Hi GerdW,
Thank you for the hint. For a constant ramp, the start and stop values will be same and Yes, I was to specify the array size for which the value is constant. Currently I am checking the number of iterations based on the Quotient obtained from subtracting the difference of start and stop value with ramp rate plus 1. I am confused how to implement the constant ramp. I understand i need to check if the difference is zero and to input the number of iterations, but I am confused how to implement it, can you please elaborate.
02-12-2025 05:41 AM
Hi Varghese,
@Varghese89 wrote:
I am confused how to implement it,
Simple approach:
IF step_width == 0 THEN
RAMP(start, end, number of samples)
ELSE
RAMP(start, end, step_width)
ENDIF
A simple case structure and two different ways to create the ramp will solve the problem!
(You can reduce the problem to two ways to create the ramp parameters, then you call a generic Ramp(start, end, number of samples, step_width) function.)
"Programming" means to develop algorithms (independently from the language you use).
Often it helps to "divide and conquer"…
02-12-2025 06:30 AM
Thank you so much :'). Case structure solved the problem.
Best Regards,
Varghese