protected override void OnCalculate() { double zTemperature = InputPort.Temperature; double zPressure = InputPort.Pressure; double zEnthalpy = InputPort.Enthalpy; double zTotalFlow = InputPort.TotalFlow; double[] zFraction = InputPort.Fraction; double zFractionSplit = SplitFractionValue; OutputPort1.Temperature = zTemperature; OutputPort2.Temperature = zTemperature; OutputPort1.Pressure = zPressure; OutputPort2.Pressure = zPressure; OutputPort1.Enthalpy = zEnthalpy; OutputPort2.Enthalpy = zEnthalpy; OutputPort1.TotalFlow = zTotalFlow * zFractionSplit; OutputPort2.TotalFlow = zTotalFlow * (1.0 - zFractionSplit); OutputPort1.Fraction = zFraction; OutputPort2.Fraction = zFraction; try { OutputPort1.CalculateEquilibrium(CapeOpenFlashType.PH); OutputPort2.CalculateEquilibrium(CapeOpenFlashType.PH); } catch { } }
protected override void OnCalculate() { LogClass.WriteLog("Entro"); double zTemperature1In = InputPort1.Temperature; double zPressure1In = InputPort1.Pressure; double zEnthalpy1In = InputPort1.Enthalpy; LogClass.WriteLog("Dopo Enth"); double zTotalFlow1In = InputPort1.TotalFlow; double[] zFraction1In = InputPort1.Fraction; LogClass.WriteLog("Prima di porta 2"); double zTemperature2In = InputPort2.Temperature; double zPressure2In = InputPort2.Pressure; double zEnthalpy2In = InputPort2.Enthalpy; double zTotalFlow2In = InputPort2.TotalFlow; double[] zFraction2In = InputPort2.Fraction; //double zTemperature1Out; //double zPressure1Out; //double zEnthalpy1Out; //double zTotalFlow1Out; //double[] zFraction1Out; //double zTemperature2Out; //double zPressure2Out; //double zEnthalpy2Out; //double zTotalFlow2Out; //double[] zFraction2Out; double zDuty; LogClass.WriteLog("Temperatura T1= " + zTemperature1In.ToString() + " Temperatura T2= " + zTemperature2In.ToString()); if (zTemperature1In >= zTemperature2In) { OutputPort1.Pressure = zPressure1In; OutputPort1.TotalFlow = zTotalFlow1In; OutputPort1.Fraction = zFraction1In; OutputPort1.Temperature = 250; //OutputPort1.Temperature = InputPort1.Temperature; LogClass.WriteLog("Prima di calc equilibrium porta 1 x"); OutputPort1.CalculateEquilibrium(CapeOpenFlashType.TP); LogClass.WriteLog("DOPO di calc equilibrium porta 1"); LogClass.WriteLog("Enthalpy IN1 = " + zEnthalpy1In.ToString() + "Enthalpy OUT1 = " + OutputPort1.Enthalpy.ToString()); zDuty = zTotalFlow1In * (OutputPort1.Enthalpy - zEnthalpy1In); OutputPort2.Pressure = zPressure2In; OutputPort2.TotalFlow = zTotalFlow2In; OutputPort2.Fraction = zFraction2In; LogClass.WriteLog("Prima di set Enth"); OutputPort2.Enthalpy = zEnthalpy2In + zDuty; LogClass.WriteLog("DOPO di set Enth"); //OutputPort2.Enthalpy = 1199.8816; //OutputPort2.Temperature = 300; //OutputPort2.Temperature = InputPort2.Temperature; //OutputPort2.CalculateProperty(CapeOpenThermoMaterialPropertyType.Volume, CapeOpenPhaseType.Overall); //LogClass.WriteLog("Prima di calc equilibrium porta 2; Enthalpy IN2 = " + zEnthalpy2In.ToString() + " Duty = " + zDuty.ToString() + " EnthaplyOut2 = " + OutputPort2.Enthalpy); //OutputPort2.CalculateProperty(CapeOpenThermoMaterialPropertyType.Temperature, CapeOpenPhaseType.Overall, CapeOpenCalculationType.Nothing); //LogClass.WriteLog("Temperatura = " + OutputPort2.Temperature.ToString()); //string[] zProps = new string[1]; //zProps[0] = "Temperature"; //OutputPort2.CalculateEquilibrium(CapeOpenFlashType.PH,zProps); OutputPort2.CalculateEquilibrium(CapeOpenFlashType.PH); //LogClass.WriteLog("Temperatura = " + OutputPort2.Temperature.ToString() + " EnthaplyOut2 = " + OutputPort2.Enthalpy); //OutputPort2.Enthalpy = 1199.8816; LogClass.WriteLog("Dopo di calc equilibrium porta 2"); } }
protected override void OnCalculate() { double zTemperature1In = InputPort1.Temperature; double zPressure1In = InputPort1.Pressure; double zEnthalpy1In = InputPort1.Enthalpy; double zTotalFlow1In = InputPort1.TotalFlow; double[] zFraction1In = InputPort1.Fraction; double zTemperature2In = InputPort2.Temperature; double zPressure2In = InputPort2.Pressure; double zEnthalpy2In = InputPort2.Enthalpy; double zTotalFlow2In = InputPort2.TotalFlow; double[] zFraction2In = InputPort2.Fraction; double zDuty; switch (Operation) { case OperationType.HotOuttetTemp: if (zTemperature1In > zTemperature2In) { OutputPort1.Pressure = zPressure1In; OutputPort1.TotalFlow = zTotalFlow1In; OutputPort1.Fraction = zFraction1In; OutputPort1.Temperature = ParameterValue; OutputPort1.CalculateEquilibrium(CapeOpenFlashType.TP); zDuty = (zTotalFlow1In) * (OutputPort1.Enthalpy - zEnthalpy1In); OutputPort2.Pressure = zPressure2In; OutputPort2.TotalFlow = zTotalFlow2In; OutputPort2.Fraction = zFraction2In; OutputPort2.Enthalpy = zEnthalpy2In - (zDuty / zTotalFlow2In); OutputPort2.Temperature = 400; OutputPort2.CalculateEquilibrium(CapeOpenFlashType.PH); } else //(zTemperature1In < zTemperature2In) { OutputPort2.Pressure = zPressure2In; OutputPort2.TotalFlow = zTotalFlow2In; OutputPort2.Fraction = zFraction2In; OutputPort2.Temperature = ParameterValue; OutputPort2.CalculateEquilibrium(CapeOpenFlashType.TP); zDuty = (zTotalFlow2In) * (OutputPort2.Enthalpy - zEnthalpy2In); OutputPort1.Pressure = zPressure1In; OutputPort1.TotalFlow = zTotalFlow1In; OutputPort1.Fraction = zFraction1In; OutputPort1.Enthalpy = zEnthalpy1In - (zDuty / zTotalFlow1In); OutputPort1.Temperature = 400; OutputPort1.CalculateEquilibrium(CapeOpenFlashType.PH); } break; case OperationType.ColdOutletTemp: if (zTemperature1In < zTemperature2In) { OutputPort1.Pressure = zPressure1In; OutputPort1.TotalFlow = zTotalFlow1In; OutputPort1.Fraction = zFraction1In; OutputPort1.Temperature = ParameterValue; OutputPort1.CalculateEquilibrium(CapeOpenFlashType.TP); zDuty = (zTotalFlow1In) * (OutputPort1.Enthalpy - zEnthalpy1In); OutputPort2.Pressure = zPressure2In; OutputPort2.TotalFlow = zTotalFlow2In; OutputPort2.Fraction = zFraction2In; OutputPort2.Enthalpy = zEnthalpy2In - (zDuty / zTotalFlow2In); OutputPort2.Temperature = 400; OutputPort2.CalculateEquilibrium(CapeOpenFlashType.PH); } else //(zTemperature1In > zTemperature2In) { OutputPort2.Pressure = zPressure2In; OutputPort2.TotalFlow = zTotalFlow2In; OutputPort2.Fraction = zFraction2In; OutputPort2.Temperature = ParameterValue; OutputPort2.CalculateEquilibrium(CapeOpenFlashType.TP); zDuty = (zTotalFlow2In) * (OutputPort2.Enthalpy - zEnthalpy2In); OutputPort1.Pressure = zPressure1In; OutputPort1.TotalFlow = zTotalFlow1In; OutputPort1.Fraction = zFraction1In; OutputPort1.Enthalpy = zEnthalpy1In - (zDuty / zTotalFlow1In); OutputPort1.Temperature = 400; OutputPort1.CalculateEquilibrium(CapeOpenFlashType.PH); } break; case OperationType.Duty: zDuty = ParameterValue; if (zTemperature1In > zTemperature2In) { OutputPort1.Pressure = zPressure1In; OutputPort1.TotalFlow = zTotalFlow1In; OutputPort1.Fraction = zFraction1In; OutputPort1.Enthalpy = zEnthalpy1In - zDuty; OutputPort1.Temperature = 100; OutputPort1.CalculateEquilibrium(CapeOpenFlashType.PH); OutputPort2.Pressure = zPressure2In; OutputPort2.TotalFlow = zTotalFlow2In; OutputPort2.Fraction = zFraction2In; OutputPort2.Enthalpy = zEnthalpy2In + zDuty; OutputPort2.Temperature = 400; OutputPort2.CalculateEquilibrium(CapeOpenFlashType.PH); } else //(zTemperature1In < zTemperature2In) { OutputPort1.Pressure = zPressure1In; OutputPort1.TotalFlow = zTotalFlow1In; OutputPort1.Fraction = zFraction1In; OutputPort1.Enthalpy = zEnthalpy1In + zDuty; OutputPort1.Temperature = 100; OutputPort1.CalculateEquilibrium(CapeOpenFlashType.PH); OutputPort2.Pressure = zPressure2In; OutputPort2.TotalFlow = zTotalFlow2In; OutputPort2.Fraction = zFraction2In; OutputPort2.Enthalpy = zEnthalpy2In - zDuty; OutputPort2.Temperature = 400; OutputPort2.CalculateEquilibrium(CapeOpenFlashType.PH); } break; } }