![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fork
Fork of LG by
Diff: HFO_Reg.c
- Revision:
- 1:f2adcae3d304
- Parent:
- 0:8ad47e2b6f00
- Child:
- 21:bc8c1cec3da6
--- a/HFO_Reg.c Sat Jan 30 13:00:39 2016 +0000 +++ b/HFO_Reg.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,6 +1,4 @@ -#include "mathDSP.h" -#include "InputOutput.h" -#include "CntrlGLD.h" +#include "Global.h" #define HFO_NEG_MIN 8738 // -4.5 V #define HFO_NEG_MAX 25122 // -10.5 V @@ -19,11 +17,11 @@ void clc_HFO() // --- HFO regulator --- { - static int hf_reg = 0; //r. çíà÷åíèå èíòåãðàòîðà â êîíòóðå ÃÂ× + static int hf_reg = 0; //r. �������� ����������� � ������� ��� ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //r. ôèëüòðàöèÿ âûõîäà àìïë. äåòåêòîðà ïåðåä ïåðåäà÷åé â êîíòóð ÃÂ× + //r. ���������� ������ ����. ��������� ����� ��������� � ������ ��� /*int HFO_MovAverFilt (int Input) { static __int64 smooth_HF = 0; @@ -43,21 +41,21 @@ }*/ -// HFO_SHIFT - ÷èñëî ðàçðÿäîâ äðîáíîé ÷àñòè â 32-õáèòîâîé ïåðåìåííîé hf_reg32 +// HFO_SHIFT - ����� �������� ������� ����� � 32-�������� ���������� hf_reg32 Input.StrIn.HF_out = HFO_MovAverFilt(Input.StrIn.HF_out<<HFO_SHIFT); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Output.Str.HF_dif = L_sub(Device_blk.Str.HF_ref, Input.StrIn.HF_out); // HF_dif = HF_out - Device_blk.Str.HF_ref; - if ( loop_is_closed(HF_REG_ON) ) //e. the regulator loop is closed //r. êîíòóð çàìêíóò - {// êîýôôèöèåíò ïåðåäà÷è + if ( loop_is_closed(HF_REG_ON) ) //e. the regulator loop is closed //r. ������ ������� + {// ����������� �������� hf_reg = L_mac( hf_reg, Output.Str.HF_dif, Device_blk.Str.HF_scl ); // hf_reg32 += HFO_error * Device_blk.Str.HF_scl; - Saturation(hf_reg, Device_blk.Str.HF_max << HFO_SHIFT, Device_blk.Str.HF_min << HFO_SHIFT); //e. checking range //r. ïðîâåðêà äèàïàçîíà if (Uin > UpSat) Uin = UpSat; if (Uin < DownSat) Uin = DownSat; + Saturation(hf_reg, Device_blk.Str.HF_max << HFO_SHIFT, Device_blk.Str.HF_min << HFO_SHIFT); //e. checking range //r. �������� ��������� if (Uin > UpSat) Uin = UpSat; if (Uin < DownSat) Uin = DownSat; Output.Str.HF_reg = (hf_reg >> HFO_SHIFT); // Output.Str.HF_reg - HFO output voltage } else { - hf_reg = Output.Str.HF_reg << HFO_SHIFT; //r. èíòåãðàòîðó ïðèñâàèâàåì ïðåäûäóùåå çíà÷åíèå HF_reg + hf_reg = Output.Str.HF_reg << HFO_SHIFT; //r. ����������� ����������� ���������� �������� HF_reg } // cyclic built-in test