Exemple #1
0
 public static void WriteToFile(string fileName)
 {
     WriteToTable(Capacitors);
     WriteToTable(Resistors);
     WriteToTable(Inductors);
     AccessDb.WriteToFile(Accdb_Basic, fileName);
 }
Exemple #2
0
        public static DataTable InitiateEmptyTable(string packageName)
        {
            DataTable dt = AccessDb.GetTable("Capacitor - " + packageName);

            dt.Rows.Add(new object[] { "NC_" + packageName, "N/A", "NC", "0pF", packageName, "CAP,SM," + packageName + ",NO POP/DEBUG/PLACE HOLDER", "N/A", "N/A",
                                       "CAPACITOR", @"Basic\Basic.SchLib", packageName + "_NC", @"Basic\Capacitor.PcbLib",
                                       "Ideal Simulation Data", "General", "Capacitor", "X", string.Empty, "(1:1),(2:2)", string.Empty, "Ideal" });
            dt.AcceptChanges();
            return(dt);
        }
Exemple #3
0
        public static DataTable InitiateEmptyTable(string packageCode)
        {
            string    packageName = Packages[packageCode].packageName;
            DataTable dt          = AccessDb.GetTable("Resistor - " + packageName);

            dt.Rows.Add(new object[] { "NC_" + packageName, "N/A", "NC", "1/GMIN", packageName, "RES,SM," + packageName + ",NO POP/DEBUG/PLACE HOLDER", "N/A", "N/A",
                                       "RESISTOR", @"Basic\Basic.SchLib", packageName + "_NC", @"Basic\Resistor.PcbLib",
                                       "Ideal Simulation Data", "General", "Resistor", "X", string.Empty, "(1:1),(2:2)", string.Empty, "Ideal" });

            /*dt.Rows.Add(new object[] { "0R_" + Packages[packageCode].current + "A", "210-000000A-01", "0R", "0.05", packageName,
             *  "RES,SM," + packageName + ",0.05R MAX," + Packages[packageCode].current + "A,THICK_FILM,-55~" + ((packageName == "01005") ? "+125" : "+155") + "DEG(TJ),AEC-Q200",
             *  "KOA Speer", "RK73Z" + packageCode + "T" + Packages[packageCode].pack,
             *  "RESISTOR", @"Basic\Basic.SchLib", packageName + ((packageName == "0201" || packageName == "0402") ? "_GREEN" : string.Empty), @"Basic\Resistor.PcbLib",
             *  "Ideal Simulation Data", "General", "Resistor", "X", string.Empty, "(1:1),(2:2)", string.Empty, "Ideal" });*/
            dt.AcceptChanges();
            return(dt);
        }
Exemple #4
0
        public static void WriteToTable <T>(this IDictionary <string, HashSet <T> > list) where T : Component
        {
            foreach (KeyValuePair <string, HashSet <T> > desc in list)
            {
                HashSet <T> subSet = desc.Value;
                Component   c      = subSet.Where(c0 => c0.Variation.Id == 1).ElementAt(0);

                if (!Accdb_Basic.Keys.Contains(c.TableName))
                {
                    Accdb_Basic.Add(c.TableName, AccessDb.GetTable(c.TableName));
                }

                DataTable dt = Accdb_Basic[c.TableName];
                if (!dt.Rows.Contains(c.Name))
                {
                    dt.Rows.Add(c.DataRow);
                }
            }
        }
Exemple #5
0
        public static void ImportAll(string pathName)
        {
            BuildPartNumberWithSim(pathName + @"Library\Basic\Simulation\Murata\");

            //Dictionary<string, DataTable> ds = InitiateEmptyTables();

            string filePath = pathName + @"Data\Components\capacitor_murata\";

            string[] files = new string[] { "GRM", "GJM", "GQM", "GCM", "GCQ" };

            foreach (string file in files)
            {
                DataTable csv = AccessDb.FromCsv(filePath + file + ".csv");

                foreach (DataRow dw in csv.Rows)
                {
                    string mfrpn = dw["Part number (#:Packing code)"].ToString(); // Console.WriteLine(dw["Part number (#:Packing code)"].ToString());
                    (Capacitor c, bool isValid) = DecodeCapacitor(mfrpn);

                    if (isValid)
                    {
                        ComponentList.Capacitors.InsertCmp(c);
                    }
                }
            }

            Console.WriteLine("\n");
            foreach (string s in AllListPackSizes.Keys)
            {
                Console.WriteLine(s + ": " + AllListPackSizes[s]);
            }
            Console.WriteLine("\n");

            filePath = pathName + @"Data\Components\inductor_murata\";

            FileInfo[] Files = Xu.Serialization.GetFileList(filePath, "*.csv");

            foreach (FileInfo file in Files)
            {
                Console.WriteLine(file.FullName); //file.Name;
                DataTable csv = AccessDb.FromCsv(file.FullName);

                //if(csv.Columns.Contains("Part number # indicates the package specification code#")) Console.Write(" ok. \n");
                //else Console.Write(" error. \n");
                //Console.Write(" Count: " + csv.Columns[2].ColumnName + "  \n");

                /*
                 * foreach(DataColumn dc in csv.Columns)
                 * {
                 *  Console.WriteLine(dc.ColumnName);
                 * }*/


                foreach (DataRow dr in csv.Rows)
                {
                    string mfrpn      = ((string)dr["Part number # indicates the package specification code#"]).Trim('#');
                    string seriesType = ((string)dr["Series"]).Trim('#');
                    string srf        = (string)dr["SRF (min#)"];
                    string rdc        = (string)dr["Rdc (max#)"];
                    //string Isat = (string)dr["Rated Current (Isat)"];
                    string Itemp = (string)dr["Rated Current (Itemp)"];
                    //string tolerance = (string)dr["Inductance Tolerance"];
                    // inductance = (string)dr["Inductance"];

                    (Inductor ind, bool isValid) = DecodeInductor(mfrpn);

                    if (isValid)
                    {
                        ComponentList.Inductors.InsertCmp(ind);
                    }
                }
            }
        }