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

Function CP_Props1SI

wrappers/MathCAD/CoolPropMathcad.cpp:335–356  ·  view source on GitHub ↗

This code executes the user function CP_Props1SI, which is a wrapper for the CoolProp.Props1SI() function, used to simply extract a fluid-specific parameter that is not dependent on the state

Source from the content-addressed store, hash-verified

333// the CoolProp.Props1SI() function, used to simply extract a
334// fluid-specific parameter that is not dependent on the state
335static LRESULT CP_Props1SI(LPCOMPLEXSCALAR Prop, // pointer to the result
336 LPCMCSTRING Fluid, // string with a valid CoolProp fluid name
337 LPCMCSTRING PropName) // a fluid property
338{
339 std::string PropStr(PropName->str);
340 std::string FluidString = Fluid->str;
341
342 // pass the arguments to the CoolProp.Props1() function
343 Prop->real = CoolProp::Props1SI(Fluid->str, PropName->str);
344
345 // Note: Props1SI does not throw exceptions, but instead
346 // sets global parameter "errstring" and returns _HUGE.
347 // Use ValidNumber(val) to see if Props1SI failed with an error message...
348 if (!ValidNumber(Prop->real)) {
349 std::string emsg = CoolProp::get_global_param_string("errstring");
350 CoolProp::set_error_string(emsg); // reset error string so Mathcad can retrieve it
351 return HandleProps1SIError(emsg, FluidString, PropStr);
352 }
353
354 // normal return
355 return 0;
356}
357
358// Helper: centralize text-matching logic for PropsSI and PhaseSI error handling
359static LRESULT HandlePropsSIError(const std::string& emsg, const std::string& Prop1Name, const unsigned int o) {

Callers

nothing calls this directly

Calls 5

ValidNumberFunction · 0.85
get_global_param_stringFunction · 0.85
set_error_stringFunction · 0.85
HandleProps1SIErrorFunction · 0.85
Props1SIFunction · 0.50

Tested by

no test coverage detected