SharpFluids icon indicating copy to clipboard operation
SharpFluids copied to clipboard

Updating Phase

Open commander9999 opened this issue 1 year ago • 1 comments

Hello Community, I am trying to simulate an originary heatpump with sharpfluids. The pressure of evaporator and compressor is known. Starting with Point 1 (after Evaporator, before Compressor), I have saturated gas. If I check the temperature table it must be the value for Vapor, but SharpFluids always returns the value for Liquid. How can I update the fluid to gas, and later to superheated vapor after the compressor?

commander9999 avatar May 26 '23 16:05 commander9999

Hi Commander9999,

Here is an code example for a heatpump running with Ammonia. Hope this can give you an idea of how to get started. Feel free to ask more questions if you have any :-)

//Setting up the fluids
Fluid CompressorIn = new Fluid(FluidList.Ammonia);
Fluid CompressorOut = new Fluid(FluidList.Ammonia);

Fluid CondenserIn = new Fluid(FluidList.Ammonia);
Fluid CondenserOut = new Fluid(FluidList.Ammonia);

Fluid ExpansionValveIn = new Fluid(FluidList.Ammonia);
Fluid ExpansionValveOut = new Fluid(FluidList.Ammonia);

Fluid EvaporatorIn = new Fluid(FluidList.Ammonia);
Fluid EvaporatorOut = new Fluid(FluidList.Ammonia);

//Setting for heatpump
Pressure PEvap = Pressure.FromBar(10);
Pressure Pcond = Pressure.FromBar(20);
Temperature SuperHeat = Temperature.FromKelvins(5);

//Evap
EvaporatorIn.UpdatePX(PEvap, 0);
EvaporatorOut.UpdatePX(PEvap, 1);

 //Adding superheat to evap
EvaporatorOut.UpdatePT(EvaporatorOut.Pressure, EvaporatorOut.Temperature + SuperHeat);

//Compresser
CompressorIn.Copy(EvaporatorOut);
CompressorOut.UpdatePS(Pcond, CompressorIn.Entropy);
SpecificEnergy H2s = CompressorOut.Enthalpy;

//Compressor equation
SpecificEnergy h2 = ((H2s - CompressorIn.Enthalpy) / 0.85) + CompressorIn.Enthalpy;
CompressorOut.UpdatePH(Pcond, h2);

CondenserIn.Copy(CompressorOut);
CondenserOut.UpdatePX(CondenserIn.Pressure,0);

 ExpansionValveIn.Copy(CondenserOut);
ExpansionValveOut.UpdatePH(EvaporatorIn.Pressure, ExpansionValveIn.Enthalpy);

EvaporatorIn.Copy(ExpansionValveOut);

 //Run this in loop until it is stable

MadsKirkFoged avatar May 27 '23 10:05 MadsKirkFoged