In the Dark about Ramping an Analog Output

SharpFocus

Member
Join Date
Mar 2005
Posts
2
Hi,
I am a PCL nubie!
I have only a little PLC programming experience (3 PLCs mostly Boolean stuff) and have bitten more than I can chew this time.

I am using an automation Direct (Koyo DL205) PLC.

My problem involves the programming of the F2-08DA-2 8-Channel Analog Voltage Output Module. It is set up for 0-10 volts and will be used to control some lighting dimmers. Setting the output to a designated level is not the problem that works just fine.

In a nut shell:
I have 24 channels of lighting controlled by (4) F2-08DA-2 modules. The 24 channels are divided into 5 groups. Each group is required to start at a different level and then ramp up or down to the next level simutaneously in a (X) variable amount of time. The programming to create this “timed ramp” has eluded me.

Is there someone who might be able to brighten my day?

Sharpfocus
 
It's all a game of rate over time, starting point and ending point.

Initial Value + Change in Value = New Value

In my analog card, my numerical control values for a 0-10V signal are 0 to 32000. Some other PLCs use different numbers.

0 = 0V and 32,000 = 10V

10% = 3,200
25% = 8,000
50% = 16,000
75% = 24,000
100% = 32,000


Let's say that the current level is 10% and you want to go to 75% in 15-seconds...

The 10% level represents the initial value. Save this value.
The 75% level represents the target value. Save this value.

The rate of change is... (24,000 - 3,200) / 15-seconds = 1386 counts per second.

Now, determine the smallest resolution of your timers. I'll assume you have a milli-second timer.

1386 counts per second = 1.386 counts per milli-second. But, you really don't want to deal in real number math if you don't have to... use the 1386 figure but remember that it is 1000 times greater than actual.

I'll assume that your Timer counts up.

Now, when it is time to change the lighting level, load the timer with 15.000 seconds. This value is 15,000 in memory. Start the timer. Your initial value is 10% = 3,200.

If raising the level...
then, while your Current Value is less than target value...
-OR-
If dropping the level...
then, while your Current Value is greater than target value...

Calculate the Change in Value:
On every scan, read the timer for expired time. Multiply that time by the rate (1386).

Lets say 12-milliseconds have gone by... 12 x 1386 = 16632... now remember, this is 1000 times the actual value.
(The real time is .012 seconds => .012 x 1386 = 16.632.)

To get the real change in the output signal, divide 16632 by 1000 to get 16.

Calculate the New Value:
Your initial value is 10% = 3,200... now add the 16 to 3,200 to get 3,216. This is the new output value. Write that to the current value.

Initial Value + Change in Value = New Value

Now, keep repeating... until...

...if your target is greater than the initial value then repeat until the result is greater than the target.

...if your target is smaller than the initial value then repeat until the result is smaller than the target.

While not going beyond the target value, write the New Value out to the Current Value. As soon as the result of the calculation does go beyond the target value, then simply write out the target value to the current value and discontinue the calculation.

(30)
 
Last edited:
Terry,

You beat me by 10 minutes. I must say that you describe it so much better than I did though. Very clear and concise. One question though; if he is ramping down should not he be subtracting the offset from the initial value instead of adding it? The way I saw it was the final value would keep decreasing as the timer increased. I realize the formula would work properly with real numbers but the plc does not like real numbers....unless you were able to do it all in the accumulator before copying it out to the pointer.
Okay. Nevermind. Not enough beer yet in my system. lol

Bob
 
Last edited:
Bob,

I'll bet you're workin' on that "not enough beer" problem right now!

I didn't clarify the following very well...

The rate of change is... (24,000 - 3,200) / 15-seconds = 1386 counts per second.

The basic form should be...

The rate of change is... (Target - Initial) / 15-seconds = 1386 counts per second.

If the Target is less than the Initial then the result of that calculation will be Negative. Adding a Negative is subtraction.
 
Yeah, I realized that after I posted. Hence the edit. As long as it is all done in the accumuluator prior to "OUT"ing it to the Analog pointer you do not have to worry about the negative sign. AD does not play well with negative signs. I usually make sure that all my math results in positive integers because if it.

Bob
 
I am wondering what you are physically using to dim the lights. I assume must be some type of module that takes a analog signal. Can they be used with simple 120V incadescent lights? I been searching for something like this
 
More detail

Get coerence, it must know the size of "jump" (step).

It gets the data of resolution of the equipment that the signal
receives analogical (VFD) and of the PLC.
Sample:
VFD - Input analogic resolution: 14mV
PLC - Output analogic resolution: 3 mV
Sample will be this step min = 14/3 = 4 count.

And verification min step Hz for VFD.
Sample:
Min increment:0.1Hz ,calculate correspondet value in mV input

If it demands exactness, it can make compensation of the quantisation. That it represents to each wide step a unitary error.
Soon, Terry. It transcribes that will be complete.
 

Similar Topics

Does anyone know how to set the background colors of instuction blocks (TON, MOV, etc)?
Replies
1
Views
148
Hello all, I'd want to add a dark mode option to a program I'm working on in Factory Talk. Is it possible to add a script to a button that alters...
Replies
2
Views
1,732
Hello all, Can anyone give me ideas on setting up a heart beat for redundant servers communicating to a controllogix processor. I am going to...
Replies
1
Views
2,124
In short, I have inherited a project that has been abandoned by the original installers. Yes abandoned before it has been finished. They realized...
Replies
29
Views
10,419
This may not have much to do with the actual 'programming' per se, but perhaps a few of you have stumbled onto this before. My company bought an...
Replies
1
Views
1,316
Back
Top Bottom