/// <summary> /// Convert a designed nozzle to a spray pattern using the nozzle's flow and calculated spray width /// </summary> /// <param name="_patternname"></param> /// <param name="_nc"></param> /// <returns></returns> public static double[] ConvertDesignToActualSpray(string _patternname, NozzleControl _nc) { double _flow = _nc.NozzleFlow; int _spraywidth = _nc.NozzleSprayWidth; int[] _spray = GetCustomSprayPattern(_patternname); double[] _nozzleprofile = new double[_spraywidth]; if (_spray != null) { //sum all points double _sum = 0; for (int i = 0; i < _spray.Length; i++) { _sum = _sum + (100 - _spray[i]); } //scale up by nozzle flow volume and width of actual spray - not allocated spray width double[] _temp = new double[_spray.Length]; for (int j = 0; j < _temp.Length; j++) { _temp[j] = 1000 * _flow * 100 / _spraywidth * Constants._showerpatternheight / Constants._maximumlitrespermpermin * (100 - _spray[j]) / _sum; } //scale array indices double _scalefactor = 1; _scalefactor = Convert.ToDouble(_spray.Length) / _nozzleprofile.Length; for (int k = 0; k < _nozzleprofile.Length; k++) { if (Convert.ToInt32(k * _scalefactor) < _temp.Length) { _nozzleprofile[k] = (_temp[Convert.ToInt32(k * _scalefactor)]); } } } else//standard nozzle { double _linearprofile = 0; _linearprofile = Constants._showerpatternheight / Constants._maximumlitrespermpermin * (_flow / _spraywidth) * 1000; _nozzleprofile = new double[_spraywidth]; for (int i = 0; i < _spraywidth; i++) { _nozzleprofile[i] = _linearprofile; } _nc.NozzleTypeName = Constants.StandardNozzle; } //return new array return(_nozzleprofile); }
public static double[] MakeSigmoidPattern(NozzleControl _nc, string _systemnozzlename) { double _midpoint = 1; double _slope = 0.3; double _htoffset = 0; double _flow = _nc.NozzleFlow; if (_systemnozzlename == Constants.SystemNozzle1) { _midpoint = 4; _slope = 0.27; _htoffset = 0.1; } else if (_systemnozzlename == Constants.SystemNozzle2) { _midpoint = 1; _slope = 0.2; _htoffset = 0.1; } else if (_systemnozzlename == Constants.SystemNozzle3) { _midpoint = 1; _slope = 0.3; _htoffset = 0.1; } else if (_systemnozzlename == Constants.SystemNozzle4) { _midpoint = 2.3; _slope = 0.18; _htoffset = 0; } else { _midpoint = 1.7; _slope = 0.2; _htoffset = 0.2; } int _spraywidth = _nc.NozzleSprayWidth; double[] _nozzleprofile = new double[_spraywidth]; double[] _spray = new double[100]; for (int i = 0; i < 100; i++) { _spray[i] = (1 / (1 + Math.Exp(-_slope * (25 - Math.Abs(i - 50) - _midpoint))) + _htoffset) / (1 + _htoffset); } //sum all points double _sum = 0; for (int i = 0; i < _spray.Length; i++) { _sum = _sum + _spray[i]; } //scale up by nozzle flow volume and width of actual spray - not allocated spray width double[] _temp = new double[_spray.Length]; for (int j = 0; j < _temp.Length; j++) { _temp[j] = 1000 * _flow * 100 / _spraywidth * Constants._showerpatternheight / Constants._maximumlitrespermpermin * _spray[j] / _sum; } //scale array indices double _scalefactor = 1; _scalefactor = Convert.ToDouble(_spray.Length) / _nozzleprofile.Length; for (int k = 0; k < _nozzleprofile.Length; k++) { if (Convert.ToInt32(k * _scalefactor) < _temp.Length) { _nozzleprofile[k] = (_temp[Convert.ToInt32(k * _scalefactor)]); } } return(_nozzleprofile); }