Exemple #1
0
        public static void SimplifierCircle()
        {
            bool flag_modification = true;

            while (flag_modification)
            {
                flag_modification = false;
                while (Simplify_Series())
                {
                    flag_modification = true;
                }
                ;
                while (Simplify_Parallel())
                {
                    flag_modification = true;
                }
                ;
                while (Simplify_Feedback())
                {
                    flag_modification = true;
                }
                ;
                ConsistencyResult result = Check.consistency();
                if (!result.success)
                {
                    Check.ReadConsistencyResult(result);
                    Console.ReadKey();
                }
            }

            Console.WriteLine("[DONE] Simplification has been suceed");
        }
Exemple #2
0
        /*
         * SIMPLIFIER KÖR TESZTELÉSE
         */
        public static void test_simplifier()
        {
            string tf1name = "tf01";
            string tf2name = "tf02";
            string tf3name = "tf03";
            string tf4name = "tf04";
            string tf5name = "tf05";

            string node1name = "node01";
            string node2name = "node02";

            string sum1name = "sum01";
            string sum2name = "sum02";

            new TransferFunction(tf1name, new double[2] {
                2, 2
            }, new double[3] {
                1, 2, 3
            }, node2name, sum1name);
            new TransferFunction(tf2name, new double[1] {
                -1
            }, new double[2] {
                1, 2
            }, sum1name, node1name);
            new TransferFunction(tf3name, new double[1] {
                1
            }, new double[3] {
                1, 2, 3
            }, node1name, sum1name);
            new TransferFunction(tf4name, new double[2] {
                1, 2
            }, new double[2] {
                1, 2
            }, node1name, sum2name);
            new TransferFunction(tf5name, new double[1] {
                5
            }, new double[3] {
                5, 5, 5
            }, node2name, sum2name);

            new Node(node1name, tf2name, tf3name, tf4name);
            new Node(node2name, "start", tf1name, tf5name);

            new Sum(sum1name, SIGN.plus, tf1name, SIGN.minus, tf3name, tf2name);
            new Sum(sum2name, SIGN.plus, tf4name, SIGN.minus, tf5name, "stop");

            ConsistencyResult result = Check.consistency();

            Check.ReadConsistencyResult(result);
            if (!result.success)
            {
                Console.ReadKey();
            }

            blockmanager.SystemStat();

            BlockSimplifier.SimplifierCircle();

            blockmanager.SystemStat();
        }
Exemple #3
0
        public static void Consistency_CheckAndPause()
        {
            ConsistencyResult result = Check.consistency();

            if (!result.success)
            {
                Check.ReadConsistencyResult(result);
                Console.ReadKey();
            }
        }
Exemple #4
0
 public static void ReadConsistencyResult(ConsistencyResult result)
 {
     Console.WriteLine("********************************************\nConsistency result, after checking the consistency:");
     Console.WriteLine();
     if (result.success)
     {
         Console.WriteLine("success: \t{0}", result.success);
         Console.WriteLine("\t\t{0}", result.ErrorBlockName);
     }
     else
     {
         Console.WriteLine("success: \t\t\t{0}", result.success);
         Console.WriteLine("name of block with problem:\t{0}", result.ErrorBlockName);
         Console.WriteLine("block type:\t\t\t{0}", (Blocktypes)result.type);
         Console.WriteLine("which pin is wrong:\t\t{0}", (PINS)result.pinNum);
     }
 }
        /// <summary>
        /// Implementation of feedback connection reducing
        /// </summary>
        /// <param name="tf1"></param>
        /// <param name="tf2"></param>
        /// <param name="sum"></param>
        /// <param name="node"></param>
        public static void feedback(tfBlock tf1, tfBlock tf2, sumBlock sum, nodeBlock node)
        {
            tfBlock tf;

            if (sum.sign2 < 0)
            {
                tf = parallel(identicalTf(), series(tf1, tf2, true), SIGN.plus, SIGN.plus);
            }
            else
            {
                tf = parallel(identicalTf(), series(tf1, tf2, true), SIGN.plus, SIGN.minus);
            }
            tf = series(tf1, inverseTf(tf, true), true);

            tf.name  = blockmanager.NameCounter("feedback", Blocktypes.tf);
            tf.input = blockmanager.InputChange(sum.input1, tf.name, sum.name);
            //tf.output:
            blockmanager.SearchTf_byName(node.output1, out TempTf); //előfordulhat, hogy a node outpu1-én van a visszacsatolás ága!
            if (TempTf.name == tf2.name)                            //ha az első outputon van a visszacsatolási ág
            {
                tf.output = blockmanager.OutputChange(node.output2, tf.name, node.name);
            }
            else //egyébként
            {
                tf.output = blockmanager.OutputChange(node.output1, tf.name, node.name);
            }

            blockmanager.Change_Tf(tf1, tf);
            blockmanager.RemoveBlockFromList(tf2.name, Blocktypes.tf);
            blockmanager.RemoveBlockFromList(sum.name, Blocktypes.sum);
            blockmanager.RemoveBlockFromList(node.name, Blocktypes.node);

            Console.WriteLine("\tSimplified a feedback connection: ({0})", tf.name);
            ConsistencyResult result = Check.consistency();

            if (!result.success)
            {
                Check.ReadConsistencyResult(result);
                Console.ReadKey();
            }
        }