Добавил:
Fragga
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Программный комплекс Анализ систем 3.1 / PROG / C / Ctrl
.c/* џ§лЄ C, C++ */
/***********************************************************\
| ќв ЎЁЎ«Ё®вҐЄ Ўл« ᮧ¤ Ї ЄҐв®¬ "Ђ «Ё§ ‘Ёб⥬ 3" |
| (c) …ўбвЁЈҐҐў „.‚. |
\***********************************************************/
/* ђ бзЁв ® ¤«п в Єв а Ў®вл 0.003 ᥪ */
#include <stdio.h>
float NDSum0;
float Propor1;
float Integrator2;
float Integrator2Sum;
float Integrator2Old;
float Diff3;
float Diff3Old;
float Sum4;
float Limit5;
/****************************************************\
| €ЁжЁ «Ё§ жЁп |
\****************************************************/
void Initialization()
{
Integrator2Sum = 0.00000;
Integrator2Old = 0.00000;
Diff3Old = 0.00000;
}
/*****************************************************************\
| Љ®ва®««Ґа Input - ўе®¤®© бЁЈ « ॣг«пв®а |
| ‚®§ўа й Ґв Y - ўл室®© бЁЈ « ॣг«пв®а |
\*****************************************************************/
void Controller(float Input0, float Input1, float *Output0)
{
/*****NDSum0*****/
NDSum0 = Input0;
NDSum0 -= Input1;
/*****Propor1*****/
Propor1 = NDSum0;
Propor1 *= 1.43478261;
/*****Integrator2*****/
Integrator2 = NDSum0;
Integrator2 += Integrator2Old;
Integrator2 *= 0.00652174;
Integrator2Sum += Integrator2;
Integrator2 = Integrator2Sum;
Integrator2Old = NDSum0;
/*****Diff3*****/
Diff3 = NDSum0;
Diff3 -= Diff3Old;
Diff3Old = NDSum0;
Diff3 *= 13.04347826;
/*****Sum4*****/
Sum4 = Propor1;
Sum4 += Integrator2;
Sum4 += Diff3;
/*****Limit5*****/
Limit5 = Sum4;
if (Limit5 > 50)
{
Limit5 = 50;
}
else
{
if (Limit5 < -50)
{
Limit5 = -50;
}
}
*Output0 = Limit5;
}