Searching \ for '[EE]: How to calculate linear power intervals for' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/power.htm?key=power
Search entire site for: 'How to calculate linear power intervals for'.

Exact match. Not showing close matches.
'[EE]: How to calculate linear power intervals for '
2002\10\14@132619 by

I have tried to figure this out but it seems to be just beyond my
mathematics level.

I am implementing a PID loop to control the temperature in a small
greenhouse.  The heating will be provided by a typical household portable
heater that has been modified so I have control of the AC applied to the
heater elements via an opto-isolated triac.

Phase angle control will consist of interrupting on the zero cross and
loading the power setting to Timer1.  The triac will be gated on when
Timer1 overflows and interrupts.

Running at 8 MHz there will be 16,666 instructions between each zero cross,
so lots of resolution for the power setting.

My understanding of PID loops is that they work better if the controlled
variable has a linear response to the affect on the plant.  Obviously if I
change the gate time 1 ms, this will have a far different effect if the
change was from 1 to 2 ms or from 3 to 4 ms.

So, the question is, how would I calculate the offset times from the zero
cross, for say, 256 equal power intervals of the half cycle.  I may then do
a linear interpolation at this point for any further resolution.

I am sure that I might be able to totally ignore the non-linear response of
the control variable and still get the loop to work, and I would like to
hear suggestions to that end, however, I will still be curious as to the
math required to do this calculation.

regards,

Bob Bullock

--

The power in chopped mains into resistive load is the defined integral on
the domain between the firing angle and the end of the semiperiod. This is
a defined integral of the sine squared function (Pchopped = 2*SumOf(Pi =
{Upk*sin(ti)}^2/R, i=firing_angle to pi). You can neglect the start and
the end where there is little power (and elegantly avoid the problem of
when exactly the triac fires and extinguishes).

You can reverse this function using a computer program to obtain a lookup
table of firing times (convert radians in ti into usec/period) wrt power
desired.

I don't think that you need to interpolate at this level (256 steps on a
2kW heater is about 10 W per step - you'd have to have pretty good
thermometers to see that amount of heat difference in a usual sized box or
room). At most the output will jump between two adjacent values from time
to time.

Peter

--

> I don't think that you need to interpolate at this level (256 steps on a
> 2kW heater is about 10 W per step - you'd have to have pretty good
> thermometers to see that amount of heat difference in a usual sized box or
> room). At most the output will jump between two adjacent values from time
> to time.

Even better, why not screw the phase angle and switch in (or not) complete
power line cycles?  At 60Hz that gives you 13 different power choices and
still drive the heater with at least 5Hz to reduce stress.

*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--

On Mon, 14 Oct 2002 17:56:38 -0400, you wrote:

>> I don't think that you need to interpolate at this level (256 steps on a
>> 2kW heater is about 10 W per step - you'd have to have pretty good
>> thermometers to see that amount of heat difference in a usual sized box or
>> room). At most the output will jump between two adjacent values from time
>> to time.
>
>Even better, why not screw the phase angle and switch in (or not) complete
>power line cycles?  At 60Hz that gives you 13 different power choices and
>still drive the heater with at least 5Hz to reduce stress.
....as well as having the lower noise of zero-cross switching.
--

This would be yet another good application of a Bresenham or phase
accumulator algorithm.

Bob Ammerman
RAm Systems

{Original Message removed}
> >Even better, why not screw the phase angle and switch in (or not)
complete
> >power line cycles?  At 60Hz that gives you 13 different power choices and
> >still drive the heater with at least 5Hz to reduce stress.
>
> This would be yet another good application of a Bresenham or phase
> accumulator algorithm.

Yes, that kind of algorithm would allow much finer control over the average
heat output.  However, it would also lower the fundamental frequency of the
input.  It's hard to say how much this may matter.  You want to keep the
temperature of the heater elements reasonably constant to reduce mechanical
stress on them as they expand and contract.  I used 5Hz just as an example
that was admittedly pulled out of the air.  I don't know what a reasonable
number is, but the bigger the heating elements, the lower the frequency.
5Hz is probably more appropriate for thin elements not much thicker than
large lightbulb filaments.

Most heaters with thermostats do a good enough job regulating room
temperature with two power settings (off, full on).  I bet the greehouse
heater of the original poster would work fine like that with the right
control algorithm.  Even if not, 4 settings would almost certainly be fine,
with anything over 8 effectively "continuous" for the purpose.  Given that,
I'd prefer to optimize for low noise and low heater stress.

*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

>I used 5Hz just
> as an example
> that was admittedly pulled out of the air.  I don't know what
> a reasonable
> number is, but the bigger the heating elements, the lower the
> frequency.

We have done exactly what Peter describes for an 8-bit res. phase angle
controller. While the math is certainly fun, it turned out to be amazingly
simple. Likewise a table was created to linearize the phase angle timing -
While this works great, it was needed because the design is used to apply
PID control to multi-kW heater loads in a *very* fast process where the PID
cycle time can be as short as 100 mS. The heaters have very light filaments
so as to be able to respond so quickly - hence they emit lot's of visible
light as a by-product, and it was considered to be aestheically negative for
any "flicker" to exist.

I would never go through this kind of effort for a space heater, which needs
only  to be a veerrry sslloowww process, and can be often switched on & off
in intervals of seconds, or even minutes.
Phase angle firing can get messy when you realize that your resistive heater
has some inductive quality that the phase angle firing makes evident in some
funky unexpected way.

> 5Hz is probably more appropriate for thin elements not much
> thicker than
> large lightbulb filaments.

Well, not exactly...
Short-wavelength heaters with low filament density will visibly flicker at
low frequency. The thermal stress on the lamp end seals (rather than the
filament) is the greater concern. I recall going through this on an old
thread wherein it was demonstrated that phase angle firing allows for the
longest life from low density filaments. more dense loads, such as cal-rods
can be turned on and off in intervals of seconds with the only ill effect
being inrush current on the control switch. Since there are no thin moly
foil parts squeezed thru a thin section of quartz glass, the life of the rod
heater is not as severely affected as would be an IR quartz "lamp". I have
collected data on all sorts of heaters and many switching methods over the
years - quartz SW heaters like phase-angle firing, high density elements
will only have their life slightly compromised by being hid hard & often.

I have been able to zero-cross fire IR lamps with a proportional control
algorithm that mixes 1/2 cycles in such a way as to minimize flicker -
different values require differing numbers of half cycles. The key here was
to reduce the duration of off-time at low values.

I would think it best to use a higher-density heater for space heating and
to use zero-cross firing proportionally, perhaps with a 1 sec or longer time
base. If you want to go simple and skip the math, use an MOC3062  zc
optocoupler that's made to fire triacs or SCR pairs with minimal parts
count. They can be connected directly to an I/O pin and there'll be less
stress on the thyristors and virtually no noise. While this isn't
recommended for IR lamp filaments, it's a sure bet for heater coils,
cal-rods, even medium wavelength quartz-tubes.

>
> Most heaters with thermostats do a good enough job regulating room
> temperature with two power settings (off, full on).  I bet
> the greehouse
> heater of the original poster would work fine like that with the right
> control algorithm.

Bingo! look at the myriads of commercially available on/off PID controllers
out there that work exatcly this way. This kind of process if fast enough
for processing plastics, and can be 100's of times speedier than is needed
to heat a greenhouse.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Somebody said:
> > >Even better, why not screw the phase angle and switch in (or not)
> complete
> > >power line cycles?  At 60Hz that gives you 13 different power choices
and
> > >still drive the heater with at least 5Hz to reduce stress.

Bob Ammerman commented:
> > This would be yet another good application of a Bresenham or phase
> > accumulator algorithm.

> Yes, that kind of algorithm would allow much finer control over the
average
> heat output.  However, it would also lower the fundamental frequency of
the
> input.

and now Bob Ammerman rebuts:

Assuming you are switching on half cycles, the Bresenham/Phase accumulator
approach will more evenly spready out the on/off cycles. Given any output
power the Bresenham will always do at least as well as conventional PWM at

Bob Ammerman
RAm Systems

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Controlling the heater by switching complete half-cycles does sound like
the way to go for this situation.  That hadn't occurred to me so that in
itself is a big help.

Bob, if I understand what you are saying, the Bresenham/Phase accumulator
algorithm will somehow determine a sequence of half-cycles to skip that
gives you a reasonable range of power control with a more evenly
distributed half-cycles over some period.  Could you provide just a little
more detail in implementing this, or point me in the right direction.  I
have heard of Bresenham in reference to line drawing and don't see the
immediate connection.

thanks

Bob Bullock

At 10:21 AM 10/15/2002 -0400, you wrote:

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

On Mon, 14 Oct 2002, Bob Ammerman wrote:

*>This would be yet another good application of a Bresenham or phase
*>accumulator algorithm.

How would that help ? What's a good progression that approximates sin^2 ?

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

On Mon, 14 Oct 2002, Olin Lathrop wrote:

*>> I don't think that you need to interpolate at this level (256 steps on a
*>> 2kW heater is about 10 W per step - you'd have to have pretty good
*>> thermometers to see that amount of heat difference in a usual sized box or
*>> room). At most the output will jump between two adjacent values from time
*>> to time.
*>
*>Even better, why not screw the phase angle and switch in (or not) complete
*>power line cycles?  At 60Hz that gives you 13 different power choices and
*>still drive the heater with at least 5Hz to reduce stress.

That's the way the little project I posted to the piclist once works. But
most people who use a closed loop have concerns about the response time of
such a scheme. With some good reason, since even 10 power steps on an air
heating system implemented like this could cause a loop to oscillate (with
the integrating time of the heater proper you get time constants of the
order of magnitude of two seconds or more). You need a HUGE I component in
the regulator to get it steady and iron patience to tune it (it takes
ages to respond to user input).

However for large loads, like water heating, it is ok. Also synchronous
motor fans (the mass of the rotor does the integration here).

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

On Mon, 14 Oct 2002, Mike Harrison wrote:

*>>still drive the heater with at least 5Hz to reduce stress.
*>....as well as having the lower noise of zero-cross switching.

And the slow buzz of this switching mode instead.

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

My point was that if you decide to do zero-cross switching, then the minimum
'quantum' of power is that which you get out of one half cycle.

You use phase accumulation, or equivalently the Bresenham algorithm, to
decide which complete half-cycles are turned on.

This will provide a 'smoother' distribution of power than conventional PWM.
It also allows for higher resolution of the average power.

For example: assume we have decided that we want to be able to go down to
1/16th power. For a simple PWM, that means that we turn on the first cycle
in 16 for 1/16th power, the first 2 cycles in 16 for 2/16th power, ..., the
first 8 cycles in 16 for 8/16th power, ...

The phase accumulator approach can generate smoother output, for example at
8/16th power the phase accumulator will turn on for every other half cycle
(instead of 8 half-cycles on then 8 half cycles off).

The phase accumulator can also result in more resolution. For example to
generate 3/32 power the phase accumulator would generate 3 roughly equally
spaced half cycles for each 32 half cycles.

Bob Ammerman
RAm Systems

{Original Message removed}
On Tue, 15 Oct 2002, Bob Ammerman wrote:

*>My point was that if you decide to do zero-cross switching, then the minimum
*>'quantum' of power is that which you get out of one half cycle.
*>
*>You use phase accumulation, or equivalently the Bresenham algorithm, to
*>decide which complete half-cycles are turned on.

Yes, I understand. I thought you meant use phase accumulator in phase
angle control (which is not possible afaik).

Peter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

>Controlling the heater by switching complete half-cycles does sound like
>the way to go for this situation.  That hadn't occurred to me so that in
>itself is a big help.

And the easy way to do this is to use a CA3059 controller chip. Check the ON
Semiconductor web site for a data sheet.

http://www.onsemi.com/home

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

>The phase accumulator approach can generate smoother output, for example at
>8/16th power the phase accumulator will turn on for every other half cycle
>(instead of 8 half-cycles on then 8 half cycles off).

This may cause you problems, especially where iron cored inductances are
involved. It is much nicer if it can be made to have a positive half cycle,
and then a negative half cycle rather than a number of positive half cycles
in a row without any negative half cycles to balance the core magnetic
fields, which is what you seem to be suggesting here by "every other half
cycle".

As the unit is being suggested for a green house, i am envisaging the
possibility of an isolating transformer in the picture. It may be that it is
to be run on an RCD, but I would be wary of having something in a greenhouse
being run directly off the mains without some sort of fault protection.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

While I found the need with my homegrown phase accumulator (thanks guys, now
I know what to call it!) to balance the number of pos & neg 1/2 cycles, it,
like any zero-cross firing scheme will not work well with inductive loads
for several reason:. First, any imbalance on phases will create DC on the
line, secondly, the inductance will create a current phase shift, so the
zero-voltage switching will actually be self-destructive since there will be
current flowing at the voltage zero points. transformer loads mean
phase-angle control that you can adjust for the shift, otherwise watch the
thyristors fizz....

>
>
> >The phase accumulator approach ....
> This may cause you problems, especially where iron cored
> inductances are
> involved.

> As the unit is being suggested for a green house, i am envisaging the
> possibility of an isolating transformer in the picture.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

>While I found the need with my homegrown phase accumulator
>(thanks guys, now I know what to call it!) to balance the
>number of pos & neg 1/2 cycles, it, like any zero-cross firing
>scheme will not work well with inductive loads for several
>reason:. First, any imbalance on phases will create DC on the

I did not mean to imply that the scheme will not work, just that the way
that particular post had suggested may give you problems with any isolation
transformer that may be there because repeated half cycles all on the same
"side" (positive or negative) may introduce a DC magnetisation in the
transformer. Just make sure what ever zero crossing scheme you use makes
some attempt to use both positive and negative cycles in roughly equal
amounts.

Second, your heater should be a resistive load anyway. This should mean that
any triac will have close to zero phase angle in its current waveform, and
switching it should not be a problem.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

> Given any output
> power the Bresenham will always do at least as well as conventional PWM at

True, but Bresenham allows additional power settings that are not achievable
with finite time slice PWM.  It is these settings that contain the low
frequencies.

You can sortof think of the PWM as realizing a finite set of rational
numbers with a fixed denominator.  Bresenham can implement arbitrary
rational numbers, including some that expand to repeating series with very
long periods.

*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

> may give you problems with
> any isolation
> transformer that may be there

There are two possibilities that come to mind:

1. If a transformer primary is controlled via the thyristor(s) you then have
an inductive load, regardless of whether or not you have a resistive heater
load on the secondary. This is often done for isolation and to be able to
rectify the secondary as needed in different applications. My point was
simply a suggestion that if you intend to isolate with a transformer, that
this is not the easiest place to put it, since you will then have to deal
with the current phase shift (fun!).

2.
> because repeated half cycles
> all on the same
> "side" (positive or negative) may introduce a DC magnetisation in the
> transformer. Just make sure what ever zero crossing scheme
> you use makes
> some attempt to use both positive and negative cycles in roughly equal
> amounts.

This ^ will apply to a source transformer only. At a few thousand watts, the
local utility serice will handle the imbalance no problem. If you isolate
the supply at this point, a small transformer can be made to smoke easily
from the induced DC from even a small imbalance.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

> > because repeated half cycles
> > all on the same
> > "side" (positive or negative) may introduce a DC magnetisation in the

Just to state the obvious, the beauty of bresenhams
and similar systems is that the size of the "chunk"
really doesn't matter.

You could do a COMPLETE cycle, ie a + half followed
by a - half, then do the bresenham based on the
complete cycle being the "chunk" size. This would
always maintain an average of zero, keeping the
power company happy.

Heating a greenhouse is going to give a massive
thermal lag and hot/cold areas anyway, a PID system
sounds like overkill that might not work any better
than a \$10 air conditioner thermostat available
from any appliance repairer.
-Roman

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

----- Original Message -----
From: "Olin Lathrop" <olin_piclistEMBEDINC.COM>
To: <PICLISTMITVMA.MIT.EDU>
Sent: Wednesday, October 16, 2002 8:13 AM
Subject: Re: [EE]: How to calculate linear power intervals for phase angle

> > Given any output
> > power the Bresenham will always do at least as well as conventional PWM
at
> > spreading the on-time around.
>
> True, but Bresenham allows additional power settings that are not
achievable
> with finite time slice PWM.  It is these settings that contain the low
> frequencies.

Exactly what I said.

> You can sortof think of the PWM as realizing a finite set of rational
> numbers with a fixed denominator.  Bresenham can implement arbitrary
> rational numbers, including some that expand to repeating series with very
> long periods.

An excellent way to put it!

Bob Ammerman
RAm Systems

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...