Razvalyaev
7e0063eee0
Все основные файлы подтянуты без изменений Изменены (только папка main_matlab): - заглушки для ненужных функций (main_matlab.c) - iq библиотека (IQmathLib_matlab.c) - библиотеки DSP281x
51 lines
884 B
C
51 lines
884 B
C
/*
|
|
* limit_lib.c
|
|
*
|
|
* Created on: 15 àâã. 2024 ã.
|
|
* Author: yura
|
|
*/
|
|
|
|
|
|
#include "IQmathLib.h"
|
|
#include "math_pi.h"
|
|
|
|
|
|
|
|
_iq linear_decrease(float current, int alarm_level, int warnig_level) {
|
|
float delta = current - warnig_level;
|
|
float max_delta = alarm_level - warnig_level;
|
|
if (delta <= 0 || max_delta <= 0) {
|
|
return CONST_IQ_1;
|
|
} else {
|
|
if (delta>max_delta)
|
|
return 0;
|
|
else
|
|
return CONST_IQ_1 - _IQ(delta / max_delta);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_iq linear_decrease_iq(_iq current, _iq alarm_level, _iq warnig_level)
|
|
{
|
|
_iq delta = current - warnig_level;
|
|
|
|
_iq max_delta = alarm_level - warnig_level;
|
|
|
|
if (delta <= 0 || max_delta <= 0) {
|
|
return CONST_IQ_1;
|
|
} else {
|
|
if (delta>=max_delta)
|
|
return 0;
|
|
else
|
|
return CONST_IQ_1 - _IQdiv(delta, max_delta);
|
|
}
|
|
}
|
|
|
|
|
|
|