(self, path)
| 485 | self.name = name |
| 486 | |
| 487 | def write(self, path): |
| 488 | def tos(n): |
| 489 | ''' convert number to nicely formatted string ''' |
| 490 | n = str(n) |
| 491 | if 'e' in n: |
| 492 | l, r = n.split('e') |
| 493 | n = rf' :math:`{l}@\times 10^{{{r}}}`' |
| 494 | else: |
| 495 | return n |
| 496 | return n |
| 497 | molar_mass = CoolProp.CoolProp.PropsSI(self.name, 'molemass') |
| 498 | Tt = CoolProp.CoolProp.PropsSI(self.name, 'Ttriple') |
| 499 | Tc = CoolProp.CoolProp.PropsSI(self.name, 'Tcrit') |
| 500 | Tr = CoolProp.CoolProp.PropsSI(self.name, 'T_reducing') |
| 501 | pc = CoolProp.CoolProp.PropsSI(self.name, 'pcrit') |
| 502 | pt = CoolProp.CoolProp.PropsSI(self.name, 'ptriple') |
| 503 | if pt is None: |
| 504 | pt = "Unknown" |
| 505 | Tmax = CoolProp.CoolProp.PropsSI(self.name, 'Tmax') |
| 506 | pmax = CoolProp.CoolProp.PropsSI(self.name, 'pmax') |
| 507 | acentric = CoolProp.CoolProp.PropsSI(self.name, 'acentric') |
| 508 | rhoc_mass = CoolProp.CoolProp.PropsSI(self.name, 'rhomass_critical') |
| 509 | rhoc_molar = CoolProp.CoolProp.PropsSI(self.name, 'rhomolar_critical') |
| 510 | rhor_molar = CoolProp.CoolProp.PropsSI(self.name, 'rhomolar_reducing') |
| 511 | |
| 512 | CAS = CoolProp.CoolProp.get_fluid_param_string(self.name, "CAS") |
| 513 | ASHRAE = CoolProp.CoolProp.get_fluid_param_string(self.name, "ASHRAE34") |
| 514 | formula = CoolProp.CoolProp.get_fluid_param_string(self.name, "formula") |
| 515 | if formula: |
| 516 | formula = formula2RST(formula) |
| 517 | else: |
| 518 | formula = 'Not applicable' |
| 519 | formula = formula.replace('_{1}', '') |
| 520 | InChI = CoolProp.CoolProp.get_fluid_param_string(self.name, "INCHI") |
| 521 | InChiKey = CoolProp.CoolProp.get_fluid_param_string(self.name, "INCHIKEY") |
| 522 | smiles = CoolProp.CoolProp.get_fluid_param_string(self.name, "SMILES") |
| 523 | ChemSpider_id = CoolProp.CoolProp.get_fluid_param_string(self.name, "CHEMSPIDER_ID") |
| 524 | twoDurl = CoolProp.CoolProp.get_fluid_param_string(self.name, "2DPNG_URL") |
| 525 | |
| 526 | # Generate (or not) the reducing data |
| 527 | reducing_data = '' |
| 528 | if abs(Tr - Tc) > 1e-3: |
| 529 | reducing_data = reducing_template.format(Tr=tos(Tr), |
| 530 | rhor_molar=tos(rhor_molar)) |
| 531 | |
| 532 | args = dict(mm=tos(molar_mass), |
| 533 | Tt=tos(Tt), |
| 534 | pt=tos(pt), |
| 535 | Tc=tos(Tc), |
| 536 | rhoc_mass=tos(rhoc_mass), |
| 537 | rhoc_molar=tos(rhoc_molar), |
| 538 | pc=tos(pc), |
| 539 | acentric=tos(acentric), |
| 540 | CAS=tos(CAS), |
| 541 | ASHRAE=tos(ASHRAE), |
| 542 | Tmax=tos(Tmax), |
| 543 | pmax=tos(pmax), |
| 544 | reducing_string=reducing_data, |
no test coverage detected