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
| 333 | // the CoolProp.Props1SI() function, used to simply extract a |
| 334 | // fluid-specific parameter that is not dependent on the state |
| 335 | static 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 |
| 359 | static LRESULT HandlePropsSIError(const std::string& emsg, const std::string& Prop1Name, const unsigned int o) { |
nothing calls this directly
no test coverage detected