Example #1
0
        public Flowsheet(FlowsheetSettings newFlowsheetSettings, FlowsheetPreferences flowsheetPrefs, ApplicationPreferences appPrefs)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.flowsheetPrefs = flowsheetPrefs;
            this.appPrefs       = appPrefs;

            DryingGas dg = DryingGasCatalog.Instance.GetDryingGas(newFlowsheetSettings.DryingGasName);

            if (dg == null)
            {
                //string message = "You need to set a drying gas in Materials / New Process Settings first!";
                //MessageBox.Show(message, "New Flowsheet Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dg = DryingGasCatalog.Instance.GetDryingGas("Air");
            }

            DryingMaterial dm = DryingMaterialCatalog.Instance.GetDryingMaterial(newFlowsheetSettings.DryingMaterialName);

            if (dm == null)
            {
                string message = "You need to choose a drying material for the new flowsheet to be created first! (go to Materials / Set Default Flowsheet Settings)";
                MessageBox.Show(message, "New Flowsheet Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.evapAndDryingSystem = new EvaporationAndDryingSystem(UI.NEW_SYSTEM, dm, dg);

            this.connectionManager = new ConnectionManager(this);
            this.customEditor      = new ProsimoUI.CustomEditor.CustomEditor(this);

            Init();
        }
Example #2
0
        public virtual void SetObjectData()
        {
            int persistedClassVersion = info.GetInt32("ClassPersistenceVersionFlowsheet");

            this.evapAndDryingSystem = (EvaporationAndDryingSystem)Storable.RecallStorableObject(info, context, "EvaporationAndDryingSystem", typeof(EvaporationAndDryingSystem));
            //this.appPrefs = (ApplicationPreferences)Storable.RecallStorableObject(info, context, "ApplicationPreferences", typeof(ApplicationPreferences));
            this.customEditor = (ProsimoUI.CustomEditor.CustomEditor)Storable.RecallStorableObject(info, context, "CustomEditor", typeof(ProsimoUI.CustomEditor.CustomEditor));
            //this.connectionManager = (ConnectionManager)Storable.RecallStorableObject(info, context, "ConnectionManager", typeof(ConnectionManager));
            ArrayList connections = info.GetValue("Connections", typeof(ArrayList)) as ArrayList;

            if (connections != null)
            {
                foreach (SolvableConnection sc in connections)
                {
                    sc.SetObjectData();
                }
            }
            this.flowsheetPrefs = (FlowsheetPreferences)Storable.RecallStorableObject(info, context, "FlowsheetPrefs", typeof(FlowsheetPreferences));

            ArrayList persistedControls = info.GetValue("PersistedControls", typeof(ArrayList)) as ArrayList;

            RestoreSolvableControls(persistedControls, connections);
            InitializeComponent();
            Init();

            if (persistedClassVersion <= 1)
            {
                RecallInitialization();
            }
        }
Example #3
0
 //public UIPreferences(Point mainFormLocation, Size mainFormSize, FormWindowState mainFormWindowState, bool toolboxVisible, Point toolboxLocation) {
 public UIPreferences(MainForm mainForm)
 {
     this.mainFormLocation    = mainForm.Location;
     this.mainFormSize        = mainForm.Size;
     this.mainFormWindowState = mainForm.WindowState;
     this.toolboxVisible      = mainForm.ToolboxVisible;
     //this.toolboxLocation = toolboxLocation;
     this.newProcessSettings = mainForm.NewProcessSettings;
     this.appPrefs           = mainForm.ApplicationPrefs;
     this.flowsheetPrefs     = mainForm.FlowsheetPrefs;
 }
Example #4
0
        //public virtual void SetObjectData(SerializationInfo info, StreamingContext context) {
        public override void SetObjectData()
        {
            int persistedClassVersion = info.GetInt32("ClassPersistenceVersionUIPreferences");

            this.mainFormLocation    = (Point)info.GetValue("MainFormLocation", typeof(Point));
            this.mainFormSize        = (Size)info.GetValue("MainFormSize", typeof(Size));
            this.mainFormWindowState = (FormWindowState)info.GetValue("MainFormWindowState", typeof(FormWindowState));
            this.toolboxVisible      = info.GetBoolean("ToolboxVisible");
            //this.ToolboxLocation = (Point)info.GetValue("ToolboxLocation", typeof(Point));
            this.appPrefs           = (ApplicationPreferences)RecallStorableObject("ApplicationPreferences", typeof(ApplicationPreferences));
            this.newProcessSettings = (FlowsheetSettings)RecallStorableObject("NewProcessSettings", typeof(FlowsheetSettings));
            this.flowsheetPrefs     = (FlowsheetPreferences)RecallStorableObject("FlowsheetPreferences", typeof(FlowsheetPreferences));
        }
Example #5
0
        //private static Flowsheet UnpersistFlowsheet1_01(NewProcessSettings newProcessSettings, ApplicationPreferences appPrefs, ArrayList persistedItems, string flowsheetName) {
        private static Flowsheet UnpersistFlowsheet1_01(ArrayList persistedItems, string flowsheetName, ApplicationPreferences appPrefs)
        {
            Flowsheet flowsheet = null;

            foreach (object obj in persistedItems)
            {
                if (obj is EvaporationAndDryingSystem)
                {
                    EvaporationAndDryingSystem persisted = (EvaporationAndDryingSystem)obj;
                    persisted.SetSystemFileName(flowsheetName); // call this before SetObjectData()
                    persisted.SetObjectData();
                    //flowsheet = new Flowsheet(newProcessSettings, appPrefs, persisted);
                    flowsheet = new Flowsheet(persisted, appPrefs);
                }
                else if (obj is SolvableControl)
                {
                    SolvableControl persistedCtrl = (SolvableControl)obj;

                    persistedCtrl.Flowsheet = flowsheet;
                    persistedCtrl.SetObjectData();

                    //string solvableName = (string)persistedCtrl.NameControl.Text;
                    //Solvable solvable = flowsheet.EvaporationAndDryingSystem.GetSolvable(solvableName);
                    //persistedCtrl.Solvable = solvable;
                    flowsheet.Controls.Add(persistedCtrl);
                }
                else if (obj is SolvableConnection)
                {
                    SolvableConnection persistedDc = (SolvableConnection)obj;
                    persistedDc.Flowsheet = flowsheet;
                    persistedDc.SetObjectData();
                    persistedDc.UpdateConnection();
                    flowsheet.ConnectionManager.AddConnection(persistedDc);
                }
                else if (obj is FlowsheetPreferences)
                {
                    FlowsheetPreferences flowsheetPrefs = obj as FlowsheetPreferences;
                    flowsheetPrefs.SetObjectData();
                    flowsheet.BackColor = flowsheetPrefs.BackColor;
                }
                else if (obj is ProsimoUI.CustomEditor.CustomEditor)
                {
                    ProsimoUI.CustomEditor.CustomEditor persistedEditor = (ProsimoUI.CustomEditor.CustomEditor)obj;
                    persistedEditor.Flowsheet = flowsheet;
                    persistedEditor.SetObjectData();
                }
            }
            return(flowsheet);
        }
Example #6
0
        private Flowsheet SetFlowsheetContent(NewProcessSettings newProcessSettings, ApplicationPreferences appPrefs, ArrayList items, string flowsheetName)
        {
            Flowsheet   flowsheet = null;
            IEnumerator e         = items.GetEnumerator();

            while (e.MoveNext())
            {
                object obj = e.Current;

                if (obj is EvaporationAndDryingSystem)
                {
                    EvaporationAndDryingSystem persisted = (EvaporationAndDryingSystem)obj;
                    persisted.SetSystemFileName(flowsheetName); // call this before SetObjectData()
                    persisted.SetObjectData();
                    flowsheet = new Flowsheet(newProcessSettings, appPrefs, persisted);
                }

                else if (obj is GasStreamControl)
                {
                    GasStreamControl persistedCtrl = (GasStreamControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    DryingGasStream  stream        = flowsheet.EvaporationAndDryingSystem.GetGasStream(solvableName);
                    GasStreamControl newCtrl       = new GasStreamControl(flowsheet, new Point(0, 0), stream);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is MaterialStreamControl)
                {
                    MaterialStreamControl persistedCtrl = (MaterialStreamControl)obj;
                    string solvableName           = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    DryingMaterialStream  stream  = flowsheet.EvaporationAndDryingSystem.GetMaterialStream(solvableName);
                    MaterialStreamControl newCtrl = new MaterialStreamControl(flowsheet, new Point(0, 0), stream);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is DryerControl)
                {
                    DryerControl persistedCtrl = (DryerControl)obj;
                    string       solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Dryer        uo            = flowsheet.EvaporationAndDryingSystem.GetDryer(solvableName);
                    DryerControl newCtrl       = new DryerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is HeatExchangerControl)
                {
                    HeatExchangerControl persistedCtrl = (HeatExchangerControl)obj;
                    string               solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    HeatExchanger        uo            = flowsheet.EvaporationAndDryingSystem.GetHeatExchanger(solvableName);
                    HeatExchangerControl newCtrl       = new HeatExchangerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is CycloneControl)
                {
                    CycloneControl persistedCtrl = (CycloneControl)obj;
                    string         solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Cyclone        uo            = flowsheet.EvaporationAndDryingSystem.GetCyclone(solvableName);
                    CycloneControl newCtrl       = new CycloneControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is EjectorControl)
                {
                    EjectorControl persistedCtrl = (EjectorControl)obj;
                    string         solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Ejector        uo            = flowsheet.EvaporationAndDryingSystem.GetEjector(solvableName);
                    EjectorControl newCtrl       = new EjectorControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is WetScrubberControl)
                {
                    WetScrubberControl persistedCtrl = (WetScrubberControl)obj;
                    string             solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    WetScrubber        uo            = flowsheet.EvaporationAndDryingSystem.GetWetScrubber(solvableName);
                    WetScrubberControl newCtrl       = new WetScrubberControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is ScrubberCondenserControl)
                {
                    ScrubberCondenserControl persistedCtrl = (ScrubberCondenserControl)obj;
                    string                   solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    ScrubberCondenser        uo            = flowsheet.EvaporationAndDryingSystem.GetScrubberCondenser(solvableName);
                    ScrubberCondenserControl newCtrl       = new ScrubberCondenserControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is MixerControl)
                {
                    MixerControl persistedCtrl = (MixerControl)obj;
                    string       solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Mixer        uo            = flowsheet.EvaporationAndDryingSystem.GetMixer(solvableName);
                    MixerControl newCtrl       = new MixerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is TeeControl)
                {
                    TeeControl persistedCtrl = (TeeControl)obj;
                    string     solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Tee        uo            = flowsheet.EvaporationAndDryingSystem.GetTee(solvableName);
                    TeeControl newCtrl       = new TeeControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is FlashTankControl)
                {
                    FlashTankControl persistedCtrl = (FlashTankControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    FlashTank        uo            = flowsheet.EvaporationAndDryingSystem.GetFlashTank(solvableName);
                    FlashTankControl newCtrl       = new FlashTankControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is FanControl)
                {
                    FanControl persistedCtrl = (FanControl)obj;
                    string     solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Fan        uo            = flowsheet.EvaporationAndDryingSystem.GetFan(solvableName);
                    FanControl newCtrl       = new FanControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is ValveControl)
                {
                    ValveControl persistedCtrl = (ValveControl)obj;
                    string       solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Valve        uo            = flowsheet.EvaporationAndDryingSystem.GetValve(solvableName);
                    ValveControl newCtrl       = new ValveControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is BagFilterControl)
                {
                    BagFilterControl persistedCtrl = (BagFilterControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    BagFilter        uo            = flowsheet.EvaporationAndDryingSystem.GetBagFilter(solvableName);
                    BagFilterControl newCtrl       = new BagFilterControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is AirFilterControl)
                {
                    AirFilterControl persistedCtrl = (AirFilterControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    AirFilter        uo            = flowsheet.EvaporationAndDryingSystem.GetAirFilter(solvableName);
                    AirFilterControl newCtrl       = new AirFilterControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is CompressorControl)
                {
                    CompressorControl persistedCtrl = (CompressorControl)obj;
                    string            solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Compressor        uo            = flowsheet.EvaporationAndDryingSystem.GetCompressor(solvableName);
                    CompressorControl newCtrl       = new CompressorControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is HeaterControl)
                {
                    HeaterControl persistedCtrl = (HeaterControl)obj;
                    string        solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Heater        uo            = flowsheet.EvaporationAndDryingSystem.GetHeater(solvableName);
                    HeaterControl newCtrl       = new HeaterControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is CoolerControl)
                {
                    CoolerControl persistedCtrl = (CoolerControl)obj;
                    string        solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Cooler        uo            = flowsheet.EvaporationAndDryingSystem.GetCooler(solvableName);
                    CoolerControl newCtrl       = new CoolerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is ElectrostaticPrecipitatorControl)
                {
                    ElectrostaticPrecipitatorControl persistedCtrl = (ElectrostaticPrecipitatorControl)obj;
                    string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    ElectrostaticPrecipitator        uo      = flowsheet.EvaporationAndDryingSystem.GetElectrostaticPrecipitator(solvableName);
                    ElectrostaticPrecipitatorControl newCtrl = new ElectrostaticPrecipitatorControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is PumpControl)
                {
                    PumpControl persistedCtrl = (PumpControl)obj;
                    string      solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Pump        uo            = flowsheet.EvaporationAndDryingSystem.GetPump(solvableName);
                    PumpControl newCtrl       = new PumpControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is RecycleControl)
                {
                    RecycleControl persistedCtrl = (RecycleControl)obj;
                    string         solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Recycle        uo            = flowsheet.EvaporationAndDryingSystem.GetRecycle(solvableName);
                    RecycleControl newCtrl       = new RecycleControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is SolvableConnection)
                {
                    SolvableConnection persistedDc = (SolvableConnection)obj;
                    SolvableConnection dc          = new SolvableConnection(flowsheet);
                    dc.SetObjectData(persistedDc.SerializationInfo, persistedDc.StreamingContext);
                    flowsheet.ConnectionManager.Connections.Add(dc);
                }
                else if (obj is FlowsheetPreferences)
                {
                    FlowsheetPreferences flowsheetPrefs = obj as FlowsheetPreferences;
                    flowsheetPrefs.SetObjectData(flowsheetPrefs.SerializationInfo, flowsheetPrefs.StreamingContext);
                    flowsheet.BackColor = flowsheetPrefs.BackColor;
                }
                else if (obj is ProsimoUI.CustomEditor.CustomEditor)
                {
                    ProsimoUI.CustomEditor.CustomEditor persistedEditor = (ProsimoUI.CustomEditor.CustomEditor)obj;
                    flowsheet.CustomEditor.SetObjectData(persistedEditor.SerializationInfo, persistedEditor.StreamingContext);
                }
            }

            if (this.CheckFlowsheetVersion(items, flowsheet))
            {
                flowsheet.IsDirty = false;
            }
            else
            {
                flowsheet = null;
            }

            return(flowsheet);
        }
Example #7
0
        private ArrayList GetFlowsheetContent(Flowsheet flowsheet)
        {
            ArrayList toSerializeItems = new ArrayList();

            toSerializeItems.Add(flowsheet.EvaporationAndDryingSystem);

            // get all the flowsheet element controls
            IEnumerator e = flowsheet.Controls.GetEnumerator();

            while (e.MoveNext())
            {
                object obj = e.Current;
                if (obj is GasStreamControl)
                {
                    GasStreamControl ctrl = (GasStreamControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is MaterialStreamControl)
                {
                    MaterialStreamControl ctrl = (MaterialStreamControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is DryerControl)
                {
                    DryerControl ctrl = (DryerControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is HeatExchangerControl)
                {
                    HeatExchangerControl ctrl = (HeatExchangerControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is CycloneControl)
                {
                    CycloneControl ctrl = (CycloneControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is EjectorControl)
                {
                    EjectorControl ctrl = (EjectorControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is WetScrubberControl)
                {
                    WetScrubberControl ctrl = (WetScrubberControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is ScrubberCondenserControl)
                {
                    ScrubberCondenserControl ctrl = (ScrubberCondenserControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is MixerControl)
                {
                    MixerControl ctrl = (MixerControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is TeeControl)
                {
                    TeeControl ctrl = (TeeControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is FlashTankControl)
                {
                    FlashTankControl ctrl = (FlashTankControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is FanControl)
                {
                    FanControl ctrl = (FanControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is ValveControl)
                {
                    ValveControl ctrl = (ValveControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is BagFilterControl)
                {
                    BagFilterControl ctrl = (BagFilterControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is AirFilterControl)
                {
                    AirFilterControl ctrl = (AirFilterControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is CompressorControl)
                {
                    CompressorControl ctrl = (CompressorControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is HeaterControl)
                {
                    HeaterControl ctrl = (HeaterControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is CoolerControl)
                {
                    CoolerControl ctrl = (CoolerControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is ElectrostaticPrecipitatorControl)
                {
                    ElectrostaticPrecipitatorControl ctrl = (ElectrostaticPrecipitatorControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is PumpControl)
                {
                    PumpControl ctrl = (PumpControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is RecycleControl)
                {
                    RecycleControl ctrl = (RecycleControl)obj;
                    toSerializeItems.Add(ctrl);
                }
            }

            // get all the connections
            e = flowsheet.ConnectionManager.Connections.GetEnumerator();
            while (e.MoveNext())
            {
                SolvableConnection dc = (SolvableConnection)e.Current;
                toSerializeItems.Add(dc);
            }

            // get the flowsheet preferences
            FlowsheetPreferences flowsheetPrefs = new FlowsheetPreferences(flowsheet);

            toSerializeItems.Add(flowsheetPrefs);

            // get the custom editor (we persist only the ID of the variables)
            toSerializeItems.Add(flowsheet.CustomEditor);

            // get the flowsheet version
            toSerializeItems.Add(flowsheet.Version);

            return(toSerializeItems);
        }