Open johnhe001 opened 2 months ago
Could you create a working stand-alone working example with hardcoded values? That way it is easier for me to test it out
Thank you for your response! below is an independent working example with hardcoded values. I want to calculate the saturation temperature of methane based on pressure, then update the temperature and pressure of the methane to ultimately determine its enthalpy value. However, when the program runs, the code throws an error, specifically on this line: double I1 = fluid2.Enthalpy.KilojoulePerKilogram;. The error is: System.NullReferenceException: 'Object reference not set to an instance of an object.' SharpFluids.Fluid.Enthalpy.get returns null.
using EngineeringUnits; using SharpFluids; namespace nitrogen { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Fluid fluid = new Fluid(FluidList.Methane); double satT = fluid.GetSatTemperature(Pressure.FromMegapascal(0.7)).DegreeCelsius; Fluid fluid2 = new Fluid(FluidList.Methane); fluid2.UpdatePT(Pressure.FromMegapascal(0.7), Temperature.FromDegreesCelsius(satT)); double I1 = fluid2.Enthalpy.KilojoulePerKilogram; } } }
------------------ 原始邮件 ------------------ 发件人: "MadsKirkFoged/SharpFluids" @.>; 发送时间: 2024年6月26日(星期三) 下午4:08 @.>; 抄送: "何毅 储运1901班 @.**@.>; 主题: Re: [MadsKirkFoged/SharpFluids] some problem in getsattemperature (Issue #54)
Could you create a working stand-alone working example with hardcoded values? That way it is easier for me to test it out
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Why the saturation temperature values obtained using the GetSatTemperature() method cannot be used for the next step of the UpDatePT method? Here is an example of my partially error-free code: using EngineeringUnits; using SharpFluids;
namespace methane { public partial class Form1 : Form { public Form1() { InitializeComponent(); } double Qg, Ql, Vg, Vl, P, N, k, Tg, Tl, tk,Pg, Pl, densG,densL,satT,Dg,Ds,I1,I2,r; private void button1_Click(object sender, EventArgs e) {
When the above line is running, the last line of code gives an error prompt:“System.NullReferenceException:“Object reference not set to an instance of an object.” Please help me to answer it, thank you very much