MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / CP_set_mixture_binary_pair_data

Function CP_set_mixture_binary_pair_data

wrappers/MathCAD/CoolPropMathcad.cpp:816–853  ·  view source on GitHub ↗

This code executes the user function CP_set_mixture_binary_pair_data, which is a wrapper for the CoolProp.set_mixture_binary_pair_data() function, used to set the mixing rule for a specific binary pair.

Source from the content-addressed store, hash-verified

814// the CoolProp.set_mixture_binary_pair_data() function, used to set the mixing rule for a
815// specific binary pair.
816static LRESULT CP_set_mixture_binary_pair_data(LPMCSTRING Msg, // output string (verification message)
817 LPCMCSTRING CAS1, // First component
818 LPCMCSTRING CAS2, // Second component
819 LPCMCSTRING Param, // Parameter Name String to set
820 LPCCOMPLEXSCALAR Value) // Parameter Value
821{
822 std::string s = Param->str;
823 s.append(" parameter set.");
824
825 // check that the first scalar argument is real
826 LRESULT r = CheckRealOrError(Value, 4);
827 if (r) return r;
828
829 // Invoke the std::string form of get_global_param_string() function, save result to a new string s
830 try {
831 CoolProp::set_mixture_binary_pair_data(CAS1->str, CAS2->str, Param->str, Value->real);
832 } catch (const CoolProp::ValueError& e) {
833 std::string emsg(e.what());
834 CoolProp::set_error_string(emsg);
835 if (emsg.find("parameter") != std::string::npos) {
836 return MAKELRESULT(BAD_PARAMETER, 3);
837 } else if (emsg.find("key") != std::string::npos) {
838 if (emsg.find(CAS1->str) != std::string::npos)
839 return MAKELRESULT(BAD_FLUID, 1);
840 else
841 return MAKELRESULT(BAD_FLUID, 2);
842 } else
843 return MAKELRESULT(UNKNOWN, 1);
844 }
845
846 // Must use MathcadAllocate(size) so Mathcad can track and release
847 char* c = AllocMathcadString(s);
848 // assign the string to the function's output parameter
849 Msg->str = c;
850
851 // normal return
852 return 0;
853}
854
855// ********************************************************************************************************
856// Fill out a FUNCTIONINFO structure with the information needed for registering the function with Mathcad

Callers

nothing calls this directly

Calls 6

CheckRealOrErrorFunction · 0.85
set_error_stringFunction · 0.85
AllocMathcadStringFunction · 0.85
appendMethod · 0.80
whatMethod · 0.80

Tested by

no test coverage detected