예제 #1
0
        void CasterFlash_OnGetPorts(CapeCollection ports)
        {
            int emptyPort = 0;

            foreach (var pair in ports)
            {
                if (!pair.Value.ComponentName.StartsWith("feed"))
                {
                    continue;
                }
                CapeMaterialPort port = (CapeMaterialPort)pair.Value;
                if (!port.IsConnected())
                {
                    emptyPort++;
                }
                //if (emptyPort > 1)    //This will cause load fail in Aspen
                //{
                //    Ports.Remove(pair);
                //    emptyPort--;
                //}
            }
            if (emptyPort == 0)
            {
                int i = 0;
                while (ports.Contains("feed-" + i))
                {
                    i++;
                }
                ports.Add(new CapeMaterialPort("feed-" + i, CapePortDirection.CAPE_INLET));
            }
        }
 public void AddDefaultItem()
 {
     collection.Clear();
     realParam = new CapeRealParameter("real",
                                       UnitCategoryEnum.Area, CapeParamMode.CAPE_INPUT);
     collection.Add(realParam);
     intParam = new CapeIntParameter("int", CapeParamMode.CAPE_INPUT);
     collection.Add(intParam);
 }