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

Function CP_PropsSI

wrappers/MathCAD/CoolPropMathcad.cpp:416–450  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

414// This code executes the user function CP_PropsSI, which is a wrapper for
415// the CoolProp.PropsSI() function, used to extract a fluid-specific parameter that is dependent on the state
416static LRESULT CP_PropsSI(LPCOMPLEXSCALAR Prop, // pointer to the result
417 LPCMCSTRING OutputName, // string with a valid CoolProp OutputName
418 LPCMCSTRING InputName1, // CoolProp InputName1
419 LPCCOMPLEXSCALAR InputProp1, // CoolProp InputProp1
420 LPCMCSTRING InputName2, // CoolProp InputName2
421 LPCCOMPLEXSCALAR InputProp2, // CoolProp InputProp2
422 LPCMCSTRING FluidName) // CoolProp Fluid
423{
424 // unsigned int errPos = 0;
425 std::string Prop1Name(InputName1->str);
426 std::string Prop2Name(InputName2->str);
427 std::string FluidString = FluidName->str;
428
429 // check that the first scalar argument is real
430 LRESULT r = CheckRealOrError(InputProp1, 3);
431 if (r) return r;
432
433 // check that the second scalar argument is real
434 r = CheckRealOrError(InputProp2, 5);
435 if (r) return r;
436
437 // pass the arguments to the CoolProp.PropsSI() function
438 Prop->real = CoolProp::PropsSI(OutputName->str, InputName1->str, InputProp1->real, InputName2->str, InputProp2->real, FluidName->str);
439
440 // Note: PropsSI does not throw exceptions, but instead
441 // sets global parameter "errstring" and returns _HUGE.
442 // Use ValidNumber(val) to see if PropsSI failed with an error message...
443 if (!ValidNumber(Prop->real)) {
444 std::string emsg = CoolProp::get_global_param_string("errstring");
445 CoolProp::set_error_string(emsg); // reset error string so Mathcad can retrieve it
446 return HandlePropsSIError(emsg, Prop1Name, 0u);
447 }
448 // normal return
449 return 0;
450}
451
452// This code executes the user function CP_PropsSImulti, which is a wrapper for
453// the CoolProp.PropsSImulti() function, used to extract a range of fluid-specific parameter dependent on the state ranges

Callers

nothing calls this directly

Calls 6

CheckRealOrErrorFunction · 0.85
ValidNumberFunction · 0.85
get_global_param_stringFunction · 0.85
set_error_stringFunction · 0.85
HandlePropsSIErrorFunction · 0.85
PropsSIFunction · 0.50

Tested by

no test coverage detected