public SourceTemplate2(string _Name, string _polarization, string _distribution, bool _differenceChanel, string _differenceAxis, int _scanning, double _thetaScanE, double _phiScanE, bool _axis1Include, double _axis1x1, double _axis1y1, double _axis1z1, double _axis1x2, double _axis1y2, double _axis1z2, bool _axis2Include, double _axis2x1, double _axis2y1, double _axis2z1, double _axis2x2, double _axis2y2, double _axis2z2, double _thetaScanM, double _phiScanM, CVector i0, CVector m0) { name = _Name; polarization = _polarization; distribution = _distribution; differenceChanel = _differenceChanel; differenceAxis = _differenceAxis; scanning = _scanning; thetaScanE = _thetaScanE; phiScanE = _phiScanE; axis1Include = _axis1Include; axis1x1 = _axis1x1; axis1y1 = _axis1y1; axis1z1 = _axis1z1; axis1x2 = _axis1x2; axis1y2 = _axis1y2; axis1z2 = _axis1z2; axis2Include = _axis2Include; axis2x1 = _axis2x1; axis2y1 = _axis2y1; axis2z1 = _axis2z1; axis2x2 = _axis2x2; axis2y2 = _axis2y2; axis2z2 = _axis2z2; phiScanM = _phiScanM; thetaScanM = _thetaScanM; i = i0; m = m0; }
//private Tuple<CVector, CVector> GetPolarizationCurrents(string changedPolarizatioin) //{ // //polarization detection // //var d = DictionaryLibrary.PolarizationNames; // //int polarization = d.FirstOrDefault(x => x.Value == changedPolarizatioin).Key; // //set currents // CVector electricCurrent = null; // CVector magneticCurrent = null; // if (comboBoxDistribution.SelectedIndex != 2) // { // //ortogonal and parallel vectors detection // double xlength = Logic.Instance.Antenna.XMax - Logic.Instance.Antenna.XMin; // double ylength = Logic.Instance.Antenna.YMax - Logic.Instance.Antenna.YMin; // double zlength = Logic.Instance.Antenna.ZMax - Logic.Instance.Antenna.ZMin; // DVector probeVector; // if (xlength > ylength) // { // if (xlength > zlength) // { // probeVector = new DVector(1, 0, 0); // } // else // { // probeVector = new DVector(0, 0, 1); // } // } // else // { // if (ylength > zlength) // { // probeVector = new DVector(0, 1, 0); // } // else // { // probeVector = new DVector(0, 0, 1); // } // } // DVector normaVector = Logic.Instance.Antenna[0].Norma; // DVector ortogonalVector = DVector.Cross(probeVector, normaVector); // ortogonalVector.Normalize(); // DVector parallelVector = DVector.Cross(ortogonalVector, normaVector); // parallelVector.Normalize(); // if (changedPolarizatioin == "Поляризация А") // { // electricCurrent = new CVector(new Complex(parallelVector.X, 0), new Complex(parallelVector.Y, 0), new Complex(parallelVector.Z, 0)); // magneticCurrent = Z_0 * new CVector(new Complex(ortogonalVector.X, 0), new Complex(ortogonalVector.Y, 0), new Complex(ortogonalVector.Z, 0)); // } // else if (changedPolarizatioin == "Поляризация Б") // { // electricCurrent = new CVector(new Complex(-ortogonalVector.X, 0), new Complex(-ortogonalVector.Y, 0), new Complex(-ortogonalVector.Z, 0)); // magneticCurrent = Z_0 * new CVector(new Complex(parallelVector.X, 0), new Complex(parallelVector.Y, 0), new Complex(parallelVector.Z, 0)); // } // else if (changedPolarizatioin == "Круговая поляризация А") // { // //!!!! запланировано, не работает // electricCurrent = new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); // magneticCurrent = Z_0 * new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); // } // else if (changedPolarizatioin == "Круговая поляризация Б") // { // //!!!!запланировано, не работает // electricCurrent = new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); // magneticCurrent = Z_0 * new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); // } // else if (changedPolarizatioin == "Пользовательская") // { // //!!!!запланировано, не работает // electricCurrent = new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); // magneticCurrent = Z_0 * new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); // } // } // else if (comboBoxDistribution.SelectedIndex == 2) // { // int count = this.I.Length; // double max = this.I[0].Modulus; // int maxIndex = 0; // for (int i = 1; i < count; i++) // { // if (this.I[i].Modulus > max) // { // maxIndex = i; // max = this.I[i].Modulus; // } // } // if (changedPolarizatioin == "Поляризация А") // { // electricCurrent = this.I[maxIndex]; // magneticCurrent = this.M[maxIndex]; // } // else if (changedPolarizatioin == "Поляризация Б") // { // electricCurrent = this.I[maxIndex]; // magneticCurrent = this.M[maxIndex]; // electricCurrent = Current.ChangeLoadedCurrentAnlorithm(electricCurrent, Logic.Instance.Antenna[maxIndex].Norma, 90); // magneticCurrent = Current.ChangeLoadedCurrentAnlorithm(magneticCurrent, Logic.Instance.Antenna[maxIndex].Norma, 90); // } // } // return new Tuple<CVector, CVector>(electricCurrent, magneticCurrent); //} private void SetTextBoxCurrentValues(CVector electricCurrent, CVector magneticCurrent) { if (electricCurrent != null && magneticCurrent != null) { textBoxAppertureIxRe.Text = electricCurrent.X.Real.ToString(Format1); textBoxAppertureIxIm.Text = electricCurrent.X.Imaginary.ToString(Format1); textBoxAppertureIyRe.Text = electricCurrent.Y.Real.ToString(Format1); textBoxAppertureIyIm.Text = electricCurrent.Y.Imaginary.ToString(Format1); textBoxAppertureIzRe.Text = electricCurrent.Z.Real.ToString(Format1); textBoxAppertureIzIm.Text = electricCurrent.Z.Imaginary.ToString(Format1); textBoxAppertureMxRe.Text = magneticCurrent.X.Real.ToString(Format1); textBoxAppertureMxIm.Text = magneticCurrent.X.Imaginary.ToString(Format1); textBoxAppertureMyRe.Text = magneticCurrent.Y.Real.ToString(Format1); textBoxAppertureMyIm.Text = magneticCurrent.Y.Imaginary.ToString(Format1); textBoxAppertureMzRe.Text = magneticCurrent.Z.Real.ToString(Format1); textBoxAppertureMzIm.Text = magneticCurrent.Z.Imaginary.ToString(Format1); } else { textBoxAppertureIxRe.Text = "NAN"; textBoxAppertureIxIm.Text = "NAN"; textBoxAppertureIyRe.Text = "NAN"; textBoxAppertureIyIm.Text = "NAN"; textBoxAppertureIzRe.Text = "NAN"; textBoxAppertureIzIm.Text = "NAN"; textBoxAppertureMxRe.Text = "NAN"; textBoxAppertureMxIm.Text = "NAN"; textBoxAppertureMyRe.Text = "NAN"; textBoxAppertureMyIm.Text = "NAN"; textBoxAppertureMzRe.Text = "NAN"; textBoxAppertureMzIm.Text = "NAN"; } }
private void GenerateCosOnStepApperture(CVector i_a, CVector m_a, double delta) //i_a, m_a - двумерные вектора, связанные с плоскостью апертуры) { CVector[] VectorI = new CVector[Count]; CVector[] VectorM = new CVector[Count]; Point3D[] Segments = new Point3D[Count]; double[] Square = new double[Count]; double xlen = XMax - XMin; double ylen = YMax - YMin; double zlen = ZMax - ZMin; double Ra = 0; if (xlen >= ylen && xlen >= zlen) { Ra = xlen / 2; } else if (ylen >= zlen) { Ra = ylen / 2; } else { Ra = zlen / 2; } for (int p = 0; p < Count; p++) { Point3D position = this[p].Center; DVector n = this[p].Norma; DVector ran = new DVector(1, 0, 0); if (DVector.IsEqual(n, ran, 4) || DVector.IsEqual((-1) * n, ran, 4)) { ran = new DVector(0, 1, 0); } //базисные вектора в плоскости апертуры DVector e_u = DVector.Cross(n, ran); e_u.Normalize(); DVector e_v = DVector.Cross(n, e_u); e_v.Normalize(); double c1 = (1 + delta * Math.Cos(Math.PI * Point3D.Distance(position, this.Center) / Ra)) / (1 + delta); CVector i = c1 * (i_a.X * e_u + i_a.Y * e_v); CVector m = c1 * (m_a.X * e_u + m_a.Y * e_v); VectorI[p] = i; VectorM[p] = m; Segments[p] = this[p].Center; Square[p] = this[p].Area; } ApertureCurrent = new Current(VectorI, VectorM, Segments, Square); //electricCurrent = new Current(VectorI, Segments); //magneticCurrent = new Current(VectorM, Segments); }
public static CVector Cross(CVector v1, DVector v2) { Complex x = v1.Y * v2.Z - v1.Z * v2.Y; Complex y = v1.Z * v2.X - v1.X * v2.Z; Complex z = v1.X * v2.Y - v1.Y * v2.X; return(new CVector(x, y, z)); }
public static CVector Cross(CVector v1, CVector v3) { CVector v2 = new CVector(Complex.Conjugate(v3.X), Complex.Conjugate(v3.Y), Complex.Conjugate(v3.Z)); Complex x = v1.Y * v2.Z - v1.Z * v2.Y; Complex y = v1.Z * v2.X - v1.X * v2.Z; Complex z = v1.X * v2.Y - v1.Y * v2.X; return(new CVector(x, y, z)); }
private void DifferenceRadiationPattern(string axis) { int axisNumber = 1; switch (axis) { case "Плоскость XY": axisNumber = 1; break; case "Плоскость YZ": axisNumber = 2; break; case "Плоскость XZ": axisNumber = 3; break; default: break; } double c = 1; Point3D center = Center; CVector[] VectorI = new CVector[Count]; CVector[] VectorM = new CVector[Count]; //Point3D[] Position = new Point3D[Count]; //Triangle[] Segments = new Triangle[Count]; //double[] square = new double[Count]; for (int n = 0; n < Count; n++) { c = 1; Point3D position = this[n].Center; if (axisNumber == 2 && position.X < center.X) { c = -1; } if (axisNumber == 3 && position.Y < center.Y) { c = -1; } if (axisNumber == 1 && position.Z < center.Z) { c = -1; } if (c == -1) { ApertureCurrent[n].I.CVector = c * ApertureCurrent[n].I.CVector; ApertureCurrent[n].M.CVector = c * ApertureCurrent[n].M.CVector; } } }
public static CVector ChangeLoadedCurrentAnlorithm(CVector v, DVector n, double angle) { float rangle = (float)(angle / 180 * CV.pi); SharpDX.Matrix m = SharpDX.Matrix.RotationAxis(new SharpDX.Vector3((float)n.X, (float)n.Y, (float)n.Z), rangle); SharpDX.Vector3 reV = new SharpDX.Vector3((float)v.X.Real, (float)v.Y.Real, (float)v.Z.Real); SharpDX.Vector3 imV = new SharpDX.Vector3((float)v.X.Imaginary, (float)v.Y.Imaginary, (float)v.Z.Imaginary); SharpDX.Vector3 reVrot = SharpDX.Vector3.TransformCoordinate(reV, m); SharpDX.Vector3 imVrot = SharpDX.Vector3.TransformCoordinate(imV, m); return(new CVector(new Complex(reVrot.X, imVrot.X), new Complex(reVrot.Y, imVrot.Y), new Complex(reVrot.Z, imVrot.Z))); }
internal void GeneratePolarizationCurrents(string distribution) { CVector[] polI = new CVector[DictionaryLibrary.PolarizationNames.Count]; CVector[] polM = new CVector[DictionaryLibrary.PolarizationNames.Count]; for (int p = 0; p < DictionaryLibrary.PolarizationNames.Count; p++) { var currentTuple = SourceTemplate2.GetPolarizationCurrents(DictionaryLibrary.PolarizationNames[p], distribution); polI[p] = currentTuple.Item1; polM[p] = currentTuple.Item2; } SourceTemplate2.I0 = polI; SourceTemplate2.M0 = polM; }
private void GenerateLoadedCurrents(CVector[] i, CVector[] m) { CVector[] VectorI = new CVector[Count]; CVector[] VectorM = new CVector[Count]; Point3D[] Segments = new Point3D[Count]; double[] Area = new double[Count]; for (int k = 0; k < Count; k++) { VectorI[k] = i[k]; VectorM[k] = m[k]; Segments[k] = this[k].Center; Area[k] = this[k].Area; } ApertureCurrent = new Current(VectorI, VectorM, Segments, Area); }
private void GenerateConstantCurrentApperture(CVector i, CVector m) { CVector[] VectorI = new CVector[Count]; CVector[] VectorM = new CVector[Count]; Point3D[] Segments = new Point3D[Count]; double[] Area = new double[Count]; for (int k = 0; k < Count; k++) { VectorI[k] = i; VectorM[k] = m; Segments[k] = this[k].Center; Area[k] = this[k].Area; } ApertureCurrent = new Current(VectorI, VectorM, Segments, Area); // magneticCurrent = new Current(VectorM, Segments); }
public CVector(CVector vector) { X = vector.X; Y = vector.Y; Z = vector.Z; }
//Статические методы класса public static Current CurrentsExitetion(NearFieldC incidentfield, Radome obj, Direction direction) { double nx, ny, nz; Complex ex, ey, ez, hx, hy, hz; Complex ix, iy, iz, mx, my, mz; int trianglesNumber = incidentfield.Count; CVector[] I = new CVector[trianglesNumber]; CVector[] M = new CVector[trianglesNumber]; Point3D[] Place = new Point3D[trianglesNumber]; double[] Area = new double[trianglesNumber]; int h = 0; for (int r = 0; r < obj.Count; r++) { RadomeElement geomObj = obj[r]; int countElements = geomObj.Count; for (int j = 0; j < countElements; j++) { // // Выбор нормали // //Triangle element = geomObj.triangles[j]; double upDown = 1; if (direction == Direction.Inside) { upDown = -1; } nx = upDown * geomObj[j].Norma.X; ny = upDown * geomObj[j].Norma.Y; nz = upDown * geomObj[j].Norma.Z; // // Загрузка полей // ex = incidentfield[h].E.X; ey = incidentfield[h].E.Y; ez = incidentfield[h].E.Z; hx = incidentfield[h].H.X; hy = incidentfield[h].H.Y; hz = incidentfield[h].H.Z; // // Расчет возбуждаемых токов // ix = hz * ny - hy * nz; //x - компонента электрического тока на внутренней стороне укрытия iy = hx * nz - hz * nx; //y - компонента электрического тока на внутренней стороне укрытия iz = hy * nx - hx * ny; //z - компонента электрического тока на внутренней стороне укрытия mx = nz * ey - ny * ez; //x - компонента магнитного тока на внутренней стороне укрытия my = nx * ez - nz * ex; //y - компонента магнитного тока на внутренней стороне укрытия mz = ny * ex - nx * ey; //z - компонента магнитного тока на внутренней стороне укрытия I[h] = new CVector(ix, iy, iz); M[h] = new CVector(mx, my, mz); Place[h] = geomObj[j].Center; Area[h] = geomObj[j].Area; h++; } } return(new Current(I, M, Place, Area)); }
public NearFieldElement(CVector e, CVector h, Point3D loc) { E = e; H = h; Place = loc; }
public static void SetStaticSourceParameters(CreateApertureForm form) { string distribution = form.comboBoxDistribution.SelectedItem.ToString(); string lable = form.textBoxApertureTitle.Text; CVector[] picur = new CVector[DictionaryLibrary.PolarizationNames.Count]; CVector[] pmcur = new CVector[DictionaryLibrary.PolarizationNames.Count]; //foreach (var pol in DictionaryLibrary.PolarizationNames) //{ // string name = pol.Value; // if (form.comboBoxDistribution.SelectedIndex == 0 || form.comboBoxDistribution.SelectedIndex == 1) //постоянное поле или спадающий косинус // { // } // else if (form.comboBoxDistribution.SelectedIndex == 2) //загрузка из файла // { // } //} //Polarization = form.comboBoxPolarization.SelectedIndex; bool difference = true; if (form.radioButtonChannel1.Checked) { difference = false; } Dictionary <string, bool> polariz = new Dictionary <string, bool>(); //new bool[form.checkedListBoxPolarization.Items.Count]; for (int i = 0; i < form.checkedListBoxPolarization.Items.Count; i++) { polariz.Add(form.checkedListBoxPolarization.Items[i].ToString(), form.checkedListBoxPolarization.GetItemChecked(i)); } string axis = form.comboBoxDiffAxis.SelectedItem.ToString(); int scan = form.comboBoxScanning.SelectedIndex; int systemOfCoordScan = form.comboBoxSysOfCoordScan.SelectedIndex; double scanThetaStart = Convert.ToDouble(form.textBoxScanThetaStart.Text); double scanThetaFinish = Convert.ToDouble(form.textBoxScanThetaFinish.Text); double scanThetaStep = Convert.ToDouble(form.textBoxScanThetaStep.Text); double phiScanEStart = Convert.ToDouble(form.textBoxScanPhiStart.Text); double phiScanEFinish = Convert.ToDouble(form.textBoxScanPhiFinish.Text); double phiScanEStep = Convert.ToDouble(form.textBoxScanPhiStep.Text); bool includeAxis1 = false; if (form.comboBoxAxis1.SelectedIndex == 1) { includeAxis1 = true; } double axis1x1 = Convert.ToDouble(form.textBoxRotAxis1X1.Text); double axis1y1 = Convert.ToDouble(form.textBoxRotAxis1Y1.Text); double axis1z1 = Convert.ToDouble(form.textBoxRotAxis1Z1.Text); bool includeAxis2 = false; if (form.comboBoxAxis2.SelectedIndex == 1) { includeAxis2 = true; } double axis1x2 = Convert.ToDouble(form.textBoxRotAxis1X2.Text); double axis1y2 = Convert.ToDouble(form.textBoxRotAxis1Y2.Text); double axis1z2 = Convert.ToDouble(form.textBoxRotAxis1Z2.Text); double axis2x1 = Convert.ToDouble(form.textBoxRotAxis2X1.Text); double axis2y1 = Convert.ToDouble(form.textBoxRotAxis2Y1.Text); double axis2z1 = Convert.ToDouble(form.textBoxRotAxis2Z1.Text); double axis2x2 = Convert.ToDouble(form.textBoxRotAxis2X2.Text); double axis2y2 = Convert.ToDouble(form.textBoxRotAxis2Y2.Text); double axis2z2 = Convert.ToDouble(form.textBoxRotAxis2Z2.Text); double phiScanMStart = Convert.ToDouble(form.textBoxMAngle2Start.Text); double phiScanMFinish = Convert.ToDouble(form.textBoxMAngle2Finish.Text); double phiScanMStep = Convert.ToDouble(form.textBoxMAngle2Step.Text); double thetaScanMStart = Convert.ToDouble(form.textBoxMAngle1Start.Text); double thetaScanMFinish = Convert.ToDouble(form.textBoxMAngle1Finish.Text); double thetaScanMStep = Convert.ToDouble(form.textBoxMAngle1Step.Text); SetStaticSourceParameters(lable, form.I, form.M, polariz, distribution, difference, axis, scan, systemOfCoordScan, scanThetaStart, scanThetaFinish, scanThetaStep, phiScanEStart, phiScanEFinish, phiScanEStep, includeAxis1, axis1x1, axis1y1, axis1z1, axis1x2, axis1y2, axis1z2, includeAxis2, axis2x1, axis2y1, axis2z1, axis2x2, axis2y2, axis2z2, phiScanMStart, phiScanMFinish, phiScanMStep, thetaScanMStart, thetaScanMFinish, thetaScanMStep); }
public static Complex Scal(CVector v1, CVector v2) { return(v1.X * v2.X + v1.Y * v2.Y + v1.Z * v2.Z); }
public SourceTemplateold(CreateApertureForm form) { Distribution = form.comboBoxDistribution.SelectedItem.ToString(); Lable = form.textBoxApertureTitle.Text; if (Distribution == "Загрузить из файла") { //I = form.icurInfo; //M = form.mcurInfo; } else { Complex Ix = new Complex(Convert.ToDouble(form.textBoxAppertureIxRe.Text), Convert.ToDouble(form.textBoxAppertureIxIm.Text)); Complex Iy = new Complex(Convert.ToDouble(form.textBoxAppertureIyRe.Text), Convert.ToDouble(form.textBoxAppertureIyIm.Text)); Complex Iz = new Complex(Convert.ToDouble(form.textBoxAppertureIzRe.Text), Convert.ToDouble(form.textBoxAppertureIzIm.Text)); Complex Mx = new Complex(Convert.ToDouble(form.textBoxAppertureMxRe.Text), Convert.ToDouble(form.textBoxAppertureMxIm.Text)); Complex My = new Complex(Convert.ToDouble(form.textBoxAppertureMyRe.Text), Convert.ToDouble(form.textBoxAppertureMyIm.Text)); Complex Mz = new Complex(Convert.ToDouble(form.textBoxAppertureMzRe.Text), Convert.ToDouble(form.textBoxAppertureMzIm.Text)); I = new CVector[1]; M = new CVector[1]; for (int i = 0; i < 1; i++) { I[i] = new CVector(Ix, Iy, Iz); M[i] = new CVector(Mx, My, Mz); } } //Polarization = form.comboBoxPolarization.SelectedIndex; if (form.radioButtonChannel1.Checked) { DifferenceChanel = false; } else { DifferenceChanel = true; } DifferenceAxis = form.comboBoxDiffAxis.SelectedItem.ToString(); Scanning = form.comboBoxScanning.SelectedIndex; SystemOfCoordinatesScan = form.comboBoxSysOfCoordScan.SelectedIndex; ThetaScanEStart = Convert.ToDouble(form.textBoxScanThetaStart.Text); ThetaScanEFinish = Convert.ToDouble(form.textBoxScanThetaFinish.Text); ThetaScanEStep = Convert.ToDouble(form.textBoxScanThetaStep.Text); PhiScanEStart = Convert.ToDouble(form.textBoxScanPhiStart.Text); PhiScanEFinish = Convert.ToDouble(form.textBoxScanPhiFinish.Text); PhiScanEStep = Convert.ToDouble(form.textBoxScanPhiStep.Text); axis1x1 = Convert.ToDouble(form.textBoxRotAxis1X1.Text); axis1y1 = Convert.ToDouble(form.textBoxRotAxis1Y1.Text); axis1z1 = Convert.ToDouble(form.textBoxRotAxis1Z1.Text); axis1x2 = Convert.ToDouble(form.textBoxRotAxis1X2.Text); axis1y2 = Convert.ToDouble(form.textBoxRotAxis1Y2.Text); axis1z2 = Convert.ToDouble(form.textBoxRotAxis1Z2.Text); axis2x1 = Convert.ToDouble(form.textBoxRotAxis2X1.Text); axis2y1 = Convert.ToDouble(form.textBoxRotAxis2Y1.Text); axis2z1 = Convert.ToDouble(form.textBoxRotAxis2Z1.Text); axis2x2 = Convert.ToDouble(form.textBoxRotAxis2X2.Text); axis2y2 = Convert.ToDouble(form.textBoxRotAxis2Y2.Text); axis2z2 = Convert.ToDouble(form.textBoxRotAxis2Z2.Text); PhiScanMStart = Convert.ToDouble(form.textBoxMAngle2Start.Text); PhiScanMFinish = Convert.ToDouble(form.textBoxMAngle2Finish.Text); PhiScanMStep = Convert.ToDouble(form.textBoxMAngle2Step.Text); ThetaScanMStart = Convert.ToDouble(form.textBoxMAngle1Start.Text); ThetaScanMFinish = Convert.ToDouble(form.textBoxMAngle1Finish.Text); ThetaScanMStep = Convert.ToDouble(form.textBoxMAngle1Step.Text); }
public static Tuple <CVector, CVector> GetPolarizationCurrents(string changedPolarizatioin, string distribution) { //polarization detection //var d = DictionaryLibrary.PolarizationNames; //int polarization = d.FirstOrDefault(x => x.Value == changedPolarizatioin).Key; //set currents CVector electricCurrent = null; CVector magneticCurrent = null; if (distribution == "Постоянное поле" || distribution == "Косинус на пьедестале") { //ortogonal and parallel vectors detection double xlength = Logic.Instance.Antenna.XMax - Logic.Instance.Antenna.XMin; double ylength = Logic.Instance.Antenna.YMax - Logic.Instance.Antenna.YMin; double zlength = Logic.Instance.Antenna.ZMax - Logic.Instance.Antenna.ZMin; DVector probeVector; if (xlength > ylength) { if (xlength > zlength) { probeVector = new DVector(1, 0, 0); } else { probeVector = new DVector(0, 0, 1); } } else { if (ylength > zlength) { probeVector = new DVector(0, 1, 0); } else { probeVector = new DVector(0, 0, 1); } } DVector normaVector = Logic.Instance.Antenna[0].Norma; DVector ortogonalVector = DVector.Cross(probeVector, normaVector); ortogonalVector.Normalize(); DVector parallelVector = DVector.Cross(ortogonalVector, normaVector); parallelVector.Normalize(); if (changedPolarizatioin == "Поляризация А") { electricCurrent = new CVector(new Complex(parallelVector.X, 0), new Complex(parallelVector.Y, 0), new Complex(parallelVector.Z, 0)); magneticCurrent = CV.Z_0 * new CVector(new Complex(ortogonalVector.X, 0), new Complex(ortogonalVector.Y, 0), new Complex(ortogonalVector.Z, 0)); } else if (changedPolarizatioin == "Поляризация Б") { electricCurrent = new CVector(new Complex(-ortogonalVector.X, 0), new Complex(-ortogonalVector.Y, 0), new Complex(-ortogonalVector.Z, 0)); magneticCurrent = CV.Z_0 * new CVector(new Complex(parallelVector.X, 0), new Complex(parallelVector.Y, 0), new Complex(parallelVector.Z, 0)); } else if (changedPolarizatioin == "Круговая поляризация А") { //!!!! запланировано, не работает electricCurrent = new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); magneticCurrent = CV.Z_0 * new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); } else if (changedPolarizatioin == "Круговая поляризация Б") { //!!!!запланировано, не работает electricCurrent = new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); magneticCurrent = CV.Z_0 * new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); } else if (changedPolarizatioin == "Пользовательская") { //!!!!запланировано, не работает electricCurrent = new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); magneticCurrent = CV.Z_0 * new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0)); } } else if (distribution == "Загрузить из файла") { int count = I.Length; double max = I[0].Modulus; int maxIndex = 0; for (int i = 1; i < count; i++) { if (I[i].Modulus > max) { maxIndex = i; max = I[i].Modulus; } } if (changedPolarizatioin == "Поляризация А") { electricCurrent = I[maxIndex]; magneticCurrent = M[maxIndex]; } else if (changedPolarizatioin == "Поляризация Б") { electricCurrent = I[maxIndex]; magneticCurrent = M[maxIndex]; electricCurrent = Current.ChangeLoadedCurrentAnlorithm(electricCurrent, Logic.Instance.Antenna[maxIndex].Norma, 90); magneticCurrent = Current.ChangeLoadedCurrentAnlorithm(magneticCurrent, Logic.Instance.Antenna[maxIndex].Norma, 90); } } return(new Tuple <CVector, CVector>(electricCurrent, magneticCurrent)); }
public NearFieldElement() { E = new CVector(); H = new CVector(); Place = new Point3D(0, 0, 0); }
public CurrentElement(CVector cvec) { this.X = cvec.X; this.Y = cvec.Y; this.Z = cvec.Z; }
public static NearFieldC SurfaceCurToGeometryCs(Aperture app, Radome geom, double freq, float dim, int proc) { Complex imOneMin = new Complex(0, -1); // минус мнимая единица double pi = CV.pi; Complex imOne = new Complex(0, 1); double Lambda = CV.c_0 / freq; double Omega = 2 * pi * freq; double K_0 = 2 * pi / Lambda; // волновое число 2pi/lambda double K2 = K_0 * K_0; Complex iomega = imOne * Omega; Complex Ekoeff = (-1.0) / (iomega * CV.E_0); // 1/i*omega*E_0 Complex Mukoeff = (-1.0) / (iomega * CV.Mu_0); // -1/i*omega*Mu_0 int ApSize = app.Count; double[] ApX = new double[ApSize]; double[] ApY = new double[ApSize]; double[] ApZ = new double[ApSize]; double[] ApS = new double[ApSize]; float dim2 = dim * dim; for (int i = 0; i < ApSize; i++) { ApX[i] = dim * app[i].Center.X; ApY[i] = dim * app[i].Center.Y; ApZ[i] = dim * app[i].Center.Z; ApS[i] = dim2 * app[i].Area; } Complex[] Ix = new Complex[ApSize]; Complex[] Iy = new Complex[ApSize]; Complex[] Iz = new Complex[ApSize]; Complex[] Mx = new Complex[ApSize]; Complex[] My = new Complex[ApSize]; Complex[] Mz = new Complex[ApSize]; for (int j = 0; j < ApSize; j++) { Ix[j] = app.ApertureCurrent[j].I.X; Iy[j] = app.ApertureCurrent[j].I.Y; Iz[j] = app.ApertureCurrent[j].I.Z; Mx[j] = app.ApertureCurrent[j].M.X; My[j] = app.ApertureCurrent[j].M.Y; Mz[j] = app.ApertureCurrent[j].M.Z; } int GeoSize = geom.CountElements; double[] GeoX = new double[GeoSize]; double[] GeoY = new double[GeoSize]; double[] GeoZ = new double[GeoSize]; int h = 0; for (int r = 0; r < geom.Count; r++) { RadomeElement finalGeom = geom[r]; for (int k = 0; k < finalGeom.Count; k++) { GeoX[h] = finalGeom[h].Center.X * dim; GeoY[h] = finalGeom[h].Center.Y * dim; GeoZ[h] = finalGeom[h].Center.Z * dim; h++; } } Complex ex, ey, ez, hx, hy, hz; NearFieldC outField = new NearFieldC(GeoSize); for (int j = 0; j < GeoSize; j++) { //st.Start(); ex = new System.Numerics.Complex(0, 0); ey = new System.Numerics.Complex(0, 0); ez = new System.Numerics.Complex(0, 0); hx = new System.Numerics.Complex(0, 0); hy = new System.Numerics.Complex(0, 0); hz = new System.Numerics.Complex(0, 0); float xsecond = Convert.ToSingle(GeoX[j] * dim); float ysecond = Convert.ToSingle(GeoY[j] * dim); float zsecond = Convert.ToSingle(GeoZ[j] * dim); Point3D pointsecond = new Point3D(xsecond, ysecond, zsecond); for (int p = 0; p < ApSize; p++) { // // Координаты // float xprime = Convert.ToSingle(ApX[p] * dim); float yprime = Convert.ToSingle(ApY[p] * dim); float zprime = Convert.ToSingle(ApZ[p] * dim); Point3D pointprime = new Point3D(xprime, yprime, zprime); CVector i = new CVector(Ix[p], Iy[p], Iz[p]); CVector m = new CVector(Mx[p], My[p], Mz[p]); float square = Convert.ToSingle(ApS[p] * dim2); //Field FieldC = ElementFieldCalcP(icur, mcur, pointprime, pointsecond, square); // // Переменные // double x_x0 = xprime - xsecond; double y_y0 = yprime - ysecond; double z_z0 = zprime - zsecond; double x2 = x_x0 * x_x0; double y2 = y_y0 * y_y0; double z2 = z_z0 * z_z0; double r = Math.Sqrt(x2 + y2 + z2); Complex exp_ikr = new Complex(Math.Cos(K_0 * r), -Math.Sin(K_0 * r)); //Complex exp_ikr = Complex.Exp(imOneMin * K_0 * r); Complex funG = exp_ikr / (4 * pi * r); double r2 = r * r; double r4 = r2 * r2; // //НАЧАЛО КОСТИНЫ ФОРМУЛЫ // Complex coeffA = imOneMin * K_0 / r - 1.0 / r2; Complex coeffB = (3.0 + 3.0 * imOne * K_0 * r - K2 * r2) / r4; Complex dx = x_x0 * coeffA * funG; Complex dy = y_y0 * coeffA * funG; Complex dz = z_z0 * coeffA * funG; Complex dxx = (x2 * coeffB + coeffA) * funG; Complex dyy = (y2 * coeffB + coeffA) * funG; Complex dzz = (z2 * coeffB + coeffA) * funG; Complex dxy = (x_x0 * y_y0 * coeffB) * funG; Complex dxz = (x_x0 * z_z0 * coeffB) * funG; Complex dyz = (y_y0 * z_z0 * coeffB) * funG; // // КОНЕЦ // ex += (-1) * (Ekoeff * (K2 * i.X * funG + i.X * dxx + i.Y * dxy + i.Z * dxz) * square - (m.Z * dy - m.Y * dz) * square); //- ey += (-1) * (Ekoeff * (K2 * i.Y * funG + i.Y * dyy + i.Z * dyz + i.X * dxy) * square - (m.X * dz - m.Z * dx) * square); //- ez += (-1) * (Ekoeff * (K2 * i.Z * funG + i.Z * dzz + i.X * dxz + i.Y * dyz) * square - (m.Y * dx - m.X * dy) * square); //- hx += (-1) * (Mukoeff * (K2 * m.X * funG + m.X * dxx + m.Y * dxy + m.Z * dxz) * square + (i.Z * dy - i.Y * dz) * square); //+ hy += (-1) * (Mukoeff * (K2 * m.Y * funG + m.X * dxy + m.Y * dyy + m.Z * dyz) * square + (i.X * dz - i.Z * dx) * square); //+ hz += (-1) * (Mukoeff * (K2 * m.Z * funG + m.X * dxz + m.Y * dyz + m.Z * dzz) * square + (i.Y * dx - i.X * dy) * square); //+ } outField[j].E = new CVector(ex, ey, ez); outField[j].H = new CVector(hx, hy, hz); outField[j].Place = new Point3D(GeoX[j], GeoY[j], GeoZ[j]); } return(outField); }
public DVector GetPolarization(double thetaG, double phiG) { double x = Math.Sin(thetaG * Math.PI / 180) * Math.Cos(phiG * Math.PI / 180); double y = Math.Sin(thetaG * Math.PI / 180) * Math.Sin(phiG * Math.PI / 180); double z = Math.Cos(thetaG * Math.PI / 180); DVector J = new DVector(x - Center.X, y - Center.Y, z - Center.Z); J.Normalize(); DVector n = new DVector(this[0].Norma); n.Normalize(); DVector e_u = Aperture.GetUVector(n); DVector e_v = Aperture.GetVVector(n); Complex i_u = CVector.Scal(ApertureCurrent.I[0].CVector, e_u); Complex i_v = CVector.Scal(ApertureCurrent.I[0].CVector, e_v); DVector e_y = i_v.Magnitude * e_v + i_u.Magnitude * e_u; DVector e_x = DVector.Cross(e_y, n); e_x.Normalize(); e_y.Normalize(); double J_zLoc = DVector.Scal(J, n); if (J_zLoc > 1) { J_zLoc = 1; } if (J_zLoc < -1) { J_zLoc = -1; } double thetaLoc = Math.Acos(J_zLoc); // угол theta в локальной системе координат, в радианах double J_xLoc = DVector.Scal(e_x, J); if (J_xLoc > 1) { J_xLoc = 1; } double J_yLoc = DVector.Scal(e_y, J); if (J_yLoc > 1) { J_yLoc = 1; } double phiLoc = Math.Atan2(J_yLoc, J_xLoc); DVector e_phiLoc = DVector.Cross(n, J_xLoc * e_x + J_yLoc * e_y); e_phiLoc.Normalize(); DVector e_thetaLoc = DVector.Cross(e_phiLoc, J); e_thetaLoc.Normalize(); DVector p = (Math.Cos(thetaLoc) + 1) * Math.Sin(phiLoc) * e_thetaLoc + (1 + Math.Cos(thetaLoc)) * Math.Cos(phiLoc) * e_phiLoc; p.Normalize(); return(p); }