Beispiel #1
0
        //public void ClearOutput()
        //{
        //    this.Output = new OutputData(this.Precision);
        //}


        #region Rewrite
        void Rewrite_Objects()
        {
            GlobalVarsTable GVT = this.Model.O_Cont.GVT;

            this.Output.Objects.Rows.Clear();
            foreach (string unit in GVT.Vars.Keys.ToArray())
            {
                foreach (SLT.Object obj in GVT.Vars[unit])
                {
                    if (unit == obj.Unit)
                    {
                        string name      = obj.Name;
                        object value_obj = obj.GetValue();
                        try
                        {
                            value_obj = Convert.ToDouble(value_obj);
                            value_obj = Math.Round((double)value_obj, this.Precision);
                        }
                        catch { }
                        string value = Convert.ToString(value_obj);
                        string type  = "";
                        switch (obj.Type)
                        {
                        case SLT.ObjectType.Scalar:
                            type = "Скаляр";
                            break;

                        case SLT.ObjectType.Link:
                            type = "Ссылка";
                            break;

                        case SLT.ObjectType.Vector:
                            type = "Вектор";
                            break;

                        case SLT.ObjectType.Macro:
                            type = "Макрос";
                            break;
                        }

                        if (obj.Type == SLT.ObjectType.Vector)
                        {
                            value = ((SLT.Vector)obj).GetTree();
                        }
                        this.Output.Objects.Rows.Add(obj.Unit, obj.Name, value, type);
                        if (obj.Type == SLT.ObjectType.Vector)
                        {
                            SLT.Vector        Vec          = (SLT.Vector)obj;
                            SLT.Vector        SubVector    = (SLT.Vector)Vec;
                            List <SLT.Object> vector_value = (List <SLT.Object>)(SubVector.GetValue());
                            this.Write_Vector_to_DataTable(this.Output.Objects, vector_value);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        void Rewrite_Initiators()
        {
            InitiatorsTable IT = this.Model.O_Cont.IT;

            this.Output.Initiators.Rows.Clear();
            foreach (Initiator init in IT.Initiators)
            {
                int number = init.Number;

                string name;
                string value;
                string type = "";

                SLT.Object obj = this.Model.O_Cont.GetObjectFromInitiator(init);
                name = obj.Name;
                object value_obj = obj.GetValue();
                try
                {
                    value_obj = Convert.ToDouble(value_obj);
                    value_obj = Math.Round((double)value_obj, this.Precision);
                }
                catch { }

                value = Convert.ToString(value_obj);
                switch (obj.Type)
                {
                case SLT.ObjectType.Scalar:
                    type = "Скаляр";
                    break;

                case SLT.ObjectType.Link:
                    type = "Ссылка";
                    break;

                case SLT.ObjectType.Vector:
                    type = "Вектор";
                    break;

                case SLT.ObjectType.Macro:
                    type = "Макрос";
                    break;
                }
                if (obj.Type == SLT.ObjectType.Vector)
                {
                    value = ((SLT.Vector)obj).GetTree();
                }
                this.Output.Initiators.Rows.Add(number, name, value, type);
                if (obj.Type == SLT.ObjectType.Vector)
                {
                    SLT.Vector        Vec          = (SLT.Vector)obj;
                    SLT.Vector        SubVector    = (SLT.Vector)Vec;
                    List <SLT.Object> vector_value = (List <SLT.Object>)(SubVector.GetValue());
                    Write_Vector_to_DataTable(this.Output.Initiators, vector_value);
                }
            }
        }
Beispiel #3
0
        void Write_Vector_to_DataTable(DataTable DT, List <SLT.Object> list)
        {
            foreach (SLT.Object obj in list)
            {
                string type = "";
                switch (obj.Type)
                {
                case SLT.ObjectType.Scalar:
                    type = "Скаляр";
                    break;

                case SLT.ObjectType.Link:
                    type = "Ссылка";
                    break;

                case SLT.ObjectType.Vector:
                    type = "Вектор";
                    break;

                case SLT.ObjectType.Macro:
                    type = "Макрос";
                    break;
                }
                if (obj.Type == SLT.ObjectType.Vector)
                {
                    SLT.Vector Subvec = (SLT.Vector)obj;
                    DT.Rows.Add("", Subvec.Name, Subvec.GetTree(), type);
                    this.Write_Vector_to_DataTable(DT, (List <SLT.Object>)Subvec.GetValue());
                }
                else
                {
                    object value_obj = obj.GetValue();
                    try
                    {
                        value_obj = Convert.ToDouble(value_obj);
                        value_obj = Math.Round((double)value_obj, this.Precision);
                    }
                    catch { }
                    DT.Rows.Add("", obj.Name, value_obj, type);
                }
            }
        }