private void trmTick_Tick(object sender, EventArgs e) { TT01.Update(Airheater.y); PI.r = OPC_r.Read(); Airheater.u = PI.Compute(TT01.PV); OPC_u.Write(PI.U); }
public double Compute(double PV)//Standard PI controller with anti wind-up { r = OPC_R.Read(); e = r - PV; P = Kp * e; I = I + e * (Kp * Ts) / Ti; if (I > MaxU) { I = MaxU; } else if (I < MinU) { I = MinU; } if (P + I > MaxU) { U = MaxU; } else if (P + I < MinU) { U = MinU; } else { U = P + I; } OPC_U.Write(U); return(U); }
public void Update()//For real processs { NI_R.Value = (OPC_R.Read() * 4 / 50 + 1); OPC_U.Write(NI_U.Value); }