コード例 #1
0
        /// <summary>
        /// This function will be calculate one reduced transfer function from two tfs, which are connected in parallel
        /// This function can not modify the lists of blocks!
        /// </summary>
        /// <param name="tf1"></param>
        /// <param name="tf2"></param>
        /// <param name="sign"></param>
        /// <param name="newtf"></param>
        public static tfBlock parallel(tfBlock tf1, tfBlock tf2, SIGN sign1, SIGN sign2)
        {
            tfBlock newtf;

            newtf.name   = "";
            newtf.input  = "";
            newtf.output = "";

            newtf.num = MathExtended.PolySum(MathExtended.convolution(tf1.num, tf2.den), MathExtended.convolution(tf2.num, tf1.den), sign1, sign2);
            newtf.den = MathExtended.convolution(tf1.den, tf2.den);
            return(newtf);
        }
コード例 #2
0
        /// <summary>
        /// This function will be reduce a parallel connection.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="tf1"></param>
        /// <param name="tf2"></param>
        /// <param name="sum"></param>
        public static void parallel(tfBlock tf1, tfBlock tf2, nodeBlock node, sumBlock sum)
        {
            tfBlock newtf = new tfBlock();

            newtf.num    = MathExtended.PolySum(MathExtended.convolution(tf1.num, tf2.den), MathExtended.convolution(tf2.num, tf1.den), sum.sign1, sum.sign2);
            newtf.den    = MathExtended.convolution(tf1.den, tf2.den);
            newtf.name   = blockmanager.NameCounter("parallel", Blocktypes.tf);
            newtf.input  = blockmanager.InputChange(node.input, newtf.name, node.name);
            newtf.output = blockmanager.OutputChange(sum.output, newtf.name, sum.name);
            blockmanager.Change_Tf(tf1, newtf);
            blockmanager.RemoveBlockFromList(tf2.name, Blocktypes.tf);
            blockmanager.RemoveBlockFromList(node.name, Blocktypes.node);
            blockmanager.RemoveBlockFromList(sum.name, Blocktypes.sum);

            Console.WriteLine("\tSimplified a parallel connection: ({0})", newtf.name);
            ConsistencyResult result;

            result = Check.consistency();
            if (!result.success)
            {
                Check.ReadConsistencyResult(result);
            }
        }
コード例 #3
0
        /// <summary>
        /// This function will be reduce a series connection.
        /// </summary>
        /// <param name="tf1"></param>
        /// <param name="tf2"></param>

        public static tfBlock series(tfBlock tf1, tfBlock tf2, params bool[] virtual_switcher)
        {
            tfBlock newtf;

            if ((virtual_switcher.Length > 0) && (virtual_switcher[0] == true))
            {
                newtf.num = MathExtended.convolution(tf1.num, tf2.num);
                newtf.den = MathExtended.convolution(tf1.den, tf2.den);

                newtf.name   = "";
                newtf.input  = "";
                newtf.output = "";
            }
            else
            {
                newtf.num = MathExtended.convolution(tf1.num, tf2.num);
                newtf.den = MathExtended.convolution(tf1.den, tf2.den);

                newtf.name   = blockmanager.NameCounter("series", Blocktypes.tf);
                newtf.input  = blockmanager.InputChange(tf1.input, newtf.name, tf1.name);
                newtf.output = blockmanager.OutputChange(tf2.output, newtf.name, tf2.name);
                blockmanager.Change_Tf(tf1, newtf);
                blockmanager.RemoveBlockFromList(tf2.name, Blocktypes.tf);

                Console.WriteLine("\tSimplified a series connection: ({0})", newtf.name);
                blockmanager.SystemStat();
                ConsistencyResult result;
                result = Check.consistency();
                if (!result.success)
                {
                    Check.ReadConsistencyResult(result);
                    Console.ReadKey();
                }
            }
            return(newtf);
        }