Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (CheckConvertToDoubleAll())
     {
         if (!CheckApertureNameMatching(textBoxApertureTitle.Name))
         {
             if (CheckEnteredValues())
             {
                 SaveCurrentParameters();
                 SourceTemplate2.SetStaticSourceParameters(this);
                 SourceTemplate2.CreateSources();
                 if (reducting)
                 {
                     parent.ChangeSource();
                 }
                 else
                 {
                     parent.CleareSource();
                     //parent.AddSource(template);
                 }
                 Close();
             }
         }
         else
         {
             textBoxApertureTitle.BackColor = System.Drawing.Color.Red;
         }
     }
 }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        //динамические методы класса
        public void Generate(double f, SourceTemplate2 source)
        {
            switch (SourceTemplate2.Distribution)
            {
            case "Постоянное поле":
                GenerateConstantCurrentApperture(source.i, source.m);
                break;

            case "Косинус на пьедестале":
                GenerateCosOnStepApperture(source.i, source.m, 1);
                break;

            case "Загрузить из файла":
                GenerateLoadedCurrents(SourceTemplate2.I, SourceTemplate2.M);

                if (source.polarization == "Поляризация Б")
                {
                    for (int i = 0; i < ApertureCurrent.Count; i++)
                    {
                        ApertureCurrent.I[i].CVector = Current.ChangeLoadedCurrentAnlorithm(ApertureCurrent.I[i].CVector, this[i].Norma, 90);
                        ApertureCurrent.M[i].CVector = Current.ChangeLoadedCurrentAnlorithm(ApertureCurrent.M[i].CVector, this[i].Norma, 90);
                    }
                }
                break;

            default:
                break;
            }

            if (SourceTemplate2.DifferenceChanel)
            {
                DifferenceRadiationPattern(SourceTemplate2.DifferenceAxis);
            }

            if (SourceTemplate2.Scanning == 1)
            {
                ApplyScanning(f, source.thetaScanE, source.phiScanE, 1f);
            }
            else if (SourceTemplate2.Scanning == 2)
            {
                //Механическое сканирование
                ApplyRotation(source.thetaScanM, source.phiScanM,
                              source.axis1Include,
                              source.axis1x1, source.axis1y1, source.axis1z1,
                              source.axis1x2, source.axis1y2, source.axis1z2,
                              source.axis2Include,
                              source.axis2x1, source.axis2y1, source.axis2z1,
                              source.axis2x2, source.axis2y2, source.axis2z2);
            }
        }
        public static void CreateSources()
        {
            int scancount = 1;

            if (Scanning == 1)
            {
                scancount = 0;
                int pointsThetaCount = Convert.ToInt32((ThetaScanEFinish - ThetaScanEStart) / ThetaScanEStep) + 1;
                int pointsPhiCount   = Convert.ToInt32((PhiScanEFinish - PhiScanEStart) / PhiScanEStep) + 1;

                for (int iTheta = 0; iTheta < pointsThetaCount; iTheta++)
                {
                    for (int iPhi = 0; iPhi < pointsPhiCount; iPhi++)
                    {
                        scancount++;
                    }
                }
            }
            else if (Scanning == 2)
            {
                scancount = 0;
                int pointsThetaCount = 1;
                int pointsPhiCount   = 1;
                if (Axis1Include)
                {
                    pointsThetaCount = Convert.ToInt32((ThetaScanMFinish - ThetaScanMStart) / ThetaScanMStep) + 1;
                }
                if (Axis2Include)
                {
                    pointsPhiCount = Convert.ToInt32((PhiScanMFinish - PhiScanMStart) / PhiScanMStep) + 1;
                }


                for (int iTheta = 0; iTheta < pointsThetaCount; iTheta++)
                {
                    for (int iPhi = 0; iPhi < pointsPhiCount; iPhi++)
                    {
                        scancount++;
                    }
                }
            }

            int polcount = 0;


            foreach (var item in Polarization)
            {
                if (item.Value)
                {
                    polcount++;
                }
            }



            int countSorces = scancount * polcount;

            Sources = new SourceTemplate2[countSorces];
            int indexSources = 0;

            if (Scanning == 0)
            {
                foreach (var pol in Polarization)
                {
                    if (pol.Value)
                    {
                        int    key        = DictionaryLibrary.PolarizationNames.FirstOrDefault(x => x.Value == pol.Key).Key;
                        string sourceName = String.Concat(Lable, "_", DictionaryLibrary.PolarizationNamesShort[key]);
                        Sources[indexSources] = new SourceTemplate2(sourceName, pol.Key, Distribution, DifferenceChanel, DifferenceAxis, Scanning, 0, 0, false, 0, 0, 0, 0, 0, 0, false, 0, 0, 0, 0, 0, 0, 0, 0, I0[key], M0[key]);
                        indexSources++;
                    }
                }
            }
            else if (Scanning == 1)
            {
                int pointsThetaCount = Convert.ToInt32((ThetaScanEFinish - ThetaScanEStart) / ThetaScanEStep) + 1;
                int pointsPhiCount   = Convert.ToInt32((PhiScanEFinish - PhiScanEStart) / PhiScanEStep) + 1;

                int index = 0;

                foreach (var pol in Polarization)
                {
                    if (pol.Value)
                    {
                        int key = DictionaryLibrary.PolarizationNames.FirstOrDefault(x => x.Value == pol.Key).Key;
                        for (int iTheta = 0; iTheta < pointsThetaCount; iTheta++)
                        {
                            for (int iPhi = 0; iPhi < pointsPhiCount; iPhi++)
                            {
                                double scanThetaLocal = ThetaScanEStart + iTheta * ThetaScanEStep;
                                double scanPhiLocal   = PhiScanEStart + iPhi * PhiScanEStep;

                                string sourceName = String.Concat(Lable, "_E", "_T", scanThetaLocal.ToString("0.##"), "_P", scanPhiLocal.ToString("0.##"), "_", DictionaryLibrary.PolarizationNamesShort[key]);
                                double scanTheta  = Logic.GetThetaGlobal(scanPhiLocal, scanThetaLocal, SystemOfCoordinatesScan);
                                double scanPhi    = Logic.GetPhiGlobal(scanPhiLocal, scanThetaLocal, SystemOfCoordinatesScan);

                                Sources[index] = new SourceTemplate2(sourceName, pol.Key, Distribution, DifferenceChanel, DifferenceAxis, Scanning, scanTheta, scanPhi, false, 0, 0, 0, 0, 0, 0, false, 0, 0, 0, 0, 0, 0, 0, 0, I0[key], M0[key]);
                                index++;
                            }
                        }
                    }
                }
            }
            else if (Scanning == 2)
            {
                //Механическое сканирование
                int pointsThetaCount = Convert.ToInt32((ThetaScanMFinish - ThetaScanMStart) / ThetaScanMStep) + 1;
                int pointsPhiCount   = Convert.ToInt32((PhiScanMFinish - PhiScanMStart) / PhiScanMStep) + 1;
                if (!Axis1Include)
                {
                    pointsThetaCount = 1;
                    ThetaScanMStart  = 0;
                }
                if (!Axis2Include)
                {
                    pointsPhiCount = 1;
                    PhiScanMStart  = 0;
                }

                int index = 0;

                foreach (var pol in Polarization)
                {
                    if (pol.Value)
                    {
                        int key = DictionaryLibrary.PolarizationNames.FirstOrDefault(x => x.Value == pol.Key).Key;
                        for (int iTheta = 0; iTheta < pointsThetaCount; iTheta++)
                        {
                            for (int iPhi = 0; iPhi < pointsPhiCount; iPhi++)
                            {
                                double scanThetaLocal = ThetaScanMStart + iTheta * ThetaScanMStep;
                                double scanPhiLocal   = PhiScanMStart + iPhi * PhiScanMStep;

                                string sourceName = String.Concat(Lable, "_M", "_T", scanThetaLocal.ToString("0.##"), "_P", scanPhiLocal.ToString("0.##"), "_", DictionaryLibrary.PolarizationNamesShort[key]);

                                Sources[index] = new SourceTemplate2(sourceName, pol.Key, Distribution, DifferenceChanel, DifferenceAxis, Scanning, 0, 0, Axis1Include, Axis1x1, Axis1y1, Axis1z1, Axis1x2, Axis1y2, Axis1z2, Axis2Include, Axis2x1, Axis2y1, Axis2z1, Axis2x2, Axis2y2, Axis2z2, scanThetaLocal, scanPhiLocal, I0[key], M0[key]);
                                index++;
                            }
                        }
                    }
                }
            }
        }