Public
Edited
Aug 19, 2024
Paused
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
massFlowRange = mat.round([mat.unit(0,"kg/s"), mat.unit(100,"kg/s")].map(e=>e.toNumber(mDotU)))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
saturatedGas = temps.map((T) => ({
P: cp.PropsSI("P", "T|gas", T, "Q", 1, refrigerant),
H: cp.PropsSI("H", "T|gas", T, "Q", 1, refrigerant),
T
}))
Insert cell
state
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
state = res.state.map(e => ({
P: e.P.toNumber('Pa'),
T: e.T.toNumber('degC'),
H: e.H.toNumber('J/kg'),
S: e.S.toNumber('J/kg/ K'),
D: e.D.toNumber('kg/m^3')
}))
Insert cell
scope = new Map([
["fluid", refrigerant],
["mDot", mat.unit(mDot, mDotU)],
[
"evap",
{
T: mat.unit(evapT, evapTU),
P_drop: mat.unit(evapPd, evapPdU),
superHeating: mat.unit(evapSH, evapSHU)
}
],
[
"cond",
{
T: mat.unit(condT, condTU),
P_drop: mat.unit(condPd, condPdU),
subCooling: mat.unit(condSC, condSCU)
}
],
["etaS", etaS]
])
Insert cell
res = {
cycleParse.evaluate(scope);
const results = {
tlow: mat.number(scope.get("evap").T, "K"),
COP: scope.get("evap_COP"),
state: scope.get("c").toArray(),
Q: scope.get("Q_c")
};
return results;
}
Insert cell
cycleParse = mat.parse(`
c = [{},{},{},{}];

#Short function to get fluid properties
p(DesiredProperty, FluidState) = props(DesiredProperty, fluid, FluidState);

#Define low and high pressure
pLow = p('P', {'T|gas': evap.T, Q: 100%});
pHigh = p('P', {'T|liquid': cond.T, Q: 0% });

#4 to 1 Evaporation
c[1].P = pLow;
c[1].T = evap.T + evap.superHeating;
c[1].D = p('D', {'T|gas':c[1].T, P:c[1].P});
c[1].H = p('H', {'T|gas':c[1].T, P:c[1].P});
c[1].S = p('S', {'T|gas':c[1].T, P:c[1].P});

#1 to 2 Compression of vapor
c[2].P = pHigh + cond.P_drop ;
H_i = p('H',{P:c[2].P, S:c[1].S});
c[2].H = (H_i-c[1].H)/etaS + c[1].H;
c[2].T = p('T', c[2]);
c[2].D = p('D', c[2]);
c[2].S = p('S', c[2]);

#2 to 3 Condensation
c[3].P = pHigh;
c[3].T = cond.T - cond.subCooling;
c[3].D = p('D', {'T|liquid':c[3].T, P:c[3].P});
c[3].H = p('H', {'T|liquid':c[3].T, P:c[3].P});
c[3].S = p('S', {'T|liquid':c[3].T, P:c[3].P});

#3 to 4 Expansion
c[4].H = c[3].H;
c[4].P = c[1].P + evap.P_drop;
c[4].T = p('T', c[4]);
c[4].D = p('D', c[4]);
c[4].S = p('S', c[4]);

#Work, Energy and Performance
W_comp = mDot*(c[2].H - c[1].H);
Q_h = mDot*(c[2].H - c[3].H);
Q_c = mDot*(c[1].H - c[4].H);

evap_COP = Q_c/W_comp;
cond_COP = Q_h/W_comp;
`)
Insert cell
Insert cell
Insert cell
import {mat, cp} from "@dvd101x/coolprop"
Insert cell
parser = mat.parser()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more