Курсовая работа: Применение нечёткой логики на примере простой модели зарядного устройства для батарей
//функцияпринадлежностидлявысокогонааряжения
public float m_voltage_high(float voltage)
{
const float lo = (float)25.0;
const float lo_plat = (float)30.0;
const float hi_plat = (float)30.0;
const float hi = (float)30.0;
if (voltage < lo) return (float)0.0;
if (voltage > hi) return (float)1.0;
return plateauProfile(voltage, lo, lo_plat, hi_plat, hi);
}
public float chargeControl(float timer )
{
int i = 0;
if ( (i++ % 10) == 0 ) {
if ( normalize(m_voltage_high(voltage)) ==1) {
ChargeMode = TRICKLE_CHARGE;
timer = (float)0.0;
} else if (normalize( m_temp_hot(temperature))==1) {
ChargeMode = TRICKLE_CHARGE;
timer = (float)0.0;
} else if (normalize(
fuzzyAnd(fuzzyNot(m_voltage_high(voltage)),
fuzzyNot(m_temp_hot(temperature))))==1) {
ChargeMode = FAST_CHARGE;
timer = (float)0.0;
}
}
return timer;