RSLogix RAMP instruction

Instead of using a stepped add use a timed ramp and compute the ramp.

The ramp equation is Beginning_Point + ((Ending_Point - Beginning_Point)*(Timer.ACC/Timer.PRE))

Program the timer to run the full time of the ramp, eg if you want to ramp over ten seconds then use a ten second timer.

In the CLX the timer ACC can overrun the PRE so after the CPT do a final range check on the result.

Here is an example.
attachment.php


------------------------------------------

Using the method you posted above, if you want to use a periodic task then don't use a timer. Since a timer is a computer instruction, not a device, if it gets executed at a periodic rate that is longer than its PRE then you will have significant timing accuracy issues. Resetting it adds another task period (or scan period) in and compounds the problem.

Instead of using a timer, determine what vale to add at the task period rate and just add that each time the task runs. You can use the GSV instruction to get the task period and compute the amount to add so that even if the task period is changed the right ramp will be generated.

Use GSV TASK THIS Rate TaskRate where TaskRate is a DINT tag to return the task period in microseconds.

Here is an example of a step/add ramp in a 50 millisecond periodic task ramping a pressure setpoint at a rate defined in KPa/second.
attachment.php

One thing to watch out for with this method is when ramping at very low rates the computed step change might be smaller than the resolution of the IEEE-754 floating point number format. In that case no matter how many times you add the step in the setpoint wont change. That is only an issue for very low rates with proportionally very large setpoints, I only mention it because occasionally someone comes here with that kind of a problem.
hi ,

can you help me conver this para program from slc5 to RSlogix 5000 ?
thank you very much !!View attachment hepl me.doc
 
I hope this helps someone.

Code:
GSV(TASK,THIS,LastScanTime,TaskRate);

TaskRateSec := TaskRate * 0.000001;

if IN > OUT then //increase
	Step := (UpRate*TaskRateSec);
	if (ABS(IN - OUT)) < Step then
		OUT := IN;
	else
		OUT := OUT + Step;
	end_if;
end_if;

if IN < OUT then //decrease
	Step := (DownRate*TaskRateSec);
	if (ABS(IN - OUT)) < Step then
		OUT := IN;
	else
		OUT := OUT - Step;
	end_if;
end_if;
 
Better Ramp

Modified the code to perform calculation in a single step.



Code:
GSV(WallClockTime,,CurrentValue,CurrentValueArray[0]);

if LastScanTime = 0 then
	CurrentValue := 0;
else
	CurrentValue := CurrentValueArray[0] - LastScanTime;
end_if;

LastScanTime := CurrentValueArray[0];

if IN > OUT then //increase
	if UpRate = 0.0 then
		Out := IN;
	Else
		Step := (UpRate * CurrentValue) * 0.000001;
		if (ABS(IN - OUT)) < Step then
			OUT := IN;
		else
			OUT := OUT + (UpRate * CurrentValue) * 0.000001;
		end_if;
	End_if;
end_if;

if IN < OUT then //decrease
	If DownRate = 0.0 then
		Out := IN;
	else
		Step := (DownRate * CurrentValue) * 0.000001;
		if (ABS(IN - OUT)) < Step then
			OUT := IN;
		else
			OUT := OUT - (DownRate * CurrentValue) * 0.000001;
		end_if;
	end_if;
end_if;
 
Last edited:

Similar Topics

Good afternoon, This is my first post with this website and I am also relatively new to ladder based programming (used mostly SAMA with DCS...
Replies
3
Views
5,044
Hello, I am using RSLogix 5 to code a PID controller. Is there a RAMP function (or something similar) avaialbe as a template in RSLogix 5...
Replies
5
Views
5,118
I have an application using AC drives driven from an analog speed reference. Each has a position command to run to with encoder position and...
Replies
3
Views
9,023
Hi Everyone, I am not proficient in RSLogix 500 so I have a question regarding the evaluation of N7:0 data as an input. So as I understand in...
Replies
1
Views
75
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
138
Back
Top Bottom