现有组件功能与Amesim组件比较对齐,补全功能;仿真服务启动环境检测,旧版json工程文件适配读取

This commit is contained in:
ljz committed 2026-09-13 20:01:56 +08:00
1 parent b6c22a54f8
commit 6fc9afe41d
119 files changed
+260114 -351

No files matched your search

+14
View File
@@ -239,3 +239,17 @@ int native_medium_gas(const NativeMedium *medium, double m, double U, double V,
int native_medium_gas_context(NativePropertyCache *cache,const NativeMedium *m,double mass,double U,double V,NativeGas *g) {
int ok=native_medium_gas(m,mass,U,V,g);if(ok)remember_gas(cache,m,g);return ok;
}
int native_polytropic_gas_context(NativePropertyCache *cache,const NativeMedium *m,
double mass,double T,double V,NativeGas *g) {
/* Amesim's polytropic storage uses ideal-gas mass even when the selected
gas supplies real-fluid enthalpy/density to the connected resistances. */
if(!(mass>0 && T>0 && V>0))return 0;
g->T=T;g->p=mass*m->R*T/V;
g->rho=native_density_context(cache,m,g->p,T);
double dt=T-m->Tref;
g->h=m->real_helium?h_ideal(T)+h_departure(g->p,T):m->cp*T+.5*m->slope*dt*dt;
g->u=g->h-g->p/g->rho;
if(!(g->p>0 && g->rho>0 && isfinite(g->p) && isfinite(g->h) && isfinite(g->u)))return 0;
remember_gas(cache,m,g);return 1;
}