Changed the description and fixed some laetx encoding issues

This commit is contained in:
Jorrit Wronski
2015-01-14 15:07:14 +01:00
parent 6b9cb35f51
commit 08b2ea285f
29 changed files with 149 additions and 53 deletions

View File

@@ -11,7 +11,7 @@ class NitrateSalt(PureData,CoefficientData):
CoefficientData.__init__(self)
PureData.__init__(self)
self.name = "NaK"
self.description = "Nitrate salt, heat transfer fluid based on 60% NaNO3 and 40% KNO3"
self.description = "Nitrate salt, 0.6 NaNO3 and 0.4 KNO3"
self.reference = "Zavoico2001"
self.Tmin = 300 + 273.15

View File

@@ -12,7 +12,7 @@ class DEBLiquidClass(CoefficientData,PureData):
CoefficientData.__init__(self)
PureData.__init__(self)
self.name = "DEB"
self.description = "Diethylbenzene mixture - Dowtherm J Dow Chemical Co."
self.description = "Diethylbenzene mixture - Dowtherm J"
self.reference = "Melinder2010"
self.Tmin = -80.0 + 273.15
@@ -46,7 +46,7 @@ class HCMLiquidClass(CoefficientData,PureData):
CoefficientData.__init__(self)
PureData.__init__(self)
self.name = "HCM"
self.description = "Hydrocarbon mixture (synthetic) - Therminol D12 (Gilotherm D12) Solutia"
self.description = "Hydrocarbon mixture - Gilotherm D12"
self.reference = "Melinder2010"
self.Tmin = -80.0 + 273.15
@@ -114,7 +114,7 @@ class PMS1LiquidClass(CoefficientData,PureData):
CoefficientData.__init__(self)
PureData.__init__(self)
self.name = "PMS1"
self.description = "Polydimethylsiloxan 1. - Baysilone KT3"
self.description = "Polydimethylsiloxan 1 - Baysilone KT3"
self.reference = "Melinder2010"
self.Tmin = -80.0 + 273.15
@@ -148,7 +148,7 @@ class PMS2LiquidClass(CoefficientData,PureData):
CoefficientData.__init__(self)
PureData.__init__(self)
self.name = "PMS2"
self.description = "Polydimethylsiloxan 2. - Syltherm XLT Dow Corning Co."
self.description = "Polydimethylsiloxan 2 - Syltherm XLT"
self.reference = "Melinder2010"
self.Tmin = -80.0 + 273.15
@@ -250,7 +250,7 @@ class TCOLiquidClass(CoefficientData,PureData):
CoefficientData.__init__(self)
PureData.__init__(self)
self.name = "TCO"
self.description = "Terpene from citrus oils - d-Limonene"
self.description = "Citrus oil terpene - d-Limonene"
self.reference = "Melinder2010"
self.Tmin = -80.0 + 273.15
@@ -289,7 +289,7 @@ class EGSolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MEG"
self.description = "Ethylene Glycol"
self.description = "Ethylene Glycol - aq"
self.reference = "Melinder2010"
self.Tmin =-100 + 273.15
@@ -331,7 +331,7 @@ class PGSolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MPG"
self.description = "Propylene Glycol"
self.description = "Propylene Glycol - aq"
self.reference = "Melinder2010"
self.Tmin =-100 + 273.15
@@ -373,7 +373,7 @@ class EASolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MEA"
self.description = "Ethyl Alcohol (Ethanol)"
self.description = "Ethyl Alcohol (Ethanol) - aq"
self.reference = "Melinder2010"
self.Tmin =-100 + 273.15
@@ -415,7 +415,7 @@ class MASolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MMA"
self.description = "Methyl Alcohol (Methanol)"
self.description = "Methyl Alcohol (Methanol) - aq"
self.reference = "Melinder2010"
self.Tmin =-100 + 273.15
@@ -458,7 +458,7 @@ class GLSolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MGL"
self.description = "Glycerol"
self.description = "Glycerol - aq"
self.reference = "Melinder2010"
self.Tmin =-100 + 273.15
@@ -500,7 +500,7 @@ class AMSolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MAM"
self.description = "Ammonia (NH3)"
self.description = "Ammonia (NH3) - aq"
self.reference = "Melinder2010"
self.Tmin =-100 + 273.15
@@ -542,7 +542,7 @@ class KCSolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MKC"
self.description = "Potassium Carbonate (K2CO3)"
self.description = "Potassium Carbonate (K2CO3) - aq"
self.reference = "Melinder2010"
self.Tmin =-100 + 273.15
@@ -584,7 +584,7 @@ class CASolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MCA"
self.description = "Calcium Chloride (CaCl2)"
self.description = "Calcium Chloride (CaCl2) - aq"
self.reference = "Melinder2010"
self.Tmin =-100.0 + 273.15
@@ -626,7 +626,7 @@ class MGSolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MMG"
self.description = "(MgCl2)"
self.description = "MgCl2 - aq"
self.reference = "Melinder2010"
self.Tmin =-100.0 + 273.15
@@ -668,7 +668,7 @@ class NASolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MNA"
self.description = "Sodium Chloride (NaCl)"
self.description = "Sodium Chloride (NaCl) - aq"
self.reference = "Melinder2010"
self.Tmin =-100.0 + 273.15
@@ -710,7 +710,7 @@ class KASolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MKA"
self.description = "Potassium Acetate (CH3CO2K)"
self.description = "Potassium Acetate (CH3CO2K) - aq"
self.reference = "Melinder2010"
self.Tmin =-100.0 + 273.15
@@ -752,7 +752,7 @@ class KFSolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MKF"
self.description = "Potassium Formate (CHKO2)"
self.description = "Potassium Formate (CHKO2) - aq"
self.reference = "Melinder2010"
self.Tmin =-100.0 + 273.15
@@ -794,7 +794,7 @@ class LISolution(CoefficientData):
def __init__(self):
CoefficientData.__init__(self)
self.name = "MLI"
self.description = "Lithium Chloride (LiCl)"
self.description = "Lithium Chloride (LiCl) - aq"
self.reference = "Melinder2010"
self.Tmin =-100.0 + 273.15

View File

@@ -584,7 +584,7 @@ class Water(PureData):
self.Tmax = np.max(self.temperature.data)
self.TminPsat = np.min(self.temperature.data[~np.isnan(self.saturation_pressure.data)])
self.name = "Water"
self.description = "Fit of the subcooled region of the full EOS from 1 bar to 100 bar"
self.description = "Fit of EOS from 1 bar to 100 bar"
self.reference = "Wagner-JPCRD-2002, Huber-JPCRD-2009"
self.reshapeAll()
# Specific heat needs special coefficiencts

View File

@@ -307,7 +307,7 @@ class SecCoolSolutionData(DigitalData):
print(", {0}".format(sec[-1].name), end="")
sec += [SecCoolSolutionData(sFile='Glykosol N' ,sFolder='xVolume',name='GKN',desc='Glykosol N, Ethylene Glycol' ,ref='PKS2005,Skovrup2013')]
print(", {0}".format(sec[-1].name), end="")
sec += [SecCoolSolutionData(sFile='Pekasol 2000' ,sFolder='xVolume',name='PK2',desc='Pekasol 2000, Potassium acetate/formate',ref='PKS2005,Skovrup2013')]
sec += [SecCoolSolutionData(sFile='Pekasol 2000' ,sFolder='xVolume',name='PK2',desc='Pekasol 2000, K acetate/formate' ,ref='PKS2005,Skovrup2013')]
print(", {0}".format(sec[-1].name), end="")
sec += [SecCoolSolutionData(sFile='Pekasol L' ,sFolder='xVolume',name='PKL',desc='Pekasol L, Propylene Glycol' ,ref='PKS2005,Skovrup2013')]
print(", {0}".format(sec[-1].name), end="")

View File

@@ -11,7 +11,7 @@ class LiBrData(SolutionData):
def __init__(self):
SolutionData.__init__(self)
self.name = "LiBr"
self.description = "Aqueous lithium-bromide solution "
self.description = "Lithium-bromide solution - aq"
self.reference = "Patek2006"
self.temperature.data = np.array([2.73000e+02, 2.84947e+02, 2.96895e+02, 3.08842e+02, 3.20789e+02, 3.32737e+02, 3.44684e+02, 3.56632e+02, 3.68579e+02, 3.80526e+02, 3.92474e+02, 4.04421e+02, 4.16368e+02, 4.28316e+02, 4.40263e+02, 4.52211e+02, 4.64158e+02, 4.76105e+02, 4.88053e+02, 5.00000e+02]) # Kelvin

View File

@@ -95,11 +95,11 @@ class SolutionDataWriter(object):
matplotlib.rcParams['axes.formatter.useoffset'] = False
self.ext = "pgf"
self.usebp = True
self.ispage = False # Do you want a page or a figure?
self.ext = "pdf"
self.usebp = False
self.ispage = True # Do you want a page or a figure?
self.isportrait = True
self.resolveRef = False # Resolve references and print text
self.resolveRef = True # Resolve references and print text
if self.ext=="pgf" or matplotlib.rcParams['text.usetex']:
self.usetex = True
@@ -164,13 +164,13 @@ class SolutionDataWriter(object):
ratio = 210.0/297.0 # A4 in mm
mm_to_inch = 3.93700787401575/100.0 # factor mm to inch
self.deta = 0.7 # factor for table
self.deta = 0.75 # factor for table
if self.ispage:
longSide = baseSize # Make A4
shortSide = baseSize * ratio
else:
lofa = 1.0 - self.deta * 2.5/11.5 # Half of the original table
longSide = baseSize * lofa #* 0.85 # Make smaller than A4
#lofa = 1.0 - self.deta * 2.5/11.5 # Half of the original table
longSide = baseSize #* lofa #* 0.85 # Make smaller than A4
shortSide = baseSize * ratio # TODO: connect to gridspec and ylim
if self.isportrait: self.figsize=(shortSide*mm_to_inch,longSide*mm_to_inch)
@@ -902,7 +902,12 @@ class SolutionDataWriter(object):
yStart = 0.575; y = yStart
#myAnnotate('Name: ',solObj.name,x=x,y=y); x += .0; y -= dy
myAnnotate('Description: ',solObj.description,x=x,y=y); x += .0; y -= dy
if self.usetex:
myAnnotate('Description: ',solObj.description.encode("latex"),x=x,y=y); x += .0; y -= dy
else:
myAnnotate('Description: ',solObj.description,x=x,y=y); x += .0; y -= dy
# TODO: Debug bibtexer
refs = solObj.reference.split(",")
@@ -1418,6 +1423,93 @@ class SolutionDataWriter(object):
text = u"{0:3.2f}".format(self.checkForNumber(number))
return text
def generateTexTable(self, solObjs=[SolutionData()], path="table"):
solObjs = sorted(solObjs, key=lambda x: x.name)
xmin = np.array([x.xmin for x in solObjs])
xmax = np.array([x.xmax for x in solObjs])
# TODO: This is a dirty hack!
if np.any(xmin>0.0) and np.any(xmax<1.0): use_x = True
else: use_x = False
header = [u'Name', u'Description', u'Reference', ur'{$T_\text{min}$ (\si{\celsius})}', ur'{$T_\text{max}$ (\si{\celsius})}', ur'{$T_\text{base}$ (\si{\kelvin})}']
if use_x: header.extend([ur'{$x_\text{min}$}', ur'{$x_\text{max}$}'])
testTable = []
testTable.append(header) # Headline
testSection = []
figPath = r"appendices/IncompressibleFluidsReports/"
# def getFigureText(fld):
# text = "\\begin{pgffigure} \n"
# text += "\\fbox{\\resizebox{\\textwidth}{!}{ \n"
# text += "\\subimport{"+str(figPath)+"}{"+str(fld)+"_fitreport.pgf} \n"
# text += "}} \n"
# text += "\\end{pgffigure} \n"
# return text
def getFigureText(fld):
text = "{\\centering"
text += "\\resizebox{\\textwidth}{!}{ \n"
text += "\\subimport{"+str(figPath)+"}{"+str(fld)+"_fitreport.pgf} \n"
text += "}} \\vfill \n"
return text
def getFigureLabel(fld):
return "subsec:fit"+str(fld)
for fluid in solObjs:
#\hyperref[label_name]{''link text''}
testTable.append([
fluid.name+", p.~\\pageref{"+getFigureLabel(fluid.name)+"}",
fluid.description.encode("latex"),
r'\cite{'+str(fluid.reference)+'}',
self.c(fluid.Tmin),
self.c(fluid.Tmax),
self.c(fluid.Tbase+273.15)
])
if use_x: testTable[-1].extend([self.x(fluid.xmin), self.x(fluid.xmax)])
testSection.append([
"\\subsection{Fitted functions for "+str(fluid.name)+"}",
"\\label{"+getFigureLabel(fluid.name)+"}",
getFigureText(fluid.name)
])
text = "\\cr \\topcrule \n"
i = -1
for row in testTable:
i += 1
if i < 1:
tmp = r"\headcol "+" & ".join(row)
elif i % 2 == 0:
tmp = r"\rowcol " +" & ".join(row)
else:
tmp = " & ".join(row)
text += tmp + " \\\\\n"
if i == 0: text += "\\midcrule \n"
if i % 2 == 0:
text += "\\bottomcrule \\cr \n"
else:
text += "\\bottomrule \\cr \n"
with open(path+".tex", 'w') as f:
f.write(text.encode('utf-8'))
text = "\n"
for i,row in enumerate(testSection):
tmp = "\n".join(row)
text += tmp + " \n\n"
with open(path+"-section.tex", 'w') as f:
f.write(text.encode('utf-8'))
return True
def generateRstTable(self, solObjs=[SolutionData()], path="table"):

View File

@@ -53,6 +53,9 @@ if __name__ == '__main__':
#if args.fluid: onlyFluid = args.fluid
#else: onlyFluid = None
#runReports = False
#runFitting = False
print("")
print("Processing the incompressible fluids for CoolProp")
print("Legend: FluidName (w) | (i) -> (w)=written, (i)=ignored, unchanged coefficient or reports")
@@ -253,6 +256,7 @@ if __name__ == '__main__':
#for f in objLists[i]: print(f.name, end=", ")
#print("... done")
writer.generateRstTable(objLists[i], filLists[i])
writer.generateTexTable(objLists[i], filLists[i])
print("All done, bye")
sys.exit(0)

View File

@@ -29,7 +29,7 @@
],
"type": "polynomial"
},
"description": "Diethylbenzene mixture - Dowtherm J Dow Chemical Co.",
"description": "Diethylbenzene mixture - Dowtherm J",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -29,7 +29,7 @@
],
"type": "polynomial"
},
"description": "Hydrocarbon mixture (synthetic) - Therminol D12 (Gilotherm D12) Solutia",
"description": "Hydrocarbon mixture - Gilotherm D12",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -85,7 +85,7 @@
],
"type": "polynomial"
},
"description": "Aqueous lithium-bromide solution ",
"description": "Lithium-bromide solution - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"
@@ -124,7 +124,7 @@
],
[
3.082839e-07,
5.253051e-08,
5.253052e-08,
2.549296e-07,
0.000000e+00,
0.000000e+00,

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Ammonia (NH3)",
"description": "Ammonia (NH3) - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Calcium Chloride (CaCl2)",
"description": "Calcium Chloride (CaCl2) - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Ethyl Alcohol (Ethanol)",
"description": "Ethyl Alcohol (Ethanol) - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Ethylene Glycol",
"description": "Ethylene Glycol - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Glycerol",
"description": "Glycerol - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Potassium Acetate (CH3CO2K)",
"description": "Potassium Acetate (CH3CO2K) - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Potassium Carbonate (K2CO3)",
"description": "Potassium Carbonate (K2CO3) - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Potassium Formate (CHKO2)",
"description": "Potassium Formate (CHKO2) - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Lithium Chloride (LiCl)",
"description": "Lithium Chloride (LiCl) - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Methyl Alcohol (Methanol)",
"description": "Methyl Alcohol (Methanol) - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "(MgCl2)",
"description": "MgCl2 - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Sodium Chloride (NaCl)",
"description": "Sodium Chloride (NaCl) - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Propylene Glycol",
"description": "Propylene Glycol - aq",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -29,7 +29,7 @@
],
"type": "polynomial"
},
"description": "Nitrate salt, heat transfer fluid based on 60% NaNO3 and 40% KNO3",
"description": "Nitrate salt, 0.6 NaNO3 and 0.4 KNO3",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -90,7 +90,7 @@
],
"type": "polynomial"
},
"description": "Pekasol 2000, Potassium acetate/formate",
"description": "Pekasol 2000, K acetate/formate",
"mass2input": {
"coeffs": [
[

View File

@@ -29,7 +29,7 @@
],
"type": "polynomial"
},
"description": "Polydimethylsiloxan 1. - Baysilone KT3",
"description": "Polydimethylsiloxan 1 - Baysilone KT3",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -29,7 +29,7 @@
],
"type": "polynomial"
},
"description": "Polydimethylsiloxan 2. - Syltherm XLT Dow Corning Co.",
"description": "Polydimethylsiloxan 2 - Syltherm XLT",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -29,7 +29,7 @@
],
"type": "polynomial"
},
"description": "Terpene from citrus oils - d-Limonene",
"description": "Citrus oil terpene - d-Limonene",
"mass2input": {
"coeffs": "null",
"type": "notdefined"

View File

@@ -41,7 +41,7 @@
],
"type": "polynomial"
},
"description": "Fit of the subcooled region of the full EOS from 1 bar to 100 bar",
"description": "Fit of EOS from 1 bar to 100 bar",
"mass2input": {
"coeffs": "null",
"type": "notdefined"