2573 views|9 replies

321

Posts

1

Resources
The OP
 

Paradox between power control accuracy and time delay accuracy of zero-crossing switch [Copy link]

This post was last edited by shipeng on 2020-7-22 11:04

I have been using PID temperature control for almost 4 years, and there is a problem that has been bothering me until now. I used to think that this problem was a paradox and that I could only find a delicate balance of gains and losses without any solution, but I was wrong. Not long ago, I suddenly found the answer in my dream in the early morning. The specific problem is: "There is an adjustable temperature control device (actually a hot air desoldering station) with a temperature range of 100~500 degrees Celsius, and the temperature control accuracy is required to be within ±1℃."

According to the above problem description, since the only way to control the temperature is to control the average heating power P within the unit time T, assuming that the power supply voltage remains unchanged, the size of the heating duty cycle D determines the temperature value of the constant temperature. This can be obtained that the temperature and the heating duty cycle D are in a one-to-one correspondence. 100~500 degrees requires at least 1/400 of the power control accuracy, but in fact, since the frequency of the mains is only 50Hz and zero-crossing switching is required, the minimum power control accuracy is half of the mains cycle th=10ms. According to "P=D*heating wire saturation power/400", the 1/400 accuracy corresponds to the duty cycle: 400*10ms=4 seconds, which is simply intolerable for controlling hot air, a medium with a small specific heat. You will find that no matter how you adjust the PID parameters, you can never achieve constant temperature. Of course, if the AD resolution of the collected temperature is high enough, you don't need such a high power resolution. You can make power compensation in advance when the temperature is still changing within 1 degree so that the temperature always fluctuates within 1 degree, which can also meet the requirements. After experimenting, I found that the power accuracy can be reduced to 1/50 at the lowest. At this time, the heating cycle T=50*10ms=0.5 seconds, but the naked eye can still clearly see the red and dark alternation of the heating wire. It may be due to the hysteresis of the temperature-collecting thermocouple that the actual AD is stable. If the temperature is measured by a thermocouple thermometer, it is also stable. The above is my solution four years ago, but the problem of the red and dark alternation of the heating wire made me uncomfortable.

Until I saw a hot air temperature control product made by a large manufacturer, the red and dark alternation of the heating wire was almost invisible to the naked eye under the premise of ensuring temperature control accuracy. I knew there was another way out of this problem, so I began to seek this ultimate solution and had the moment of inspiration mentioned above. This idea is simple: as shown in the figure below, if the duty cycle period T is 10 half cycles of the mains power, and the duty cycle D=5, the usual control idea is as follows:


Each time it is turned on for 5 and a half cycles, it will be turned off for 5 and a half cycles. If the power control accuracy is 1/50, it will be: 250ms to turn on the heating, and 250ms to turn off the heating. This will of course cause short-term fluctuations in the hot air temperature. The ultimate solution is this: break up the ON and OFF in the above figure and let them mix fully to get the effect of you in me and me in you:


The overall effect is that the power supply is turned on for 5 half cycles and off for 5 half cycles, that is, the duty cycle is still 5/10. Of course, 5/10 is a special case. What should be done if the power accuracy of 1/50 has a duty cycle of 27/50? It can be understood as 27 turns on and 23 turns off. 27/23 is equal to 1 with a remainder of 4, that is, the turn on and turn off are 1:1 with a remainder of 4, that is, after one turn on, there is one turn off, but after 23 switching cycles, there are still 4 turns on and not turned on. What should be done? The solution is to disperse these 4 turns on into the 23 switching cycles: that is, 23/4=5 with a remainder of 3. Now the remainder can be ignored. The final output result is to insert one more ON every 5 ONOFF cycles, so that the maximum dispersed duty cycle of 27/50 can be obtained. Of course, words are not enough. In order to intuitively verify this solution, a good method for verifying the algorithm is introduced: use Microsoft Visual Studio to verify and print out the experimental results:

Experiment code:

Achieve decentralized duty cycle control effect with 1/100 power resolution:

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

int main(void)
{
	for (uint8_t heat_duty = 0; heat_duty <= 100; heat_duty++)
	{
		uint8_t i, j, k, l, m, sub_t, pos_nag,on_cycles=0,off_cycles=0; _Bool HEAT1ON_A;
		i = heat_duty;
		if (i > 50) { j = 100 - i; pos_nag = 1; }
		else { j = i; i = 100 - j; pos_nag = 0; }
		sub_t = i == 0 || j == 0 ? 100 : i / j + 1; 
		l = j != 0 ? i % j : 1; if (l == 0)l = 1;
		for (uint8_t period = 0; period < 100; period++)
		{
			k = period; m = k / (j / l * sub_t + 1); 
			m = j==0 ? 0 : m > l ? k - l : k - m;
			HEAT1ON_A = m % sub_t == sub_t >> 1 ? !pos_nag : pos_nag;//k < j* sub_t && k % sub_t == sub_t >> 1 ? !pos_nag : pos_nag;//
			if (HEAT1ON_A)on_cycles++;
			else off_cycles++;
			printf(HEAT1ON_A!=0?"*":"-");
		}
		if (heat_duty!=on_cycles || on_cycles+off_cycles!=100)printf("%d,%d/%d\n", heat_duty,on_cycles,off_cycles);
		else printf("\n");
	}
	return 0;
}

Operation result: ('*' means on, '-' means off)

Duty cycle 0~50

Duty cycle 51-100

After the above verification, it is found that there is no problem in logic and the decentralized hybrid switch effect of any duty cycle within 0-100 can be achieved, but the actual temperature control effect is not satisfactory, and the temperature is not as stable as the original non-dispersed one. This face slap really caught people off guard. With a rigorous attitude of seeking knowledge, we are still slapped in the face by reality. Which expert can come to explain where the problem lies? Here I also give my explanation: It may be because my duty cycle control is updated in real time. I will not wait until the entire duty cycle is over before updating the duty cycle value. Instead, I will recalculate the duty cycle according to the current temperature AD value every time it crosses zero. I think this is the only way to ensure fast response capability, otherwise the load change during heating cannot be responded to in time. However, in the decentralized switch duty cycle control, since the opening and closing are staggered, the adjacent jitter of the duty cycle in a duty cycle cycle may have unexpected effects: the original reduction of heating power will get higher power, which will lead to temperature instability.

This post is from MCU

Latest reply

I think it should be the conflict between the "dispersion" and "fastness" algorithms that caused the overshoot. In addition, try to disperse in units of AC full cycles, which is more friendly to the power grid.   Details Published on 2020-7-22 15:00
Personal signature模电临时工
 

7462

Posts

2

Resources
2
 

The idea is interesting, a bit like the duty cycle effective voltage used in heating. I don't quite understand it, please help me.

This post is from MCU
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 

48

Posts

0

Resources
3
 
I really admire the attitude of the OP! Here is my personal opinion (maybe not professional, no wonder) that power and temperature are not linearly related. The greater the temperature difference with the environment, the faster the heat dissipation, and the greater the heating power may be required. The control accuracy of 1 degree within 400 degrees may be controlled within 1 degree in the low temperature area, but the control accuracy of 1/400 may not be enough in the high temperature area.
This post is from MCU

Comments

The problem you mentioned belongs to static temperature drift. In fact, temperature fluctuations caused by environmental changes are inevitable. The temperature control accuracy of 1 degree I mentioned mainly means that the set target temperature must be able to distinguish ±1℃, otherwise the measured temperature will not change after the set temperature is increased or decreased by 1 degree.  Details Published on 2020-7-22 08:37
 
 
 

310

Posts

5

Resources
4
 

I agree with the second floor's opinion.

This post is from MCU
 
 
 

321

Posts

1

Resources
5
 
This post was last edited by shipeng on 2020-7-22 10:23
aallian published on 2020-7-21 21:10 I admire the attitude of the OP! My personal opinion (maybe not professional, no wonder) power and temperature are not linearly related. The greater the temperature difference with the environment, the more heat dissipation...

The problem you mentioned belongs to static temperature drift. In fact, temperature fluctuations caused by environmental changes are inevitable. The temperature control accuracy of 1 degree I mentioned mainly means that the set target temperature must be able to distinguish ±1℃. Otherwise, if the measured temperature does not change after the set temperature is increased or decreased by 1 degree, this is a manifestation of insufficient temperature control accuracy.

This post is from MCU
 
Personal signature模电临时工
 
 

48

Posts

0

Resources
6
 
Regarding the red-dark alternation problem, after reaching the target temperature, if the OP fixes the power output and controls the duty cycle to be evenly dispersed, is it helpful?
This post is from MCU

Comments

Using "uniformly dispersed duty cycle" can solve the problem of "the heating wire alternates between red and dark". However, the actual AD value jitter is greater than that of "concentrated duty cycle".  Details Published on 2020-7-22 12:00
 
 
 

321

Posts

1

Resources
7
 
aallian posted on 2020-7-22 11:36 Regarding the problem of alternating red and dark, after reaching the target temperature, if the OP fixes the power output and controls the duty cycle to be evenly dispersed, does it help?

Using "uniformly dispersed duty cycle" can solve the problem of "the heating wire alternates between red and dark". However, the actual AD value jitter is greater than that of "concentrated duty cycle".

This post is from MCU
 
Personal signature模电临时工
 
 

1w

Posts

142

Resources
8
 

I think it should be the conflict between the "dispersion" and "fastness" algorithms that caused the overshoot. In addition, try to disperse in units of AC full cycles, which is more friendly to the power grid.

This post is from MCU

Comments

Yes, I did consider this issue, but I hesitated when I thought that it would further sacrifice power resolution or aggravate the problem of the heating wire alternating between red and dark. However, in the end, this solution was not adopted because the temperature control effect was not good in actual testing.  Details Published on 2020-7-22 15:30
 
Personal signature上传了一些书籍资料,也许有你想要的:https://download.eeworld.com.cn/user/chunyang
 
 

321

Posts

1

Resources
9
 
chunyang posted on 2020-7-22 15:00 It seems that the "dispersion" and "fastness" algorithms conflict, resulting in overshoot. In addition, try to use the entire AC cycle as the...

Yes, I did consider this issue, but I hesitated when I thought that it would further sacrifice power resolution or aggravate the problem of the heating wire alternating between red and dark. However, in the end, this solution was not adopted because the temperature control effect was not good in actual testing.

This post is from MCU
 
Personal signature模电临时工
 
 

321

Posts

1

Resources
10
 

At this point, things seem to have created a new "paradox", too dispersed and too fast is another contradiction. In the end, my approach was to compromise on dispersion, but not on speed. The specific solution is: the dispersion value is a fixed value. For example, if the power resolution is 1/100, the duty cycle is fixedly dispersed into 10 parts. If it is less than 10, follow the left alignment principle, and the remainder insertion also follows the left alignment. The final temperature control effect can solve the problems of "red and dark alternation" and unstable temperature control.

This post is from MCU
 
Personal signature模电临时工
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list