protected UnitOperation(string name, UnitOpSystem uoSys) : base(name, uoSys) { heatLoss = new ProcessVarDouble(StringConstants.HEAT_LOSS, PhysicalQuantity.Power, 0.0, VarState.Specified, this); heatInput = new ProcessVarDouble(StringConstants.HEAT_INPUT, PhysicalQuantity.Power, 0.0, VarState.Specified, this); workInput = new ProcessVarDouble(StringConstants.WORK_INPUT, PhysicalQuantity.Power, 0.0, VarState.Specified, this); calculationType = UnitOpCalculationType.Balance; }
protected void EnableBalanceOrRatingModel(UnitOpCalculationType calcType) { if (calcType == UnitOpCalculationType.Rating) { EnableRatingModel(); } else if (calcType == UnitOpCalculationType.Balance) { EnableBalanceModel(); } }
public void SetCalculationType(UnitOpCalculationType type) { if (type == UnitOpCalculationType.Balance) { this.comboBoxCalculationType.SelectedIndex = INDEX_BALANCE; } else if (type == UnitOpCalculationType.Rating) { this.comboBoxCalculationType.SelectedIndex = INDEX_RATING; } }
public override void SetObjectData() { base.SetObjectData(); int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionUnitOperation", typeof(int)); if (persistedClassVersion == 1) { this.calculationType = (UnitOpCalculationType)info.GetValue("CalculationType", typeof(UnitOpCalculationType)); //this.calculationLevel = (int) info.GetValue("CalculationLevel", typeof(int)); this.heatLoss = RecallStorableObject("HeatLoss", typeof(ProcessVarDouble)) as ProcessVarDouble; this.heatInput = RecallStorableObject("HeatInput", typeof(ProcessVarDouble)) as ProcessVarDouble; this.workInput = RecallStorableObject("WorkInput", typeof(ProcessVarDouble)) as ProcessVarDouble; this.inletStreams = info.GetValue("InletStreams", typeof(ArrayList)) as ArrayList; this.outletStreams = info.GetValue("OutletStreams", typeof(ArrayList)) as ArrayList; } }
public virtual ErrorMessage SpecifyCalculationType(UnitOpCalculationType aValue) { ErrorMessage retMsg = null; if (aValue != calculationType) { UnitOpCalculationType oldValue = calculationType; calculationType = aValue; EnableBalanceOrRatingModel(calculationType); try { HasBeenModified(true); } catch (Exception e) { calculationType = oldValue; EnableBalanceOrRatingModel(calculationType); retMsg = HandleException(e); } } return(retMsg); }