Add diagram workbench UI with Modelica DoF coaching and ISO glyphs.

Ship the Next.js cycle editor with CAD chrome, technical HX symbols, Fixed/Free boundary guidance, and secondary water/air pressure drop support in the solver stack.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-17 22:46:46 +02:00
parent 62efea0646
commit 3358b74342
275 changed files with 70187 additions and 5230 deletions

View File

@@ -132,7 +132,10 @@ pub enum CoolPropInputPair {
extern "C" {
/// Get a property value using pressure and temperature
#[cfg_attr(target_os = "macos", link_name = "\x01__Z7PropsSIPKcS0_dS0_dS0_")]
#[cfg_attr(all(not(target_os = "macos"), not(target_os = "windows")), link_name = "_Z7PropsSIPKcS0_dS0_dS0_")]
#[cfg_attr(
all(not(target_os = "macos"), not(target_os = "windows")),
link_name = "_Z7PropsSIPKcS0_dS0_dS0_"
)]
#[cfg_attr(target_os = "windows", link_name = "?PropsSI@@YANPEBD0N0N0@Z")]
fn PropsSI(
Output: *const c_char,
@@ -145,14 +148,26 @@ extern "C" {
/// Get a property value using input pair
#[cfg_attr(target_os = "macos", link_name = "\x01__Z8Props1SIPKcS0_")]
#[cfg_attr(all(not(target_os = "macos"), not(target_os = "windows")), link_name = "_Z8Props1SIPKcS0_")]
#[cfg_attr(
all(not(target_os = "macos"), not(target_os = "windows")),
link_name = "_Z8Props1SIPKcS0_"
)]
#[cfg_attr(target_os = "windows", link_name = "?Props1SI@@YANPEBD0@Z")]
fn Props1SI(Fluid: *const c_char, Output: *const c_char) -> c_double;
/// Get CoolProp version string
#[cfg_attr(target_os = "macos", link_name = "\x01__Z23get_global_param_stringPKcPci")]
#[cfg_attr(all(not(target_os = "macos"), not(target_os = "windows")), link_name = "get_global_param_string")]
#[cfg_attr(target_os = "windows", link_name = "?get_global_param_string@@YAJPEBDPEADH@Z")]
#[cfg_attr(
target_os = "macos",
link_name = "\x01__Z23get_global_param_stringPKcPci"
)]
#[cfg_attr(
all(not(target_os = "macos"), not(target_os = "windows")),
link_name = "get_global_param_string"
)]
#[cfg_attr(
target_os = "windows",
link_name = "?get_global_param_string@@YAJPEBDPEADH@Z"
)]
fn get_global_param_string(
Param: *const c_char,
Output: *mut c_char,
@@ -160,9 +175,18 @@ extern "C" {
) -> c_int;
/// Get fluid info
#[cfg_attr(target_os = "macos", link_name = "\x01__Z22get_fluid_param_stringPKcS0_Pci")]
#[cfg_attr(all(not(target_os = "macos"), not(target_os = "windows")), link_name = "get_fluid_param_string")]
#[cfg_attr(target_os = "windows", link_name = "?get_fluid_param_string@@YAJPEBD0PEADH@Z")]
#[cfg_attr(
target_os = "macos",
link_name = "\x01__Z22get_fluid_param_stringPKcS0_Pci"
)]
#[cfg_attr(
all(not(target_os = "macos"), not(target_os = "windows")),
link_name = "get_fluid_param_string"
)]
#[cfg_attr(
target_os = "windows",
link_name = "?get_fluid_param_string@@YAJPEBD0PEADH@Z"
)]
fn get_fluid_param_string(
Fluid: *const c_char,
Param: *const c_char,
@@ -194,7 +218,14 @@ pub unsafe fn props_si_pt(property: &str, p: f64, t: f64, fluid: &str) -> f64 {
let prop_c = std::ffi::CString::new(property).unwrap();
let fluid_c = CString::new(fluid).unwrap();
PropsSI(prop_c.as_ptr(), c"P".as_ptr(), p, c"T".as_ptr(), t, fluid_c.as_ptr())
PropsSI(
prop_c.as_ptr(),
c"P".as_ptr(),
p,
c"T".as_ptr(),
t,
fluid_c.as_ptr(),
)
}
/// Get a thermodynamic property using pressure and enthalpy.
@@ -213,7 +244,14 @@ pub unsafe fn props_si_ph(property: &str, p: f64, h: f64, fluid: &str) -> f64 {
let prop_c = std::ffi::CString::new(property).unwrap();
let fluid_c = CString::new(fluid).unwrap();
PropsSI(prop_c.as_ptr(), c"P".as_ptr(), p, c"H".as_ptr(), h, fluid_c.as_ptr())
PropsSI(
prop_c.as_ptr(),
c"P".as_ptr(),
p,
c"H".as_ptr(),
h,
fluid_c.as_ptr(),
)
}
/// Get a thermodynamic property using temperature and quality (saturation).
@@ -232,7 +270,14 @@ pub unsafe fn props_si_tq(property: &str, t: f64, q: f64, fluid: &str) -> f64 {
let prop_c = std::ffi::CString::new(property).unwrap();
let fluid_c = CString::new(fluid).unwrap();
PropsSI(prop_c.as_ptr(), c"T".as_ptr(), t, c"Q".as_ptr(), q, fluid_c.as_ptr())
PropsSI(
prop_c.as_ptr(),
c"T".as_ptr(),
t,
c"Q".as_ptr(),
q,
fluid_c.as_ptr(),
)
}
/// Get a thermodynamic property using pressure and quality.
@@ -261,6 +306,32 @@ pub unsafe fn props_si_px(property: &str, p: f64, x: f64, fluid: &str) -> f64 {
)
}
/// Get a thermodynamic property using pressure and specific entropy.
///
/// # Arguments
/// * `property` - The property to retrieve (e.g., "H" for enthalpy, "T" for temperature)
/// * `p` - Pressure in Pa
/// * `s` - Specific entropy in J/(kg·K)
/// * `fluid` - Fluid name
///
/// # Returns
/// # Safety
/// This function calls the CoolProp C++ library and passes a CString pointer.
/// The caller must ensure the fluid string is valid.
pub unsafe fn props_si_ps(property: &str, p: f64, s: f64, fluid: &str) -> f64 {
let prop_c = std::ffi::CString::new(property).unwrap();
let fluid_c = CString::new(fluid).unwrap();
PropsSI(
prop_c.as_ptr(),
c"P".as_ptr(),
p,
c"S".as_ptr(),
s,
fluid_c.as_ptr(),
)
}
/// Get critical point temperature for a fluid.
///
/// # Arguments
@@ -316,7 +387,11 @@ pub unsafe fn is_fluid_available(fluid: &str) -> bool {
let fluid_c = CString::new(fluid).unwrap();
// CoolProp C API does not expose isfluid, so we try fetching a property
let res = Props1SI(fluid_c.as_ptr(), c"Tcrit".as_ptr());
if res.is_finite() && res != 0.0 { true } else { false }
if res.is_finite() && res != 0.0 {
true
} else {
false
}
}
/// Get CoolProp version string.