/// <summary>
        /// 根据给定的条件进行优化设计
        /// </summary>
        public override void Optimize(MainForm form, double progressMin, double progressMax)
        {
            double progress = progressMin;
            double dp       = (progressMax - progressMin) / Math_VbusRange.Length;

            foreach (double Vbus in Math_VbusRange) //母线电压变化
            {
                form.PrintDetails(3, "Now DC bus voltage = " + Vbus + ":");
                //前级DC/DC变换器设计
                form.PrintDetails(3, "-------------------------");
                form.PrintDetails(3, "Front-stage DC/DC converters design...");
                DCDC = new DCDCConverter()
                {
                    PhaseNum                = 1,
                    Math_Psys               = Math_Psys,
                    Math_Vin_min            = Math_Vpv_min,
                    Math_Vin_max            = Math_Vpv_max,
                    IsInputVoltageVariation = true,
                    Math_Vo        = Vbus,
                    NumberRange    = DCDC_numberRange,
                    TopologyRange  = DCDC_topologyRange,
                    FrequencyRange = DCDC_frequencyRange
                };
                DCDC.Optimize(form, progress, progress + dp * 0.2);
                progress += dp * 0.2;
                if (DCDC.AllDesignList.Size <= 0)
                {
                    progress += dp * 0.8;
                    form.Estimate_Result_ProgressBar_Set(progress);
                    continue;
                }
                double dp2 = (dp * 0.8) / Math_VinvRange.Length / IsolatedDCDC_secondaryRange.Length / IsolatedDCDC_numberRange.Length;
                foreach (double Vinv in Math_VinvRange) //逆变直流侧电压变化
                {
                    form.PrintDetails(3, "Now Inv DC voltage = " + Vinv + ":");
                    form.PrintDetails(3, "-------------------------");
                    foreach (int No in IsolatedDCDC_secondaryRange) //一拖N
                    {
                        foreach (int n in IsolatedDCDC_numberRange)
                        {
                            //逆变器设计
                            form.PrintDetails(3, "-------------------------");
                            form.PrintDetails(3, "Inverters design...");
                            DCAC = new DCACConverter()
                            {
                                PhaseNum        = 3,
                                Math_Psys       = Math_Psys,
                                Math_Vin        = Vinv,
                                Math_Vg         = Math_Vg,
                                Math_Vo         = Math_Vg / Math.Sqrt(3),
                                Math_fg         = Math_fg,
                                Math_Ma_min     = DCAC_Ma_min,
                                Math_Ma_max     = DCAC_Ma_max,
                                Math_φ          = DCAC_φ,
                                NumberRange     = new int[] { n *No },
                                TopologyRange   = DCAC_topologyRange,
                                ModulationRange = DCAC_modulationRange,
                                FrequencyRange  = DCAC_frequencyRange
                            };
                            DCAC.Optimize(form, progress, progress + dp2 * 0.3);
                            progress += dp2 * 0.3;
                            if (DCAC.AllDesignList.Size <= 0)
                            {
                                progress += dp2 * 0.7;
                                continue;
                            }

                            //隔离DC/DC变换器设计
                            form.PrintDetails(3, "-------------------------");
                            form.PrintDetails(3, "Isolated DC/DC converters design...");
                            IsolatedDCDC = new IsolatedDCDCConverter()
                            {
                                PhaseNum  = 3,
                                Math_Psys = Math_Psys,
                                Math_Vin  = Vbus,
                                IsInputVoltageVariation = false,
                                Math_Vo        = Vinv,
                                Math_No_Range  = new int[] { No },
                                NumberRange    = new int[] { n },
                                TopologyRange  = IsolatedDCDC_topologyRange,
                                FrequencyRange = IsolatedDCDC_frequencyRange,
                                Math_Q_Range   = IsolatedDCDC_Math_Q_Range,
                                Math_k_Range   = IsolatedDCDC_Math_k_Range
                            };
                            IsolatedDCDC.Optimize(form, progress, progress + dp2 * 0.3);
                            progress += dp2 * 0.3;
                            if (IsolatedDCDC.AllDesignList.Size <= 0)
                            {
                                progress += dp2 * 0.4;
                                continue;
                            }

                            //整合得到最终结果
                            form.PrintDetails(3, "-------------------------");
                            form.PrintDetails(3, "Iso num=" + n + ", Iso sec=" + No + ", DC bus voltage=" + Vbus + ", Combining...");
                            ConverterDesignList newDesignList = new ConverterDesignList();
                            newDesignList.Combine(DCDC.ParetoDesignList);
                            newDesignList.Combine(IsolatedDCDC.ParetoDesignList);
                            newDesignList.Combine(DCAC.ParetoDesignList);
                            newDesignList.Transfer(new string[] { Vbus.ToString(), DCAC.Math_Vin.ToString() });
                            ParetoDesignList.Merge(newDesignList); //记录Pareto最优设计
                            AllDesignList.Merge(newDesignList);    //记录所有设计
                            progress += dp2 * 0.4;
                            form.Estimate_Result_ProgressBar_Set(progress);
                        }
                        form.PrintDetails(3, "=========================");
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 自动设计,整合设计结果(不会覆盖之前的设计结果)
        /// </summary>
        public void Design(MainForm form)
        {
            Topology.Prepare();
            foreach (Component component in Topology.Components)
            {
                component.Design();
                //若没有设计结果,则设计失败
                if (component.DesignList.Size == 0)
                {
                    if (component.Name != null)
                    {
                        form.PrintDetails(1, component.Name + "设计失败!");
                    }
                    else
                    {
                        form.PrintDetails(1, component.GetType().Name + "设计失败!");
                    }
                }
            }

            for (int i = 0; i < Topology.ComponentGroups.Length; i++) //用于记录当前元器件组合的序号
            {
                Component[] components = Topology.ComponentGroups[i];
                //设计结果检查
                bool check = true;
                foreach (Component component in components)
                {
                    if (component.DesignList.Size == 0)
                    {
                        check = false;
                        break;
                    }
                }
                if (!check)
                {
                    continue;
                }

                //组合并记录
                ComponentDesignList designCombinationList = new ComponentDesignList()
                {
                    IsAll = !Configuration.IS_COMPONENT_PARETO
                };
                foreach (Component component in components) //组合各个器件的设计方案
                {
                    if (component.GetType().BaseType.Name.Equals("Semiconductor"))
                    {
                        designCombinationList.Combine(component.DesignList);
                        //Console.WriteLine(component.Name);
                        //IComponentDesignData[] data = component.DesignList.GetData();
                        //foreach(IComponentDesignData design in data)
                        //{
                        //    Console.Write(design.PowerLoss + " ");
                        //    Console.Write(design.Cost + " ");
                        //    Console.Write(design.Volume + ", ");
                        //    foreach (string config in design.Configs)
                        //    {
                        //        Console.Write(config + " ");
                        //    }
                        //    Console.WriteLine();
                        //}
                    }
                }
                designCombinationList.DesignAuxComponent();
                foreach (Component component in components) //组合各个器件的设计方案
                {
                    if (!component.GetType().BaseType.Name.Equals("Semiconductor"))
                    {
                        designCombinationList.Combine(component.DesignList);
                        //Console.WriteLine(component.Name);
                        //IComponentDesignData[] data = component.DesignList.GetData();
                        //foreach (IComponentDesignData design in data)
                        //{
                        //    Console.Write(design.PowerLoss + " ");
                        //    Console.Write(design.Cost + " ");
                        //    Console.Write(design.Volume + ", ");
                        //    foreach (string config in design.Configs)
                        //    {
                        //        Console.Write(config + " ");
                        //    }
                        //    Console.WriteLine();
                        //}
                    }
                }
                //TODO 控制芯片、散热器设计
                ConverterDesignList newDesignList = new ConverterDesignList()
                {
                    IsAll = !Configuration.IS_COMPONENT_PARETO
                };
                newDesignList.Transfer(designCombinationList, Math_Psys, Number, PhaseNum, i, GetConfigs()); //转化为变换器设计
                ParetoDesignList.Merge(newDesignList);                                                       //记录Pareto最优设计
                AllDesignList.Merge(newDesignList);                                                          //记录所有设计
            }
        }