- Index
- » Programming
- » Modelica Language
- » Division by Zero
Division by Zero
Division by Zero
Hello,
I'm working on implementing a model on Dymola with TILSuite but I'm very new to the language and cannot pass this error.
The code is basically the following and there are division by Zero on the bold lines. I think the problem lies on the variables Retp and Ftp. Should I somehow give them a value?
equation
PipeInternalRoughness = 0.0015 "For Copper";
Usg = (noEvent(abs(mdotHydraulic))*vapor/properties.VLE.d_v) / cellGeometry.hydraulicCrossSectionalArea;
Usl = (noEvent(abs(mdotHydraulic))*liquid/properties.VLE.d_v) / cellGeometry.hydraulicCrossSectionalArea;
Ugm = (0.35*sin(0) + 0.45*cos(0))*((g*hxGeometry.tubeSideHydraulicDiameter*(properties.VLE.d_l-properties.VLE.d_v))/properties.VLE.d_l)^0.5*(1-alpha)^0.5*C2*C3*1;
Co = ((2 - (properties.VLE.d_v/properties.VLE.d_l)^2)/(1+(Retp/1000)^2))+(((((1+((properties.VLE.d_v/properties.VLE.d_l)^2)*cos(0))/(1+cos(0)))^0.5)^(1-alpha))^(2/5)+ Co1)/(1+(1000/Retp)^2);
Co1 = (C1 - C1*sqrt(properties.VLE.d_v / properties.VLE.d_l)) * ((2.6 - beta)^0.15 - sqrt(Ftp)) * (1-massQuality)^1.5;
C1 = if hxGeometry.portIsCircular then 0.2 else 0.4;
beta = Usg / (Usg + Usl + Modelica.Constants.small);
Retp=(properties.VLE.d_l * (Usg + Usl) * hxGeometry.tubeSideHydraulicDiameter) / properties.VLETransp.eta_l;
1 / sqrt(Ftp) = -4.0 * log10((PipeInternalRoughness/hxGeometry.tubeSideHydraulicDiameter)/3.7 + 1.256/(Retp*sqrt(Ftp)));
alpha = Usg / (Co * (Usg + Usl) + Ugm);
C2 = if properties.VLETransp.eta_l/0.0001>10 then (0.435/(log10(properties.VLETransp.eta_l/0.001)))^0.15 else 1;
C3 = if La < 0.025 then (La/0.025)^0.9 else 1;
La = sqrt(properties.transp.sigma/(g*(properties.VLE.d_v - properties.VLE.d_l)))/hxGeometry.tubeSideHydraulicDiameter;
- Index
- » Programming
- » Modelica Language
- » Division by Zero