From 15184c5751601acbf0e378fe4814dc8cda644d47 Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Thu, 21 Jan 2016 22:26:03 -0700 Subject: [PATCH] Add ability to retrieve REFPROP version; closes #937 --- src/Backends/REFPROP/REFPROPMixtureBackend.cpp | 14 ++++++++++++++ src/Backends/REFPROP/REFPROPMixtureBackend.h | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Backends/REFPROP/REFPROPMixtureBackend.cpp b/src/Backends/REFPROP/REFPROPMixtureBackend.cpp index bc1c95a2..7673b040 100644 --- a/src/Backends/REFPROP/REFPROPMixtureBackend.cpp +++ b/src/Backends/REFPROP/REFPROPMixtureBackend.cpp @@ -193,6 +193,20 @@ bool REFPROPMixtureBackend::REFPROP_supported () { } return false; } +std::string REFPROPMixtureBackend::version(){ + long N = -1; + long ierr = 0; + char fluids[10000] = "", hmx[] = "HMX.BNC", default_reference_state[] = "DEF", herr[255] = ""; + bool REFPROP_ok = REFPROPMixtureBackend::REFPROP_supported(); + SETUPdll(&N, fluids, hmx, default_reference_state, + &ierr, herr, + 10000, // Length of component_string (see PASS_FTN.for from REFPROP) + refpropcharlength, // Length of path_HMX_BNC + lengthofreference, // Length of reference + errormessagelength // Length of error message + ); + return strstrip(std::string(herr, herr+254)); +} void REFPROPMixtureBackend::set_REFPROP_fluids(const std::vector &fluid_names) { diff --git a/src/Backends/REFPROP/REFPROPMixtureBackend.h b/src/Backends/REFPROP/REFPROPMixtureBackend.h index f773e4b5..d5738c9c 100644 --- a/src/Backends/REFPROP/REFPROPMixtureBackend.h +++ b/src/Backends/REFPROP/REFPROPMixtureBackend.h @@ -47,6 +47,8 @@ public: std::string backend_name(void){return "REFPROPMixtureBackend";} virtual ~REFPROPMixtureBackend(); + + static std::string version(); std::vector calc_fluid_names(){return fluid_names;}; PhaseEnvelopeData PhaseEnvelope; @@ -94,7 +96,7 @@ public: void check_loaded_fluid(void); /// Returns true if REFPROP is supported on this platform - bool REFPROP_supported(void); + static bool REFPROP_supported(void); std::string fluid_param_string(const std::string &ParamName);