The control algorithm heater

    • Official Post

    If that is a PID, there is probably some parameter to correct to avoid overshoot.
    note that it is also possible that the system is too much changing (phase change?) and in that case an adaptative control algorithm should be used.


    what was happening durin the red excusions ?


    was it phase change ? or why not sensor/heater breakdown? if the later, it is normal that PID get crazy.

    “Only puny secrets need keeping. The biggest secrets are kept by public incredulity.” (Marshall McLuhan)
    twitter @alain_co

  • It was a test tube heating (empty!). Red continuous strip - a problem in the DC amplifier ADC until he found what was the matter. All homemade (control, electronics and control program in C ++ under linux). I steered so: ask the approximate power "by hand" and watched as the temperature changes. I am in the search algorithm. You can do like this: set the final temperature and the time during which it is to be achieved. Break the difference between the initial and final temperature of ... 10..hhh plots and using the approximate coefficients
    (I have this:
    // Temperature, % 220v to support:
    .....
    400C - 20% -30%
    450C - 25% -30%
    500C - 30% -40%
    550C - 45% -50%
    600C - 45% -55%
    ......
    )
    Added to the unit of time as the% power .. something like .. I do not
    ask to share the program itself (I suspect that Lamereaux code writing
    is not just me), but the algorithm itself, who both did. How to adjust the temperature - a lot of ways in which one to choose? Here, I think. Who is in fact already written;).
    ------- На всякий случай по русски то же самое -------
    Это был тестовый нагрев трубки (пустой!). Красные сплошные полосы - проблема в усилителе постоянного тока АЦП, пока не нашел в чем дело. Все самодельное (регулятор, электроника и программа управления на с++ под linux). Я регулировал так: задавал примерную мощность "вручную" и смотрел как изменяется температура. Нахожусь в поиске алгоритма. Можно сделать например так: задавать конечную температуру и время в течении которого она должна быть достигнута. Разбивать разницу между начальной и конечной температурой на... 10..ххх участков и пользуясь примерными коэффициентами
    (у меня это:
    // температура, % от 220в для поддержки:
    ....
    400С - 20%-30%
    450С - 25%-30%
    500С - 30%-40%
    550С - 45%-50%
    600С - 45%-55%
    ....
    ) добавлять в еденицу времени сколько то % мощности.. как то так.. Я не прошу делиться самой программой (подозреваю что ламеро-код пишу не только я), лишь сам алгоритм, кто как сделал. Как регулировать температуру - куча способов, какой из них выбрать? Вот, думаю. Кто то ведь уже написал ;).

  • Correct me if I am wrong but it sounds as if you are using a "Feedforward" type of control? You have mapped the resultant temperature of your reactor to the input power and your algorithm interpolates or calculates the required power for a given temperature setpoint? You are not using the temperature as feedback?


    Or is it that you do not have any control and are asking for some control code given the data you have supplied?


    What kind of power control are you using? Triac chopping/phase control? SSR on/off control? FET PWM control?

  • I would like to ready an algorithm that would be all very calculated and automatically adapted ... Well, okay , it's a pipe dream , as they used to like to write . Feedback from the temperature there . Now all manually , like this:
    -
    if (di_a < 600 ) pow_shim = 55 ;
    if (di_a> 600 ) pow_shim = 45 ;
    -
    where 45 and 55 - the duty ratio of PWM . 600 - the temperature from the ADC .
    I use the controls on the 40N60. Here such : http://jivisam.ru/uploads/electronika/regulator_220v.png ( without capasitor are on 220 . )
    until all the test.
    --- а тут на языке который знаю получше ---
    Хотелось бы готовый алгоритм, который бы сам все расчитывал и автоматически адаптировался... Ну да ладно, это несбыточная мечта, напишу как раньше хотел. Обратная связь с температурой есть. Сейчас все вручную, примерно так:
    --
    if (di_a<600) pow_shim=55;
    if (di_a>600) pow_shim=45;
    --
    где 45 и 55 - коэффициент заполнения ШИМ. 600 - температура с АЦП.
    Использую регулятор на 40N60. Вот такой: http://jivisam.ru/uploads/electronika/regulator_220v.png (без емкостей которые на 220в.)
    пока все тест.

  • Ok, so from the circuit diagram you are using an low side switched IGBT with PWM to control the power to your heater. You also seem to be using a stepwise hysteresis control in your code?


    Your code looks almost like a Fuzzy Logic controller. You have a table linking temperature with PWM setpoints. Fuzzy Logic calculates the output using linear interpolation between the points you have programmed in.


    It might be possible to "learn" the correct mapping by having the code step with a small change in PWM and seeing how the temperature changes. You can then save the PWM step and the temperature step in your Fuzzy table. Getting that sort of thing to work nicely would probably be difficult.


    Look up "Fuzzy Logic" in google.


    (EDIT) However, since you have continuous temperature and control, it may be simpler to make a PI control loop in software. PI control loops can be tuned to cover a wide range of models.

  • Switched to control with the controller (Atmega8). PID is now customizable. My algorithm (from the Internet, creatively reworked):
    ----
    static int PrevValue;
    float cc;
    Error = Target - mpc3201;
    // Compensation surges
    cc=0.18*adc_mega;
    cc=(cc/2.5*cc)/255; //power/1tik
    /////////
    P_Term = Kp/cc * Error;
    if (Integral > MaxIntegral) {Integral = MaxIntegral;}
    else if (Integral < - MaxIntegral) {Integral = - MaxIntegral;}
    else Integral += Error;
    I_Term = f_Ki * Integral;
    D_Term = Kd * (PrevValue - mpc3201);
    PrevValue = mpc3201;
    Out = (P_Term + I_Term + D_Term);
    if(Out > 0xFF) { OCR2 = 0xFF; }
    else if(Out < 0) { OCR2 = 0;}
    else OCR2 = Out;
    // SMA for komp.
    Error=0;
    sma_OCR2[9]=Out;
    while (Error < 8){
    sma_OCR2[Error]=sma_OCR2[Error+1];
    Error++;
    }
    Error=0;
    P_Term=0;
    //sma
    while (Error < 10){
    P_Term+=sma_OCR2[Error];
    Error++;
    }
    sma_OCR2_out=P_Term/10; // SMA,10.


    }


    ----
    At the moment, I pick up rates.
    Maybe someone can help.
    GlowFish, thank you.

  • The algorithm above two mistakes.
    1.Out = (P_Term + I_Term + D_Term);
    1.2.Out = (P_Term + I_Term - D_Term);
    And under certain conditions in averaging occurs division by 0.
    I have found how to configure. Simple and accessible and understandable. Lock google "PID Without a PhD"!

  • Looks good.


    As you are controlling temperature, I would have suggested starting with a higher Ki of between 0.01 and 5: The author of that document is being conservative in order to cover a wide range of different systems.


    But it doesn't really make much difference, as you will iterate to good values eventually... just trying to save you some time!


    Also, the value of 'MaxIntegral' is important, it's there to prevent "windup". If it's value is too high, it can cause instability if you apply large changes to the temperature setpoint, and could/should be tuned in the same manner as P and I (but using larger temperature steps, to simulate possible inputs that you might wish to apply during experimental runs).

  • I came to the conclusion that a universal controller is quite difficult to do. Too wide range of temperatures and applied power. I went on a simple way - the coefficients for different temperature ranges will be changed directly in the process. There's the most important thing - the power consumption is calculated fairly accurately. For this and moved on microcontroller operation.
    And another problem in the program published above - out of range of the variable Out. Glitches removed until the new found. Working.

Subscribe to our newsletter

It's sent once a month, you can unsubscribe at anytime!

View archive of previous newsletters

* indicates required

Your email address will be used to send you email newsletters only. See our Privacy Policy for more information.

Our Partners

Supporting researchers for over 20 years
Want to Advertise or Sponsor LENR Forum?
CLICK HERE to contact us.