public float CalRealVal(int gear, int channel, float freq, float adVal) { ChannelParam param = listChannel[channel]; int index = -1; float diffFreq = float.MaxValue; IList <CalcItem> listCal = param.CalcList; for (int i = 0; i < listCal.Count; i++) { if (listCal[i].Gear != gear) { continue; } if (Math.Abs(listCal[i].Freq - freq) < diffFreq) { index = i; diffFreq = Math.Abs(listCal[i].Freq - freq); } } float realValue = adVal; if (index >= 0) { realValue = listCal[index].CoeffK * adVal + listCal[index].CoeffB; } return(realValue); }
public FormCalParam(ChannelParam param) : this() { textBox1.Text = param.ChannnelNum.ToString(); textBox2.Text = param.State.ToString(); textBox3.Text = param.SampleRate.ToString(); textBox4.Text = param.ChannelType.ToString(); textBox5.Text = param.Person; textBox6.Text = param.Time.ToString("yyyy-MM-dd"); gridControl1.DataSource = param.CalcList; }
public void UpdateChannelParam(ChannelParam param) { int chNum = param.ChannnelNum; listChannel[chNum] = param; }