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

Function CP_get_mixture_binary_pair_data

wrappers/MathCAD/CoolPropMathcad.cpp:660–687  ·  view source on GitHub ↗

this code executes the user function CP_get_mixture_binary_pair_data, which is a wrapper for the CoolProp.get_mixture_binary_pair_data() function, used to get the requested binary pair interaction parameter (always returned as a string).

Source from the content-addressed store, hash-verified

658// the CoolProp.get_mixture_binary_pair_data() function, used to get the requested binary pair
659// interaction parameter (always returned as a string).
660static LRESULT CP_get_mixture_binary_pair_data(LPMCSTRING Value, // output string (string contains value of parameter)
661 LPCMCSTRING CAS1, // First component
662 LPCMCSTRING CAS2, // Second component
663 LPCMCSTRING Key) // name of the binary pair parameter (string) to retrieve
664{
665 std::string s;
666 // Invoke the std::string form of get_global_param_string() function, save result to a new string s
667 try {
668 s = CoolProp::get_mixture_binary_pair_data(CAS1->str, CAS2->str, Key->str);
669 } catch (const CoolProp::ValueError& e) {
670 std::string emsg(e.what());
671 CoolProp::set_error_string(emsg);
672 if (emsg.find("parameter") != std::string::npos)
673 return MAKELRESULT(BAD_PARAMETER, 3);
674 else if (emsg.find("binary pair") != std::string::npos)
675 return MAKELRESULT(BAD_BINARY_PAIR, 1);
676 else
677 return MAKELRESULT(UNKNOWN, 1);
678 }
679
680 // Must use MathcadAllocate(size) so Mathcad can track and release, using Helper routine above
681 char* c = AllocMathcadString(s);
682 // assign the string to the function's output parameter
683 Value->str = c;
684
685 // normal return
686 return 0;
687}
688
689// Helper: centralize check for predefined-mixture-not-found error messages
690static inline bool PredefinedMixtureNotFound(const std::string& emsg) {

Callers

nothing calls this directly

Calls 4

set_error_stringFunction · 0.85
AllocMathcadStringFunction · 0.85
whatMethod · 0.80

Tested by

no test coverage detected