MadsKirkFoged / SharpFluids

Lightweight CoolProp C# Wrapper - for easy fluid properties lookups
MIT License
30 stars 9 forks source link

Updating Phase #50

Open commander9999 opened 1 year ago

commander9999 commented 1 year ago

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?

MadsKirkFoged commented 1 year ago

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