Exemplo n.º 1
0
        // now freature is unimplemented.
        public static List <Record> deTransform(TransformedCircuit trCircuit, bool mix)
        {
            List <Record> detransformed = trCircuit.getSingle().GetRange(0, trCircuit.getSingle().Count - 1);

            for (int i = 0; i < trCircuit.getParallel().Count; i++)
            {
                int[]         nodes = trCircuit.getParallel().ElementAt(i).initialNodes.ToArray();
                List <string> names = trCircuit.getParallel().ElementAt(i).elements;
                for (int j = 0; j < names.Count; j++)
                {
                    Record newParallel = new Record(names.ElementAt(j), nodes, 1);
                    detransformed.Add(newParallel);
                }
            }
            if (!mix)
            {
                for (int i = 0; i < trCircuit.getSerial().Count; i++)
                {
                    List <int>    sNodes = trCircuit.getSerial().ElementAt(i).initialNodes;
                    List <string> names  = trCircuit.getSerial().ElementAt(i).elements;
                    for (int j = 0; j < names.Count; j++)
                    {
                        int[]  nodes  = { sNodes.ElementAt(j), sNodes.ElementAt(j + 1) };
                        Record newSer = new Record(names.ElementAt(j), nodes, 1);
                        detransformed.Add(newSer);
                    }
                }
            }
            return(detransformed);
        }
Exemplo n.º 2
0
        public static TransformedCircuit transform(List <Record> testcircuit)
        {
            TransformedCircuit       tCir     = new TransformedCircuit();
            List <SimplifiedCircuit> par      = findParallelSubcir(testcircuit);
            List <int[]>             parNodes = new List <int[]>();
            List <int>    serialNodes         = Utils.getSerialNodes(testcircuit);
            List <Record> single = new List <Record>();

            tCir.setParallel(par);
            tCir.setSerial(toSimplifiedCir(findSerialSubcir(testcircuit)));
            for (int i = 0; i < par.Count; i++)
            {
                int[] nodes = par.ElementAt(i).initialNodes.ToArray();
                parNodes.Add(nodes);
            }
            for (int i = 0; i < testcircuit.Count; i++)
            {
                int[] nodes = testcircuit.ElementAt(i).getNodes();
                if ((!serialNodes.Contains(nodes[0])) && (!serialNodes.Contains(nodes[1])) && (!Utils.checkNodes(parNodes, nodes[0], nodes[1])))
                {
                    single.Add(testcircuit.ElementAt(i));
                }
            }
            tCir.setSingle(single);
            return(tCir);
        }
Exemplo n.º 3
0
 public TransformedCircuit(List <Record> single, List <SimplifiedCircuit> ser, List <SimplifiedCircuit> parallel, TransformedCircuit subcir)
 {
     this.single   = single;
     this.serial   = ser;
     this.parallel = parallel;
     this.subcir   = subcir;
 }
Exemplo n.º 4
0
 public void setSubCircuit(TransformedCircuit subcir)
 {
     this.subcir = subcir;
 }