private void ParsingXML_readInstance(IEnumerable <XElement> elements, ref Module mod, int depth, int flg)
        {
            int idOffset = 0;

            if (flg == 0)
            {
                mod.Id = depth.ToString();
            }

            foreach (var ele in elements)
            {
                switch (ele.Name.ToString())
                {
                case "Type":
                    mod.Type = ele.Value;
                    break;

                case "Coupling":
                    Coupling cp = new Coupling(ele.Attribute("from").Value,
                                               ele.Attribute("fPort").Value, ele.Attribute("to").Value, ele.Attribute("tPort").Value);
                    mod.Couplings.Add(cp);
                    break;

                case "SubModel":
                    Module temp = new Module(ele.Attribute("name").Value, "SI");
                    if (flg == 0)
                    {
                        temp.Id = makeId(depth, idOffset);
                    }
                    ParsingXML_readInstance(ele.Elements(), ref temp, depth + 1, flg);
                    mod.Instances.Add(temp);
                    idOffset += 1;
                    break;

                default:
                    Console.WriteLine("[ERROR]----" + ele.Name);
                    break;
                }
            }
        }