diff --git a/AmesimModels/component-model-authoring-spec-v1(1).md b/AmesimModels/component-model-authoring-spec-v1(1).md new file mode 100644 index 0000000..d81dd72 --- /dev/null +++ b/AmesimModels/component-model-authoring-spec-v1(1).md @@ -0,0 +1,680 @@ +# 组件模型建模规范 v1 + +状态:已在 `experimental` 临时组件库实施 +适用对象:人工开发者、代码生成工具和 AI 编程助手 +配套读取规范:[组件库分类、发现与读取规范 v1](component-library-spec-v1.md) + +## 1. 文档目标 + +本文档规定一个 Python 仿真元件应如何创建、修改、测试和注册。完成后的模型必须 +同时满足四个使用方: + +1. 求解器能够实例化模型并调用方程。 +2. System XML 能够根据稳定类型找到模型。 +3. React Flow 能够自动显示图标、端口和参数。 +4. 结果页面能够根据结构化元数据展示变量。 + +本文档是模型代码的开发合同。若本文档与当前代码行为不一致,应把它视为缺陷: +先核对实际实现,再在同一次修改中同步代码、测试和文档,禁止让两套规则长期并存。 + +## 2. 开始前先判断任务类型 + +### 2.1 新增公开模型 + +公开模型会出现在前端组件库中,也能被 System XML 创建。必须: + +- 放入某个组件库的分类目录。 +- 实现完整模型契约。 +- 加入该库 `library.py` 的 `models` 清单。 +- 添加目录、契约、方程和最小仿真测试。 + +### 2.2 修改已有公开模型 + +必须先判断改动是否破坏已有工程: + +| 改动 | 版本建议 | 兼容性要求 | +| --- | --- | --- | +| 修复数值实现但不改变契约 | 修订版本 | 旧 XML 和工程继续可用 | +| 新增有默认值的参数或结果 | 次版本 | 旧工程缺少该字段时必须有迁移或默认值 | +| 修改界面名称或图标 | 库修订版本 | 不修改机器标识 | +| 修改方程的物理语义 | 根据影响提高次版本或主版本 | 补充基准和变更说明 | +| 删除、改名端口或参数 | 主版本 | 必须设计工程和 XML 迁移 | +| 修改 `MODEL_TYPE` | 视为新模型 | 旧类型必须保留迁移映射 | + +### 2.3 新增内部模型 + +仅供固定算例或研究代码使用、不进入前端目录的模型,不加入 `library.py`。这类模型 +应放在对应 `examples/` 或专用系统目录,不能与公开模型混放后依赖扫描规则排除。 + +当前示例是 +[`app/simulation/examples/testmodel/dynamic_pipe.py`](../app/simulation/examples/testmodel/dynamic_pipe.py)。 + +### 2.4 新增物理域 + +仅新增模型类不足以支持新物理域。除了模型,还必须设计: + +- `PortDefinition` 和端口变量。 +- 变量角色与连接规则。 +- 网络兼容性检查。 +- 代数方程和 stream/signal 传播。 +- XML 端口协议。 +- 前端连线兼容规则。 +- 最小闭合系统与求解测试。 + +没有完成这些基础能力时,不得仅通过修改 `domain` 字符串宣称支持新物理域。 + +## 3. 开发前必须读取的文件 + +人工或 AI 在修改模型前,应按顺序读取: + +1. 本文档。 +2. 目标库的 `library.py`。 +3. 同分类中物理行为最接近的现有模型。 +4. [`core/base.py`](../app/simulation/core/base.py)。 +5. [`core/ports.py`](../app/simulation/core/ports.py)。 +6. [`core/metadata.py`](../app/simulation/core/metadata.py)。 +7. [`core/catalog.py`](../app/simulation/core/catalog.py)。 +8. [`registry.py`](../app/simulation/registry.py) 中的启动校验。 +9. 与目标模型最接近的测试。 + +不要只根据文件名、前端图标或旧 XML 猜测模型语义。 + +## 4. 文件位置和命名 + +公开模型放在: + +```text +app/simulation/components///.py +``` + +例如: + +```text +app/simulation/components/experimental/storage/cylinder.py +app/simulation/components/experimental/flow/orifice.py +app/simulation/components/experimental/junctions/tee.py +``` + +规则: + +- 一个公开模型原则上对应一个文件和一个主要模型类。 +- 模块名、`MODEL_TYPE`、端口名和参数名使用稳定机器标识。 +- `MODEL_TYPE` 使用小写 `snake_case`。 +- 参数和结果变量允许保留已有热力学惯例,如 `T0`、`T`、`U`。 +- 中文名称只写入 `label`,不能代替机器标识。 +- 求解器、介质和网络通用逻辑不得复制到模型文件。 + +## 5. 公开模型完整契约 + +每个公开模型类必须在自身类体中显式声明: + +```python +MODEL_TYPE = "example_component" +MODEL_VERSION = "1.0.0" +PORTS = (...) +PARAMETERS = (...) +RESULT_VARIABLES = (...) +DISPLAY = ... +``` + +同时必须实现: + +```python +@classmethod +def create( + cls, + *, + name: str, + medium: IdealGasMedium, + parameters: Mapping[str, float], +) -> Component: + ... +``` + +注册器要求这些字段直接存在于公开模型类中。不要依赖父类隐式提供 +`MODEL_TYPE`、`MODEL_VERSION`、`PORTS`、`PARAMETERS`、`RESULT_VARIABLES`、 +`DISPLAY` 或 `create()`。 + +## 6. 基类选择 + +### 6.1 `AlgebraicComponent` + +适用于没有积分状态、由当前端口变量和参数直接决定残差的元件,例如: + +- 孔板 +- 阀门 +- 阻性管段 +- 理想三通 + +至少实现: + +- 构造函数和端口注册。 +- `create()`。 +- `pressure_flow_equation_residuals()`。 +- 需要传递 stream 变量时实现 `update_stream_outflows()`。 + +### 6.2 `ThermodynamicVolumeComponent` + +适用于包含质量和能量状态的气体容腔,例如: + +- 气瓶 +- 贮箱 +- 有容积的管段 + +至少实现: + +- `get_state_vector()`。 +- `set_state_vector()`。 +- `refresh_thermodynamic_ports()`。 +- `state_derivative_from_ports()`。 +- `pressure_flow_equation_residuals()`。 + +该基类已经提供标准热力学组件结果: + +```text +m, U, p, T, rho, u, h +``` + +除非物理含义不同,不要重新复制这组结果声明。 + +### 6.3 其他基类 + +如果现有基类不能表达模型,应先评估是否缺少一种通用组件能力。不要为了一个模型 +直接把专用判断塞入 `SimulationNetwork` 或求解器。 + +## 7. 端口建模规范 + +当前气动模型使用: + +```python +PortDefinition.pneumatic( + "port_a", + nominal_role="bidirectional", +) +``` + +气动端口包含: + +| 变量 | 角色 | 连接规则 | SI 单位 | +| --- | --- | --- | --- | +| `p` | `effort` | `equal` | `Pa` | +| `m_flow` | `flow` | `sumToZero` | `kg/s` | +| `h_outflow` | `stream` | `streamMix` | `J/kg` | + +必须遵守: + +- `m_flow > 0` 表示质量流入当前组件。 +- `nominal_role` 只用于界面和默认布局,不限制实际流向。 +- 物理连接是非因果的,连接线端点顺序不代表流向。 +- 所有声明端口必须使用 `register_declared_port()` 创建。 +- `DISPLAY.ports` 必须与 `PORTS` 名称集合完全一致。 +- 分支连接使用三通等连接元件,不能让一个物理端口直接连接多条边。 + +禁止: + +- 在模型内部根据画布左右方向判断流向。 +- 为了前端显示另造一套端口名。 +- 把 `port_a` 固定解释为真实入口、把 `port_b` 固定解释为真实出口。 +- 直接绕过端口状态读写其他组件对象。 + +## 8. 参数建模规范 + +所有用户可配置输入必须使用 `ParameterDefinition`: + +```python +ParameterDefinition( + name="volume", + label="容积", + quantity="volume", + unit="m3", + default=0.1, + minimum=0.0, + minimum_exclusive=True, +) +``` + +字段含义: + +| 字段 | 规则 | +| --- | --- | +| `name` | 稳定机器名,同时用于 XML、工程文件和 `create()` | +| `label` | 前端显示名称,不能为空 | +| `quantity` | 受控物理量标识 | +| `unit` | 后端 SI 基准单位 | +| `default` | 必须能够创建有效模型 | +| `minimum` / `maximum` | 必须反映方程有效范围 | +| `minimum_exclusive` | 用于直径、容积等严格大于零的量 | + +当前受控单位定义在 `SI_UNIT_BY_QUANTITY`: + +| quantity | SI 单位 | +| --- | --- | +| `dimensionless` | 空字符串 | +| `density` | `kg/m³` | +| `flow_coefficient` | `kg/(s*Pa^0.5)` | +| `internal_energy` | `J` | +| `length` | `m` | +| `mass` | `kg` | +| `mass_flow` | `kg/s` | +| `pressure` | `Pa` | +| `specific_enthalpy` | `J/kg` | +| `specific_internal_energy` | `J/kg` | +| `temperature` | `K` | +| `volume` | `m3` | + +新增物理量时必须先扩展后端受控单位表,再评估前端是否需要单位换算选项。禁止在 +单个模型中私自拼写新的同义 `quantity`。 + +构造函数必须调用: + +```python +self.set_parameter_values( + { + "volume": volume, + "p0": p0, + "T0": T0, + } +) +``` + +保存值、方程计算和结果输出都使用 SI。前端显示单位变化不能改变后端参数语义。 + +## 9. 结果变量规范 + +### 9.1 组件级结果 + +组件自身状态或派生量使用 `ResultVariableDefinition`: + +```python +ResultVariableDefinition( + name="pressure_drop", + label="压降", + quantity="pressure", + unit="Pa", + category="derived", + order=10, +) +``` + +声明后必须在 `component_result_values()` 返回同名值: + +```python +def component_result_values(self) -> Mapping[str, float]: + return { + "pressure_drop": self.port_a.p - self.port_b.p, + } +``` + +声明集合和返回键必须一致。 + +### 9.2 端口结果 + +端口结果由 `PORTS` 的端口变量自动产生,不要在 `RESULT_VARIABLES` 中重复声明 +`port_a.p`、`port_a.m_flow` 等字段。 + +### 9.3 禁止暴露的内容 + +以下内容默认不能作为用户结果: + +- 非线性求解器内部未知量索引。 +- 缩放残差和迭代缓存。 +- 仅用于调试的临时中间值。 +- 可以由已有结果稳定推导、但没有明确工程用途的重复字段。 + +## 10. 显示声明规范 + +公开模型必须声明 `DISPLAY`: + +```python +DISPLAY = ComponentDisplaySpec( + label="示例阻力元件", + library_id="experimental", + category_id="flow", + symbol="generic", + ports=( + PortDisplaySpec("port_a", "left", order=10), + PortDisplaySpec("port_b", "right", order=20), + ), + order=90, +) +``` + +规则: + +- `library_id` 必须等于所属库 ID。 +- `category_id` 必须存在于所属库的 `categories`。 +- `symbol` 是前端图形键,不是模型类型。 +- 未实现专用图标时使用新的稳定键,前端会回退到通用图形。 +- 只有确实需要专用工程图标时才修改前端图标渲染器。 +- `side` 只允许 `left` 或 `right`。 +- 旋转和镜像不能改变端口名或物理语义。 + +## 11. 标准创建入口 + +`create()` 是注册器创建模型的唯一入口: + +```python +@classmethod +def create( + cls, + *, + name: str, + medium: IdealGasMedium, + parameters: Mapping[str, float], +) -> ExampleComponent: + return cls( + name=name, + medium=medium, + coefficient=parameters["coefficient"], + ) +``` + +注册器会在调用前: + +1. 补齐默认参数。 +2. 拒绝未知参数。 +3. 检查有限值和边界。 + +调用后还会检查: + +1. 返回对象类型正确。 +2. 实例 `model_type` 与 `MODEL_TYPE` 一致。 +3. 实际端口与 `PORTS` 完全一致。 +4. 实例保存的参数与规范化参数完全一致。 + +`create()` 不应重复实现参数默认值和边界校验,也不能静默修改传入参数。 + +## 12. 方程实现要求 + +模型方程必须满足: + +- 残差形式统一为“期望等式左侧减右侧”。 +- 每条 `EquationResidual` 使用稳定、可定位的 `id`。 +- `variables` 列出该残差实际涉及的端口量或状态。 +- `role` 与方程主要约束的物理角色一致。 +- 对零压差、零流量和反向流动给出有限结果。 +- 必要正则化必须有物理解释,并通过边界测试保护。 +- 不得用画布坐标、连接线方向或组件名称决定方程。 + +动态模型还必须: + +- 状态向量长度稳定。 +- `get_state_vector()` 和 `set_state_vector()` 互为逆操作。 +- 状态导数满足质量和能量守恒约定。 +- 初始化默认值能够产生有限介质状态。 + +## 13. 可复制的代数模型模板 + +下面是一个符合当前规范的两端口代数阻力模板。复制后必须根据真实物理模型修改 +类型、参数、方程、名称和测试,不能只改类名就注册。 + +```python +from __future__ import annotations + +from collections.abc import Mapping +from math import sqrt + +from app.simulation.core.base import AlgebraicComponent +from app.simulation.core.catalog import ComponentDisplaySpec, PortDisplaySpec +from app.simulation.core.equations import EquationResidual +from app.simulation.core.metadata import ParameterDefinition +from app.simulation.core.medium import IdealGasMedium +from app.simulation.core.ports import PortDefinition + + +class ExampleRestriction(AlgebraicComponent): + MODEL_TYPE = "example_restriction" + MODEL_VERSION = "1.0.0" + PORTS = ( + PortDefinition.pneumatic("port_a", nominal_role="bidirectional"), + PortDefinition.pneumatic("port_b", nominal_role="bidirectional"), + ) + PARAMETERS = ( + ParameterDefinition( + name="K", + label="流量系数", + quantity="flow_coefficient", + unit="kg/(s*Pa^0.5)", + default=1e-5, + minimum=0.0, + ), + ) + RESULT_VARIABLES = () + DISPLAY = ComponentDisplaySpec( + label="示例阻力元件", + library_id="experimental", + category_id="flow", + symbol="generic", + ports=( + PortDisplaySpec("port_a", "left", order=10), + PortDisplaySpec("port_b", "right", order=20), + ), + order=90, + ) + + def __init__(self, name: str, K: float = 1e-5) -> None: + super().__init__(name) + self.set_parameter_values({"K": K}) + self.K = K + self.port_a = self.register_declared_port("port_a") + self.port_b = self.register_declared_port("port_b") + + @classmethod + def create( + cls, + *, + name: str, + medium: IdealGasMedium, + parameters: Mapping[str, float], + ) -> ExampleRestriction: + return cls(name=name, K=parameters["K"]) + + def pressure_flow_equation_residuals( + self, + ) -> tuple[EquationResidual, ...]: + pressure_difference = self.port_a.p - self.port_b.p + expected_flow = ( + self.K + * sqrt(abs(pressure_difference)) + * (1.0 if pressure_difference > 0.0 else -1.0) + if pressure_difference != 0.0 + else 0.0 + ) + return ( + EquationResidual( + id=f"{self.name}:mass_flow_balance", + owner="component", + owner_id=self.name, + relation="sumToZero", + variables=( + f"{self.name}.port_a.m_flow", + f"{self.name}.port_b.m_flow", + ), + role="flow", + value=self.port_a.m_flow + self.port_b.m_flow, + ), + EquationResidual( + id=f"{self.name}:pressure_flow_relation", + owner="component", + owner_id=self.name, + relation="constitutive", + variables=( + f"{self.name}.port_a.p", + f"{self.name}.port_b.p", + f"{self.name}.port_a.m_flow", + ), + role="flow", + value=self.port_a.m_flow - expected_flow, + ), + ) + + def update_stream_outflows( + self, + connected_h: Mapping[str, float], + ) -> None: + self.port_a.h_outflow = connected_h["port_b"] + self.port_b.h_outflow = connected_h["port_a"] +``` + +真实现有模型可参考: + +- 储能元件: + [`cylinder.py`](../app/simulation/components/experimental/storage/cylinder.py) +- 阻性元件: + [`orifice.py`](../app/simulation/components/experimental/flow/orifice.py) +- 多端口连接元件: + [`tee.py`](../app/simulation/components/experimental/junctions/tee.py) + +## 14. 注册模型 + +模型文件完成后,只修改所属库的 `library.py`: + +```python +models=( + # 已有模型 + "app.simulation.components.experimental.flow.example_restriction:ExampleRestriction", +) +``` + +禁止: + +- 直接修改 `COMPONENT_MODEL_REGISTRY`。 +- 在前端复制参数和端口定义作为正式来源。 +- 递归扫描组件目录自动导入所有 `.py`。 +- 同时注册两个相同 `MODEL_TYPE`。 +- 把测试类、抽象基类或内部算例模型加入公开清单。 + +## 15. 测试要求 + +每个公开模型至少添加: + +1. 静态契约测试。 +2. 默认参数创建测试。 +3. 参数边界测试。 +4. 端口与显示布局一致性测试。 +5. 关键方程残差测试。 +6. 零流量或反向流动测试。 +7. 目录输出测试。 +8. 最小 XML 编译测试。 +9. 能进入通用求解器的模型,再添加短时仿真测试。 + +推荐先运行: + +```powershell +.\.venv-win\Scripts\python.exe -m unittest ` + tests.test_component_registry ` + tests.test_component_catalog ` + tests.test_component_metadata +``` + +然后运行完整回归: + +```powershell +.\.venv-win\Scripts\python.exe -m unittest discover -s tests +``` + +目录契约影响前端时还要运行: + +```powershell +cd frontend +$env:Path = 'F:\Master\SystemSimulationApp\.tools\node-v24.18.0-win-x64;' + $env:Path +npm.cmd run build +``` + +## 16. 修改已有模型的安全步骤 + +1. 找到 `MODEL_TYPE` 的所有 XML、工程和测试引用。 +2. 记录修改前的端口、参数、结果和默认行为。 +3. 判断版本级别和是否需要迁移。 +4. 先增加或修改测试,明确预期物理行为。 +5. 修改模型类,不在注册器和前端复制规则。 +6. 检查默认实例和旧参数是否仍能创建。 +7. 检查最小系统是否仍然闭合。 +8. 运行针对性测试和完整回归。 +9. 同步本文档或模型专属说明中的物理假设。 + +## 17. 人工或 AI 的任务输入卡 + +为了减少猜测,新增模型前建议先填写: + +```text +模型中文名称: +MODEL_TYPE: +所属 library_id: +所属 category_id: +物理域: +模型用途和边界: +端口列表及含义: +参数列表、SI 单位、默认值和范围: +状态变量: +代数方程或微分方程: +正流量约定: +需要显示的组件结果: +已知参考模型或工程公式: +最小测试系统: +允许的近似: +明确不实现的能力: +``` + +如果关键物理信息缺失,AI 应先通过现有模型、测试或用户提供的参考补齐;不能仅凭 +组件名称自行创造方程。 + +## 18. AI 修改协议 + +AI 创建或修改模型时必须遵守: + +### 修改前 + +1. 读取第 3 节列出的文件。 +2. 检查工作区已有改动,不能覆盖无关修改。 +3. 明确模型是公开模型还是内部模型。 +4. 明确端口物理域、状态、参数、方程和结果。 +5. 找到最接近的现有模型并沿用代码风格。 + +### 修改中 + +1. 将物理契约保存在模型类中。 +2. 只在库清单中登记公开模型。 +3. 不修改集中注册表来加入单个模型。 +4. 不为了让测试通过而放宽全局校验。 +5. 不改变现有模型标识,除非任务明确要求迁移。 +6. 不把前端拖拽方向当作物理流向。 +7. 不把求解器失败简单隐藏为默认结果。 + +### 修改后 + +1. 展示涉及的模型、清单和测试文件。 +2. 报告版本变化和兼容性影响。 +3. 运行针对性测试、完整后端测试和必要的前端构建。 +4. 检查 `GET /api/components/catalog` 中的模型、分类、端口和参数。 +5. 告知用户需要重启 FastAPI 才能加载新的 Python 模块。 +6. 未执行的校验必须明确说明原因。 + +## 19. 常见失败与处理 + +| 现象 | 常见原因 | 处理 | +| --- | --- | --- | +| FastAPI 启动时报模型缺少声明 | 字段继承自父类或漏写 | 在公开模型类中显式声明 | +| 模型未出现在前端 | 未加入 `library.py` 或后端未重启 | 检查清单并重启 FastAPI | +| 前端显示“内置兜底” | `/api/components/catalog` 不可用 | 检查 8000 端口和接口响应 | +| 显示端口校验失败 | `DISPLAY.ports` 与 `PORTS` 不一致 | 使用相同端口名和完整集合 | +| 单位校验失败 | `quantity` 与 SI 单位不匹配 | 使用受控单位表或先扩展规范 | +| 默认模型无法注册 | 默认参数越界或构造函数未保存参数 | 修复默认值和 `set_parameter_values()` | +| XML 报不支持模型 | XML `type` 与 `MODEL_TYPE` 不一致 | 修正类型或提供迁移 | +| 模型可显示但无法仿真 | 只完成目录元数据,方程或物理域求解未实现 | 补齐方程、网络和求解测试 | + +## 20. 完成定义 + +一个模型只有同时满足以下条件才算完成: + +- 模型契约完整且启动校验通过。 +- 默认参数和边界有效。 +- 端口、参数和结果具有稳定物理含义。 +- 方程覆盖零流量、正常流动和必要的反向流动。 +- 模型已加入正确库清单。 +- 目录接口能自动输出模型。 +- 前端无需复制参数和端口定义即可使用。 +- XML 能映射到正确模型。 +- 最小系统能够编译;声称可仿真的模型必须产生有限结果。 +- 针对性测试、完整回归和必要的前端构建通过。 +- 文档记录了模型假设、适用范围和已知限制。 diff --git a/AmesimModels/help/pneumatic_library_manual/03_gas_properties.pdf b/AmesimModels/help/pneumatic_library_manual/03_gas_properties.pdf new file mode 100644 index 0000000..150a8f3 Binary files /dev/null and b/AmesimModels/help/pneumatic_library_manual/03_gas_properties.pdf differ diff --git a/AmesimModels/help/pneumatic_library_manual/06_important_rules.pdf b/AmesimModels/help/pneumatic_library_manual/06_important_rules.pdf new file mode 100644 index 0000000..849e2fa Binary files /dev/null and b/AmesimModels/help/pneumatic_library_manual/06_important_rules.pdf differ diff --git a/AmesimModels/help/pneumatic_library_manual/07_review_pneumatic.pdf b/AmesimModels/help/pneumatic_library_manual/07_review_pneumatic.pdf new file mode 100644 index 0000000..6d7ec0d Binary files /dev/null and b/AmesimModels/help/pneumatic_library_manual/07_review_pneumatic.pdf differ diff --git a/AmesimModels/help/pneumatic_library_manual/08_pipes.pdf b/AmesimModels/help/pneumatic_library_manual/08_pipes.pdf new file mode 100644 index 0000000..b56ec4d Binary files /dev/null and b/AmesimModels/help/pneumatic_library_manual/08_pipes.pdf differ diff --git a/AmesimModels/help/pneumatic_library_manual/lib_pneumatic.pdf b/AmesimModels/help/pneumatic_library_manual/lib_pneumatic.pdf new file mode 100644 index 0000000..a9662c6 Binary files /dev/null and b/AmesimModels/help/pneumatic_library_manual/lib_pneumatic.pdf differ diff --git a/AmesimModels/help/source/PNCH012.c b/AmesimModels/help/source/PNCH012.c new file mode 100644 index 0000000..382bb31 --- /dev/null +++ b/AmesimModels/help/source/PNCH012.c @@ -0,0 +1,388 @@ +/* Submodel PNCH012 skeleton created by AME Submodel editing utility + mar. oct. 9 14:41:15 2018 */ + + + +#include +#include +#include +#include "ameutils.h" +/* ******************************************************************************* +TITLE : PNCH012 +-------------------------------------------------------------------------------- +DESCRIPTION : + This submodel represents a pneumatic chamber with a variable volume + and pressure dynamics. + + Each port receives a mass flow rate and an enthalpy flow rate as + input and gives the pressure and the temperature of the chamber as + output. Each port receives also the volume and volume variation as + input. The total volume is calculated by summing the four volume + inputs and a dead volume which is a parameter of PNCH012. + + The model takes into account heat exchange. It express the variation + of internal energy U using the first law of thermodynamics applied to + an open system. Therefore, this model should be preferred to the simple + polytropic chamber PNCH011. + + The total volume of the chamber is limited to a lower value equal to + the dead volume divided by 100. +-------------------------------------------------------------------------------- +USAGE : + Use this submodel to simulate a pneumatic chamber in a jack, spool + valve or any pneumatic chamber in which the volume can vary. + + This submodel can be directly connected to any pneumatic PCD + component or standard pneumatic component. + + The submodels PNGD001, PNGD002, PNGD003, PNGD004 or PNRGD00 should be + included in your circuit to define the characteristics of the gas. +-------------------------------------------------------------------------------- +PARAMETER SETTINGS: + The dead volume is the volume of the pneumatic fluid when all the input + volumes are zero. It is essential that this volume must be greater + than zero. +-------------------------------------------------------------------------------- +DATE OF CREATION / AUTHOR : + 2002 FS from PNCH12 +-------------------------------------------------------------------------------- +INDEX OF REVISIONS : + 2008 OBA - Real gas improvements : the mass and volume were considered as + internal state variable, they are now coded as internal basic + variable. The mass initialisation was removed as it was linked + to the perfect gas formulation. +-------------------------------------------------------------------------------- +LIST OF FUNCTIONS USED : + pn2getatp : get atmospheric pressure + firstc_ : checks if this is the first call to this submodel + pn2vol_ : pneumatic chamber with heat exchange + stepdn_ : reduce simulation step +-------------------------------------------------------------------------------- +SOURCE : + + This material contains trade secrets or otherwise confidential + information owned by Siemens Industry Software Inc. or its + affiliates (collectively, "Siemens"), or its licensors. Access to + and use of this information is strictly limited as set forth in the + Customer's applicable agreements with Siemens. + + Unpublished work. Copyright 2023 Siemens + +******************************************************************************* */ + +#define _SUBMODELNAME_ "PNCH012" + +/* >>>>>>>>>>>>Insert Private Code Here. */ +/* <<<<<<<<<<< m**3] + kth thermal exchange coefficient [J/m**2/K/s -> W/m**2/K] + sth thermal exchange area [m**2] + extemp external temperature [K] +*/ + + +/* There is 1 integer parameter: + + gi gas type index +*/ + +void pnch012in_(int *n, double rp[4], int ip[1], double c[2] + , int ic[2], double *temp, double *press, double *dvol1 + , double *vol1, double *dvol2, double *vol2, double *dvol3 + , double *vol3, double *dvol4, double *vol4) + +{ + int loop, error; +/* >>>>>>>>>>>>Extra Initialization Function Declarations Here. */ +/* <<<<<<<<<<<>>>>>>>>>>>Initialization Function Check Statements. */ + + pn2_valid_gas_(&gi, &error); + + if (cvol0 <= 0.0) + { + error = 2; + amefprintf(stderr, "\nVolume chamber must be strictly positive.\n"); + } + + if (kth < 0.0) + { + error = 2; + amefprintf(stderr, "\nthermal exchange coefficient must be positive.\n"); + } + + if (sth < 0.0) + { + error = 2; + amefprintf(stderr, "\nthermal exchange area must be positive.\n"); + } + + if (extemp <= 0.0) + { + error = 2; + amefprintf(stderr, "\nExternal temperature must be strictly positive.\n"); + } + + if (*temp <= 0.0) + { + error = 2; + amefprintf(stderr, "\nInitial temperature must be strictly positive.\n"); + } + + + +/* <<<<<<<<<<< 99) + { + amefprintf(stderr, "\ngas type index must be in range [1..99].\n"); + error = 2; + } + + if(error == 1) + { + amefprintf(stderr, "\nWarning in %s instance %d.\n", _SUBMODELNAME_, *n); + } + else if(error == 2) + { + amefprintf(stderr, "\nFatal error in %s instance %d.\n", _SUBMODELNAME_, *n); + amefprintf(stderr, "Terminating the program.\n"); + AmeExit(1); + } + +/* Common -> SI units conversions. */ + + rp[0] *= 1.00000000000000e-003; + cvol0 = rp[0]; + + +/* >>>>>>>>>>>>Initialization Function Executable Statements. */ + + c[0] = cvol0 / 100; + + /* Set initial value for the test of limited volume : + ic[1] = 1 when the chamber volume is limited to cvol0 / 100 else ic[1] = 0*/ + ic[1] = 0; + + /* set atmospheric pressure */ + c[1] = pn2getatp_(); + +/* <<<<<<<<<<< W] basic variable input + 4 dm1 mass flow rate at port 1 [g/s -> kg/s] basic variable input + 5 dvol1 derivative of volume at port 1 [L/min -> m**3/s] basic variable input with default 0.000000e+000 + 6 vol1 volume at port 1 [cm**3 -> m**3] basic variable input with default 0.000000e+000 + + Port 2 has 6 variables: + + 1 temp2 duplicate of temp + 2 press2 duplicate of press + 3 dh2 enthalpy flow rate at port 2 [J/s -> W] basic variable input + 4 dm2 mass flow rate at port 2 [g/s -> kg/s] basic variable input + 5 dvol2 derivative of volume at port 2 [L/min -> m**3/s] basic variable input with default 0.000000e+000 + 6 vol2 volume at port 2 [cm**3 -> m**3] basic variable input with default 0.000000e+000 + + Port 3 has 6 variables: + + 1 temp3 duplicate of temp + 2 press3 duplicate of press + 3 dh3 enthalpy flow rate at port 3 [J/s -> W] basic variable input + 4 dm3 mass flow rate at port 3 [g/s -> kg/s] basic variable input + 5 dvol3 derivative of volume at port 3 [L/min -> m**3/s] basic variable input with default 0.000000e+000 + 6 vol3 volume at port 3 [cm**3 -> m**3] basic variable input with default 0.000000e+000 + + Port 4 has 6 variables: + + 1 temp4 duplicate of temp + 2 press4 duplicate of press + 3 dh4 enthalpy flow rate at port 4 [J/s -> W] basic variable input + 4 dm4 mass flow rate at port 4 [g/s -> kg/s] basic variable input + 5 dvol4 derivative of volume at port 4 [L/min -> m**3/s] basic variable input with default 0.000000e+000 + 6 vol4 volume at port 4 [cm**3 -> m**3] basic variable input with default 0.000000e+000 +*/ + +/* There are 2 internal variables. + + 1 vol volume of pneumatic chamber [cm**3 -> m**3] basic variable + 2 mgas1 mass of gas in chamber [g -> kg] basic variable +*/ + +void pnch012_(int *n, double *temp, double *dtemp, double *press + , double *dpress, double *dh1, double *dm1, double *dvol1 + , double *vol1, double *dh2, double *dm2, double *dvol2 + , double *vol2, double *dh3, double *dm3, double *dvol3 + , double *vol3, double *dh4, double *dm4, double *dvol4 + , double *vol4, double *vol, double *mgas1, double rp[4] + , int ip[1], double c[2], int ic[2]) + +{ + int loop; +/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */ + double dvol; + double sdm, sdh; + double dq; + double pressa; +/* <<<<<<<<<<< SI units conversions. */ + + *dm1 *= 1.00000000000000e-003; + *dvol1 *= 1.66666666666667e-005; + *vol1 *= 1.00000000000000e-006; + *dm2 *= 1.00000000000000e-003; + *dvol2 *= 1.66666666666667e-005; + *vol2 *= 1.00000000000000e-006; + *dm3 *= 1.00000000000000e-003; + *dvol3 *= 1.66666666666667e-005; + *vol3 *= 1.00000000000000e-006; + *dm4 *= 1.00000000000000e-003; + *dvol4 *= 1.66666666666667e-005; + *vol4 *= 1.00000000000000e-006; + +/* + Set all submodel outputs below: + + *dtemp = ??; + *dpress = ??; + *vol = ??; + *mgas1 = ??; +*/ + + + +/* >>>>>>>>>>>>Calculation Function Executable Statements. */ + + /* set absolute pressure */ + pressa = *press + c[1]; + + /*** sum of the volume variation and volume ***/ + dvol = *dvol1 + *dvol2 + *dvol3 + *dvol4; + + /*** setup the initial mass of the gaz inside of the chamber ***/ + *vol = *vol1 + *vol2 + *vol3 + *vol4 + cvol0; + + /*** sum of the flows ***/ + sdm = *dm1 + *dm2 + *dm3 + *dm4; /* mass flow */ + sdh = *dh1 + *dh2 + *dh3 + *dh4; /* heat flow */ + + /*** V, M, T and P can not be lower than zero ***/ + *vol = llimit_(vol, &c[0], &ic[0]); + + if (ic[0] == -1) + { + dvol = 0.; + if (ic[1] == 0) + { + amefprintf(stderr, "\nWarning in %s instance %d chamber volume is limited by cvol0 / 100 = %g cm**3.\n", _SUBMODELNAME_, *n, c[0]*1E+6); + ic[1] = 1; + } + } + + if (*vol < c[0]/10) + { + *vol = c[0]/10; + } + + if ( (*mgas1 <= 1.0e-10) && (!firstc_()) ) + { + /* panic step reduction */ + stepdn_(); + *mgas1 = 1.0e-10; + } + + if (pressa <= 1.0e-10) + { + /* panic step reduction */ + stepdn_(); + *press = 1.0e-10 - c[1]; + } + + if (*temp <= 1.0e-10) + { + /* panic step reduction */ + stepdn_(); + *temp = 1.0e-10; + } + + /*** temperature & pressure variation ***/ + dq = kth*sth*(extemp-*temp); + + pn2vol_(dtemp, dpress, mgas1, temp, &pressa, + &sdm, &sdh, vol, &dvol, &dq, &gi); + +/* <<<<<<<<<<< Common units conversions. */ + + *dm1 /= 1.00000000000000e-003; + *dvol1 /= 1.66666666666667e-005; + *vol1 /= 1.00000000000000e-006; + *dm2 /= 1.00000000000000e-003; + *dvol2 /= 1.66666666666667e-005; + *vol2 /= 1.00000000000000e-006; + *dm3 /= 1.00000000000000e-003; + *dvol3 /= 1.66666666666667e-005; + *vol3 /= 1.00000000000000e-006; + *dm4 /= 1.00000000000000e-003; + *dvol4 /= 1.66666666666667e-005; + *vol4 /= 1.00000000000000e-006; + *vol /= 1.00000000000000e-006; + *mgas1 /= 1.00000000000000e-003; +} + diff --git a/AmesimModels/help/source/PNCH012.spe b/AmesimModels/help/source/PNCH012.spe new file mode 100644 index 0000000..0ad88a1 --- /dev/null +++ b/AmesimModels/help/source/PNCH012.spe @@ -0,0 +1,356 @@ + + + + + + 0 + 33 + pn_c1 + variable volume pneumatic chamber with heat exchange (preferred) + 0 + 2 + 2 + 1 + + + 27 + dead volume + cvol0 + True + 1.00000000000000e+00 + 1.00000000000000e+00 + 0.00000000000000e+000 + 1.00000000000000e+005 + L + + + 28 + thermal exchange coefficient + kth + True + 0.00000000000000e+00 + 0.00000000000000e+00 + 0.00000000000000e+000 + 1.00000000000000e+006 + J/m**2/K/s + + + 29 + thermal exchange area + sth + True + 1.00000000000000e-01 + 1.00000000000000e-01 + 0.00000000000000e+000 + 1.00000000000000e+002 + m**2 + + + 30 + external temperature + extemp + True + 2.93150000000000e+02 + 2.93150000000000e+02 + 1.00000000000000e+000 + 1.00000000000000e+003 + K + + + + + 31 + gas type index + gi + True + 1 + 1 + 1 + 99 + + + + + 32 + volume of pneumatic chamber + vol + True + 0 + 1 + cm**3 + + + 33 + mass of gas in chamber + mgas1 + True + 0 + 1 + g + + + + + + 1 + temperature + temp + dtemp + True + 1 + 1 + 2 + K + 0.00000000000000e+000 + 1.00000000000000e+003 + 2.93150000000000e+002 + 2.93150000000000e+002 + + + 2 + pressure + press + dpress + True + 1 + 1 + 2 + Pa + -1.01300000000000e+005 + 1.00000000000000e+012 + 0.00000000000000e+000 + 0.00000000000000e+000 + + + 3 + enthalpy flow rate at port 1 + dh1 + True + 0 + 1 + 1 + J/s + + + 4 + mass flow rate at port 1 + dm1 + True + 0 + 1 + 1 + g/s + + + 5 + derivative of volume at port 1 + dvol1 + True + 0 + 1 + 3 + L/min + 0 + + + 6 + volume at port 1 + vol1 + True + 0 + 1 + 3 + cm**3 + 0 + + + + + 7 + temp2 + True + 4 + 0 + 0 + 0 + + + 8 + press2 + True + 4 + 0 + 1 + 0 + + + 9 + enthalpy flow rate at port 2 + dh2 + True + 0 + 1 + 1 + J/s + + + 10 + mass flow rate at port 2 + dm2 + True + 0 + 1 + 1 + g/s + + + 11 + derivative of volume at port 2 + dvol2 + True + 0 + 1 + 3 + L/min + 0 + + + 12 + volume at port 2 + vol2 + True + 0 + 1 + 3 + cm**3 + 0 + + + + + 13 + temp3 + True + 4 + 0 + 0 + 0 + + + 14 + press3 + True + 4 + 0 + 1 + 0 + + + 15 + enthalpy flow rate at port 3 + dh3 + True + 0 + 1 + 1 + J/s + + + 16 + mass flow rate at port 3 + dm3 + True + 0 + 1 + 1 + g/s + + + 17 + derivative of volume at port 3 + dvol3 + True + 0 + 1 + 3 + L/min + 0 + + + 18 + volume at port 3 + vol3 + True + 0 + 1 + 3 + cm**3 + 0 + + + + + 19 + temp4 + True + 4 + 0 + 0 + 0 + + + 20 + press4 + True + 4 + 0 + 1 + 0 + + + 21 + enthalpy flow rate at port 4 + dh4 + True + 0 + 1 + 1 + J/s + + + 22 + mass flow rate at port 4 + dm4 + True + 0 + 1 + 1 + g/s + + + 23 + derivative of volume at port 4 + dvol4 + True + 0 + 1 + 3 + L/min + 0 + + + 24 + volume at port 4 + vol4 + True + 0 + 1 + 3 + cm**3 + 0 + + + + 0 + + diff --git a/AmesimModels/help/source/PNL0001.c b/AmesimModels/help/source/PNL0001.c new file mode 100644 index 0000000..e7954a0 --- /dev/null +++ b/AmesimModels/help/source/PNL0001.c @@ -0,0 +1,348 @@ +/* Submodel PNL0001 skeleton created by AME Submodel editing utility + mer. juin 20 14:20:39 2018 */ + + + +#include +#include +#include +#include "ameutils.h" +/* ******************************************************************************* +TITLE : PNL0001 (C-R) +------------------------------------------------------------------------------ +DESCRIPTION : + PNL0001 is a submodel of a pneumatic pipe with only compressibility + and friction effects taking into account heat exchange. + + The compressibility of the gas is taken into account by using a + simple polytropic model or a more complex one taking into account + heat exchange. + + The polytropic model is a simplified form of the general internal + energy model based on the first law of thermodynamics. The polytropic + approach is obtained by representing the thermal exchange phenomena + by a polytropic constant k. In that case, the temperature and + pressure are no more independent variables. + + The reduction of the complexity of the model implies a lack of + accuracy. For general studies, you'd better use the heat exchange + approach. + + Pipe friction is taken into account using a friction factor based on + the Reynolds number and the relative roughness. + + The temperature and pressure in the volume are state variables. +------------------------------------------------------------------------------ +USAGE : + Use this submodel to simulate a pneumatic pipe with compressibility + and friction effects, when the Mach number is low, ie gas velocity + < 0.3 * speed of sound . + + The submodels PNGD001 or PNGD002 should be included in your circuit to + define the characteristics of the gas. +------------------------------------------------------------------------------ +PARAMETER SETTINGS : +------------------------------------------------------------------------------ +DATE OF CREATION / AUTHOR : + 2002 FS from PNL01 SN. +------------------------------------------------------------------------------ +REVISIONS : +------------------------------------------------------------------------------ +LIST OF FUNCTIONS USED : + pn2getatp_() : get atmospheric pressure + pn2ri_() : get perfect gas constant + pn2vol1_() : polytropic model for chambers + pn2vol_() : heat exchange model for chambers + pn2pipefr_() : frictional coeffitient in pneumatic pipes +------------------------------------------------------------------------------ +SOURCE : + + This material contains trade secrets or otherwise confidential + information owned by Siemens Industry Software Inc. or its + affiliates (collectively, "Siemens"), or its licensors. Access to + and use of this information is strictly limited as set forth in the + Customer's applicable agreements with Siemens. + + Unpublished work. Copyright 2023 Siemens + +******************************************************************************* */ + +#define _SUBMODELNAME_ "PNL0001" + +/* >>>>>>>>>>>>Insert Private Code Here. */ +#define TABFR 0 /* real store 0, 1 & 2 are used by pn2pipefr */ +#define PATM 3 +#define AREA 4 +#define VOL 5 +#define AREAEX 6 + +#define SPL_FR 0 +/* <<<<<<<<<<< m] + le pipe length [m] + rr relative roughness [null] + k polytropic constant [null] + kth thermal exchange coefficient [J/m**2/K/s -> W/m**2/K] + extemp external temperature [K] +*/ + + +/* There are 2 integer parameters: + + gi gas type index + mode model +*/ + +void pnl0001in_(int *n, double rp[6], int ip[2], double c[7] + , int ic[1], double *t2, double *p2) + +{ + int loop, error; +/* >>>>>>>>>>>>Extra Initialization Function Declarations Here. */ +/* <<<<<<<<<<<>>>>>>>>>>>Initialization Function Check Statements. */ + + pn2_valid_gas_(&gi, &error); + + if (*p2 < -GPATMOS) + { + error = 2; + amefprintf(stderr, "\nInitial pressure at port 2 should be > 0 [barA].\n"); + } + + if (*t2 <= 0.0) + { + error = 2; + amefprintf(stderr, "\nInitial temperature at port 2 should be > 0 [K].\n"); + } + + if (diam <= 0.0) + { + error = 2; + amefprintf(stderr, "\nDiameter of pipe should be > 0 [mm].\n"); + } + + if (le <= 0.0) + { + error = 2; + amefprintf(stderr, "\nPipe length should be > 0 [m].\n"); + } + + if (rr < 0.0) + { + error = 2; + amefprintf(stderr, "\nRelative roughness should be >= 0.\n"); + } + + if (mode == 1) + { + if (k <= 0.) + { + error = 2; + amefprintf(stderr, "\nPolytropic constant should be > 0.\n"); + } + } + else + { + if (kth < 0.) + { + error = 2; + amefprintf(stderr, "\nThermal exchange coefficient should be >= 0 [J/m**2/K/s].\n"); + } + + if (extemp <= 0.) + { + error = 2; + amefprintf(stderr, "\nExternal temperature should be > 0 [K].\n"); + } + } + +/* <<<<<<<<<<< 99) + { + amefprintf(stderr, "\ngas type index must be in range [1..99].\n"); + error = 2; + } + if (mode < 1 || mode > 2) + { + amefprintf(stderr, "\nmodel must be in range [1..2].\n"); + error = 2; + } + + SUBMODEL_HANDLE_AND_RESET_ERROR(_SUBMODELNAME_, n, error) + +/* Common -> SI units conversions. */ + + rp[0] *= 1.00000000000000e-003; + diam = rp[0]; + + +/* >>>>>>>>>>>>Initialization Function Executable Statements. */ + + /* get atmospheric pressure */ + c[PATM] = pn2getatp_(); + + /* Compute the cross-sectional area of pipe. */ + c[AREA] = M_PI * (diam) * (diam) / 4.0; + + /* Compute volume of pipe. */ + c[VOL] = c[AREA] * le; + + /* Compute exchange area of pipe. */ + c[AREAEX] = M_PI * diam * le; + +/* <<<<<<<<<<< W] basic variable output + 2 dm1 mass flow rate at port 1 [g/s -> kg/s] basic variable output + 3 t1 temperature at port 1 [K] basic variable input + 4 p1 pressure at port 1 [Pa] basic variable input + + Port 2 has 4 variables: + + 1 t2 temperature at port 2 [K] explicit state (derivative `dt2') + 2 p2 pressure at port 2 [Pa] explicit state (derivative `dp2') + 3 dh2 enthalpy flow rate at port 2 [J/s -> W] basic variable input + 4 dm2 mass flow rate at port 2 [g/s -> kg/s] basic variable input +*/ + +/* There are 5 internal variables. + + 1 mgas mass of gas in pipe [g -> kg] basic variable + 2 re Reynolds number [null] basic variable + 3 cm mass flow parameter (cm) [(kg*K/J)**(1/2)] basic variable + 4 v mean gas velocity [m/s] basic variable + 5 ff friction factor [null] basic variable +*/ + +void pnl0001_(int *n, double *dh1, double *dm1, double *t1, double *p1 + , double *t2, double *dt2, double *p2, double *dp2, double *dh2 + , double *dm2, double *mgas, double *re, double *cm, double *v + , double *ff, double rp[6], int ip[2], double c[7], int ic[1]) + +{ + int loop; +/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */ + static double zero = 0.0; + double sdh; + double dh2i, dm2i; + double dq; + double pa1, pa2, dmgas; + double r; + int dummyreg; +/* <<<<<<<<<<< SI units conversions. */ + + *dm2 *= 1.00000000000000e-003; + +/* + Set all submodel outputs below: + + *dh1 = ??; + *dm1 = ??; + *dt2 = ??; + *dp2 = ??; + *mgas = ??; + *re = ??; + *cm = ??; + *v = ??; + *ff = ??; +*/ + + + +/* >>>>>>>>>>>>Calculation Function Executable Statements. */ + + /* set absolute pressures */ + pa1 = *p1 + c[PATM]; + pa2 = *p2 + c[PATM]; + + /* Compute flows through the pipe */ + pn2pipefr_(&pa1, t1, &pa2, t2, &diam, &rr, &le, &c[AREA], re, v,ff, + dh1, dm1, &dh2i, &dm2i, cm, &c[TABFR], &gi, &ic[SPL_FR], &dummyreg); + + /* Compute mass variation */ + dmgas = (*dm2) + dm2i; + + /* sum of enthalpy flows */ + sdh = (*dh2) + dh2i; + + /*** temperature & pressure variation ***/ + + if (mode == 1) /* Polytropic model. */ + { + r = pn2ri_(&gi); + /* Compute initial mass of gas inside the pipe */ + *mgas = (pa2) * c[VOL] / ((*t2) * r); + + pn2vol1_(dt2, dp2, t2, &pa2, + &dmgas, mgas, &zero, &c[VOL], &k, &gi); + } + else /* Heat exchange. */ + { + dq = kth * c[AREAEX] * (extemp - *t2); + + pn2vol_(dt2, dp2, mgas, t2, &pa2, + &dmgas, &sdh, &c[VOL], &zero, &dq, &gi); + } + + +/* <<<<<<<<<<< Common units conversions. */ + + *dm1 /= 1.00000000000000e-003; + *dm2 /= 1.00000000000000e-003; + *mgas /= 1.00000000000000e-003; +} + diff --git a/AmesimModels/help/source/PNL0001.spe b/AmesimModels/help/source/PNL0001.spe new file mode 100644 index 0000000..05729ed --- /dev/null +++ b/AmesimModels/help/source/PNL0001.spe @@ -0,0 +1,257 @@ + + + + + + 0 + 22 + p2port + Compressibility + friction submodel of pneumatic pipe (C-R) + 0 + 7 + 1 + 1 + + + 14 + diameter of pipe + diam + True + 1.00000000000000e+01 + 1.00000000000000e+01 + 1.00000000000000e-003 + 1.00000000000000e+007 + mm + + + 15 + pipe length + le + True + 1.00000000000000e+00 + 1.00000000000000e+00 + 1.00000000000000e-006 + 1.00000000000000e+004 + m + + + 16 + relative roughness + rr + True + 1.00000000000000e-05 + 1.00000000000000e-05 + 0.00000000000000e+000 + 1.00000000000000e-001 + null + + + 17 + polytropic constant + k + (mode == 1) + 1.35000000000000e+00 + 1.35000000000000e+00 + 5.00000000000000e-001 + 2.00000000000000e+000 + null + + + 18 + thermal exchange coefficient + kth + (mode == 2) + 0.00000000000000e+00 + 0.00000000000000e+00 + 0.00000000000000e+000 + 1.00000000000000e+006 + J/m**2/K/s + + + 19 + external temperature + extemp + (mode == 2) + 2.93150000000000e+02 + 2.93150000000000e+02 + 1.00000000000000e+000 + 1.00000000000000e+003 + K + + + + + 20 + gas type index + gi + True + 1 + 1 + 1 + 99 + + + 21 + model + mode + True + 2 + 2 + 1 + 2 + + + polytropic + + + with thermal exchange + + + + + + + 22 + mass of gas in pipe + mgas + True + 0 + 1 + g + + + 10 + Reynolds number + re + True + 0 + 1 + null + + + 11 + mass flow parameter (cm) + cm + True + 0 + 1 + (kg*K/J)**(1/2) + + + 12 + mean gas velocity + v + True + 0 + 1 + m/s + + + 13 + friction factor + ff + True + 0 + 1 + null + + + + + + 1 + enthalpy flow rate at port 1 + dh1 + True + 0 + 1 + 2 + J/s + + + 2 + mass flow rate at port 1 + dm1 + True + 0 + 1 + 2 + g/s + + + 3 + temperature at port 1 + t1 + True + 0 + 1 + 1 + K + + + 4 + pressure at port 1 + p1 + True + 0 + 1 + 1 + Pa + + + + + 5 + temperature at port 2 + t2 + dt2 + True + 1 + 1 + 2 + K + 0.00000000000000e+000 + 1.00000000000000e+004 + 2.93150000000000e+002 + 2.93150000000000e+002 + + + 6 + pressure at port 2 + p2 + dp2 + True + 1 + 1 + 2 + Pa + -1.01300000000000e+005 + 1.00000000000000e+012 + 0.00000000000000e+000 + 0.00000000000000e+000 + + + 7 + enthalpy flow rate at port 2 + dh2 + True + 0 + 1 + 1 + J/s + + + 8 + mass flow rate at port 2 + dm2 + True + 0 + 1 + 1 + g/s + + + + 0 + + diff --git a/AmesimModels/help/source/PNL0002.c b/AmesimModels/help/source/PNL0002.c new file mode 100644 index 0000000..ddf695e --- /dev/null +++ b/AmesimModels/help/source/PNL0002.c @@ -0,0 +1,368 @@ +/* Submodel PNL0002 skeleton created by AME Submodel editing utility + mer. juin 20 14:35:13 2018 */ + + + +#include +#include +#include +#include "ameutils.h" +/* ******************************************************************************* +TITLE : PNL0002 (R-C-R) +------------------------------------------------------------------------------ +DESCRIPTION : + PNL0002 is a submodel of a pneumatic pipe with only compressibility + and friction effects taking into account heat exchange. + + The compressibility of the gas is taken into account by using a + simple polytropic model or a more complex one taking into account + heat exchange. + + The polytropic model is a simplified form of the general internal + energy model based on the first law of thermodynamics. The polytropic + approach is obtained by representing the thermal exchange phenomena + by a polytropic constant k. In that case, the temperature and + pressure are no more independent variables. + + The reduction of the complexity of the model implies a lack of + accuracy. For general studies, you'd better use the heat exchange + approach. + + Pipe friction is taken into account using a friction factor based on + the Reynolds number and the relative roughness. + + The temperature and pressure in the middle volume are state variables. +------------------------------------------------------------------------------ +USAGE : + Use this submodel to simulate a pneumatic pipe with compressibility + and friction effects, when the Mach number is low, ie gas velocity + < 0.3 * speed of sound . + + PNL0002 is basically similar to PNL0001 and PNL0003 differing only in the + input and output requirements. + + The submodels PNGD01 or PNGD02 should be included in your circuit to + define the characteristics of the gas. +------------------------------------------------------------------------------ +PARAMETER SETTINGS : +------------------------------------------------------------------------------ +DATE OF CREATION / AUTHOR : + 2002 FS from PNL02 SN. +------------------------------------------------------------------------------ +REVISIONS : +------------------------------------------------------------------------------ +LIST OF FUNCTIONS USED : + pn2getatp_() : get atmospheric pressure + pn2ri_() : get perfect gas constant + pn2vol1_() : polytropic model for chambers + pn2vol_() : heat exchange model for chambers + pn2pipefr_() : frictional coeffitient in pneumatic pipes +------------------------------------------------------------------------------ +SOURCE : + + This material contains trade secrets or otherwise confidential + information owned by Siemens Industry Software Inc. or its + affiliates (collectively, "Siemens"), or its licensors. Access to + and use of this information is strictly limited as set forth in the + Customer's applicable agreements with Siemens. + + Unpublished work. Copyright 2023 Siemens + +******************************************************************************* */ + +#define _SUBMODELNAME_ "PNL0002" + +/* >>>>>>>>>>>>Insert Private Code Here. */ +#define TABFR 0 /* real store 0, 1 & 2 are used by pn2pipefr */ +#define PATM 3 +#define AREA 4 +#define VOL 5 +#define HALFLE 6 +#define AREAEX 7 + + +#define SPL_FR 0 +/* <<<<<<<<<<< m] + le pipe length [m] + rr relative roughness [null] + k polytropic constant [null] + kth thermal exchange coefficient [J/m**2/K/s -> W/m**2/K] + extemp external temperature [K] +*/ + + +/* There are 2 integer parameters: + + gi gas type index + mode model +*/ + +void pnl0002in_(int *n, double rp[6], int ip[2], double c[8] + , int ic[1], double *tctr, double *pctr) + +{ + int loop, error; +/* >>>>>>>>>>>>Extra Initialization Function Declarations Here. */ +/* <<<<<<<<<<<>>>>>>>>>>>Initialization Function Check Statements. */ + + pn2_valid_gas_(&gi, &error); + + if (*pctr < -GPATMOS) + { + error = 2; + amefprintf(stderr, "\nInitial pressure at center of pipe should be > 0 [barA].\n"); + } + + if (*tctr <= 0.0) + { + error = 2; + amefprintf(stderr, "\nInitial temperature at center of pipe should be > 0 [K].\n"); + } + + if (diam <= 0.0) + { + error = 2; + amefprintf(stderr, "\nDiameter of pipe should be > 0 [mm].\n"); + } + + if (le <= 0.0) + { + error = 2; + amefprintf(stderr, "\nPipe length should be > 0 [m].\n"); + } + + if (rr < 0.0) + { + error = 2; + amefprintf(stderr, "\nRelative roughness should be >= 0.\n"); + } + + if (mode == 1) + { + if (k <= 0.) + { + error = 2; + amefprintf(stderr, "\nPolytropic constant should be > 0.\n"); + } + } + else + { + if (kth < 0.) + { + error = 2; + amefprintf(stderr, "\nThermal exchange coefficient should be >= 0 [J/m**2/K/s].\n"); + } + + if (extemp <= 0.) + { + error = 2; + amefprintf(stderr, "\nExternal temperature should be > 0 [K].\n"); + } + } + +/* <<<<<<<<<<< 99) + { + amefprintf(stderr, "\ngas type index must be in range [1..99].\n"); + error = 2; + } + if (mode < 1 || mode > 2) + { + amefprintf(stderr, "\nmodel must be in range [1..2].\n"); + error = 2; + } + + SUBMODEL_HANDLE_AND_RESET_ERROR(_SUBMODELNAME_, n, error) + +/* Common -> SI units conversions. */ + + rp[0] *= 1.00000000000000e-003; + diam = rp[0]; + + +/* >>>>>>>>>>>>Initialization Function Executable Statements. */ + + /* get atmospheric pressure */ + c[PATM] = pn2getatp_(); + + /* Compute the cross-sectional area of pipe. */ + c[AREA] = M_PI * (diam) * (diam) / 4.0; + + /* Compute volume of pipe. */ + c[VOL] = c[AREA] * le; + + /* Divide the restriction in 2 identical restrictions */ + c[HALFLE] = 0.5 * le; + + /* Compute exchange area of pipe. */ + c[AREAEX] = M_PI * diam * le; + +/* <<<<<<<<<<< W] basic variable output + 2 dm1 mass flow rate at port 1 [g/s -> kg/s] basic variable output + 3 t1 temperature at port 1 [K] basic variable input + 4 p1 pressure at port 1 [Pa] basic variable input + + Port 2 has 4 variables: + + 1 dh2 enthalpy flow rate at port 2 [J/s -> W] basic variable output + 2 dm2 mass flow rate at port 2 [g/s -> kg/s] basic variable output + 3 t2 temperature at port 2 [K] basic variable input + 4 p2 pressure at port 2 [Pa] basic variable input +*/ + +/* There are 7 internal variables. + + 1 tctr temperature at center of pipe [K] explicit state (derivative `dtctr') + 2 pctr pressure at center of pipe [Pa] explicit state (derivative `dpctr') + 3 mgas mass of gas in pipe [g -> kg] basic variable + 4 re mean Reynolds number [null] basic variable + 5 cm mean mass flow parameter [(kg*K/J)**(1/2)] basic variable + 6 v mean gas velocity [m/s] basic variable + 7 ff mean friction factor [null] basic variable +*/ + +void pnl0002_(int *n, double *dh1, double *dm1, double *t1, double *p1 + , double *dh2, double *dm2, double *t2, double *p2, double *tctr + , double *dtctr, double *pctr, double *dpctr, double *mgas + , double *re, double *cm, double *v, double *ff, double rp[6] + , int ip[2], double c[8], int ic[1]) + +{ + int loop; +/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */ + static double zero = 0.0; + double sdh; + double dh1i, dm1i; + double dh2i, dm2i; + double ff1, ff2, re1, re2, cm1, cm2; + double dq; + double pa1, pa2, pactr; + double v1, v2; + double dmgas; + double r; + int dummyreg; +/* <<<<<<<<<<<>>>>>>>>>>>Calculation Function Executable Statements. */ + + /* set absolute pressure */ + pa1 = *p1 + c[PATM]; + pa2 = *p2 + c[PATM]; + pactr = *pctr + c[PATM]; + + /* Compute flows through the pipe */ + pn2pipefr_(&pa1, t1, &pactr, tctr, &diam, &rr, &c[HALFLE], &c[AREA], &re1, &v1, &ff1, + dh1, dm1, &dh1i, &dm1i, &cm1, &c[TABFR], &gi, &ic[SPL_FR], &dummyreg); + + pn2pipefr_(&pactr, tctr, &pa2, t2, &diam, &rr, &c[HALFLE], &c[AREA], &re2, &v2, &ff2, + &dh2i, &dm2i, dh2, dm2, &cm2, &c[TABFR], &gi, &ic[SPL_FR], &dummyreg); + + /* Mean variables */ + *ff = 0.5 * (ff1 + ff2); + *re = 0.5 * (re1 + re2); + *cm = 0.5 * (cm1 + cm2); + *v = 0.5 * (fabs(v1) + fabs(v2)); + + /* Compute mass variation */ + dmgas = dm1i + dm2i; + + /* sum of enthalpy flows */ + sdh = dh1i + dh2i; + + /*** temperature & pressure variation ***/ + if (mode == 1) /* Polytropic model. */ + { + r = pn2ri_(&gi); + *mgas = (pactr) * c[VOL] / ((*tctr) * r); + + pn2vol1_(dtctr, dpctr, tctr, &pactr, + &dmgas, mgas, &zero, &c[VOL], &k, &gi); + } + else /* Heat exchange. */ + { + dq = kth * c[AREAEX] * (extemp-*tctr); + + pn2vol_(dtctr, dpctr, mgas, tctr, &pactr, + &dmgas, &sdh, &c[VOL], &zero, &dq, &gi); + } + +/* <<<<<<<<<<< Common units conversions. */ + + *dm1 /= 1.00000000000000e-003; + *dm2 /= 1.00000000000000e-003; + *mgas /= 1.00000000000000e-003; +} + diff --git a/AmesimModels/help/source/PNL0002.spe b/AmesimModels/help/source/PNL0002.spe new file mode 100644 index 0000000..8c89f59 --- /dev/null +++ b/AmesimModels/help/source/PNL0002.spe @@ -0,0 +1,275 @@ + + + + + + 0 + 24 + p2port + Compressibility + friction submodel of pneumatic pipe (R-C-R) + 0 + 8 + 1 + 1 + + + 16 + diameter of pipe + diam + True + 1.00000000000000e+01 + 1.00000000000000e+01 + 1.00000000000000e-003 + 1.00000000000000e+007 + mm + + + 17 + pipe length + le + True + 1.00000000000000e+00 + 1.00000000000000e+00 + 1.00000000000000e-006 + 1.00000000000000e+004 + m + + + 18 + relative roughness + rr + True + 1.00000000000000e-05 + 1.00000000000000e-05 + 0.00000000000000e+000 + 1.00000000000000e-001 + null + + + 19 + polytropic constant + k + (mode == 1) + 1.35000000000000e+00 + 1.35000000000000e+00 + 5.00000000000000e-001 + 2.00000000000000e+000 + null + + + 20 + thermal exchange coefficient + kth + (mode == 2) + 0.00000000000000e+00 + 0.00000000000000e+00 + 0.00000000000000e+000 + 1.00000000000000e+006 + J/m**2/K/s + + + 21 + external temperature + extemp + (mode == 2) + 2.93150000000000e+02 + 2.93150000000000e+02 + 1.00000000000000e+000 + 1.00000000000000e+003 + K + + + + + 22 + gas type index + gi + True + 1 + 1 + 1 + 99 + + + 23 + model + mode + True + 2 + 2 + 1 + 2 + + + polytropic + + + with thermal exchange + + + + + + + 9 + temperature at center of pipe + tctr + dtctr + True + 1 + 1 + K + 0.00000000000000e+000 + 1.00000000000000e+006 + 2.931500e+02 + 2.931500e+02 + + + 10 + pressure at center of pipe + pctr + dpctr + True + 1 + 1 + Pa + 0.00000000000000e+000 + 1.00000000000000e+006 + 1.013000e+00 + 1.013000e+00 + + + 24 + mass of gas in pipe + mgas + True + 0 + 1 + g + + + 12 + mean Reynolds number + re + True + 0 + 1 + null + + + 13 + mean mass flow parameter + cm + True + 0 + 1 + (kg*K/J)**(1/2) + + + 14 + mean gas velocity + v + True + 0 + 1 + m/s + + + 15 + mean friction factor + ff + True + 0 + 1 + null + + + + + + 1 + enthalpy flow rate at port 1 + dh1 + True + 0 + 1 + 2 + J/s + + + 2 + mass flow rate at port 1 + dm1 + True + 0 + 1 + 2 + g/s + + + 3 + temperature at port 1 + t1 + True + 0 + 1 + 1 + K + + + 4 + pressure at port 1 + p1 + True + 0 + 1 + 1 + Pa + + + + + 5 + enthalpy flow rate at port 2 + dh2 + True + 0 + 1 + 2 + J/s + + + 6 + mass flow rate at port 2 + dm2 + True + 0 + 1 + 2 + g/s + + + 7 + temperature at port 2 + t2 + True + 0 + 1 + 1 + K + + + 8 + pressure at port 2 + p2 + True + 0 + 1 + 1 + Pa + + + + 0 + + diff --git a/AmesimModels/help/source/PNL0003.c b/AmesimModels/help/source/PNL0003.c new file mode 100644 index 0000000..67c2eba --- /dev/null +++ b/AmesimModels/help/source/PNL0003.c @@ -0,0 +1,399 @@ +/* Submodel PNL0003 skeleton created by AME Submodel editing utility + mer. juin 20 14:17:28 2018 */ + + + +#include +#include +#include +#include "ameutils.h" +/* ******************************************************************************* +TITLE : PNL0003 (C-R-C) +------------------------------------------------------------------------------ +DESCRIPTION : + PNL0003 is a submodel of a pneumatic pipe with only compressibility + and friction effects taking into account heat exchange. + + The compressibility of the gas is taken into account by using a + simple polytropic model or a more complex one taking into account + heat exchange. + + The polytropic model is a simplified form of the general internal + energy model based on the first law of thermodynamics. The polytropic + approach is obtained by representing the thermal exchange phenomena + by a polytropic constant k. In that case, the temperature and + pressure are no more independent variables. + + The reduction of the complexity of the model implies a lack of + accuracy. For general studies, you'd better use the heat exchange + approach. + + Pipe friction is taken into account using a friction factor based on + the Reynolds number and the relative roughness. + + The temperature and pressure in each two volumes are state variables. +------------------------------------------------------------------------------ +USAGE : + Use this submodel to simulate a pneumatic pipe with compressibility + and friction effects, when the Mach number is low, ie gas velocity + < 0.3 * speed of sound . + + PNL0003 is basically similar to PNL0001 and PNL0002 differing only in the + input and output requirements. + + The submodels PNGD01 or PNGD02 should be included in your circuit to + define the characteristics of the gas. +------------------------------------------------------------------------------ +PARAMETER SETTINGS : +------------------------------------------------------------------------------ +DATE OF CREATION / AUTHOR : + 2002 FS from PNL03 SN. +------------------------------------------------------------------------------ +REVISIONS : +------------------------------------------------------------------------------ +LIST OF FUNCTIONS USED : + pn2getatp_() : get atmospheric pressure + pn2ri_() : get perfect gas constant + pn2vol1_() : polytropic model for chambers + pn2vol_() : heat exchange model for chambers + pn2pipefr_() : frictional coefficient in pneumatic pipes +------------------------------------------------------------------------------ +SOURCE : + + This material contains trade secrets or otherwise confidential + information owned by Siemens Industry Software Inc. or its + affiliates (collectively, "Siemens"), or its licensors. Access to + and use of this information is strictly limited as set forth in the + Customer's applicable agreements with Siemens. + + Unpublished work. Copyright 2023 Siemens + +******************************************************************************* */ + +#define _SUBMODELNAME_ "PNL0003" + +/* >>>>>>>>>>>>Insert Private Code Here. */ +#define TABFR 0 /* real store 0, 1 & 2 are used by pn2pipefr */ +#define PATM 3 +#define AREA 4 +#define HALFVOL 5 +#define HALFAREAEX 6 + + +#define SPL_FR 0 +/* <<<<<<<<<<< m] + le pipe length [m] + rr relative roughness [null] + k polytropic constant [null] + kth thermal exchange coefficient [J/m**2/K/s -> W/m**2/K] + extemp external temperature [K] +*/ + + +/* There are 2 integer parameters: + + gi gas type index + mode model +*/ + +void pnl0003in_(int *n, double rp[6], int ip[2], double c[7] + , int ic[1], double *t1, double *p1, double *t2, double *p2) + +{ + int loop, error; +/* >>>>>>>>>>>>Extra Initialization Function Declarations Here. */ + double vol, areaex; +/* <<<<<<<<<<<>>>>>>>>>>>Initialization Function Check Statements. */ + + pn2_valid_gas_(&gi, &error); + + if (*p1 < -GPATMOS) + { + error = 2; + amefprintf(stderr, "\nInitial pressure at port 1 should be > 0 [barA].\n"); + } + + if (*t1 <= 0.0) + { + error = 2; + amefprintf(stderr, "\nInitial temperature at port 1 should be > 0 [K].\n"); + } + + if (*p2 < -GPATMOS) + { + error = 2; + amefprintf(stderr, "\nInitial pressure at port 2 should be > 0 [barA].\n"); + } + + if (*t2 <= 0.0) + { + error = 2; + amefprintf(stderr, "\nInitial temperature at port 2 should be > 0 [K].\n"); + } + + if (diam <= 0.0) + { + error = 2; + amefprintf(stderr, "\nDiameter of pipe should be > 0 [mm].\n"); + } + + if (le <= 0.0) + { + error = 2; + amefprintf(stderr, "\nPipe length should be > 0 [m].\n"); + } + + if (rr < 0.0) + { + error = 2; + amefprintf(stderr, "\nRelative roughness should be >= 0.\n"); + } + + if (mode == 1) + { + if (k <= 0.) + { + error = 2; + amefprintf(stderr, "\nPolytropic constant should be > 0.\n"); + } + } + else + { + if (kth < 0.) + { + error = 2; + amefprintf(stderr, "\nThermal exchange coefficient should be >= 0 [J/m**2/K/s].\n"); + } + + if (extemp <= 0.) + { + error = 2; + amefprintf(stderr, "\nExternal temperature should be > 0 [K].\n"); + } + } + +/* <<<<<<<<<<< 99) + { + amefprintf(stderr, "\ngas type index must be in range [1..99].\n"); + error = 2; + } + if (mode < 1 || mode > 2) + { + amefprintf(stderr, "\nmodel must be in range [1..2].\n"); + error = 2; + } + + SUBMODEL_HANDLE_AND_RESET_ERROR(_SUBMODELNAME_, n, error) + +/* Common -> SI units conversions. */ + + rp[0] *= 1.00000000000000e-003; + diam = rp[0]; + + +/* >>>>>>>>>>>>Initialization Function Executable Statements. */ + /* set atmospheric pressure */ + c[PATM] = pn2getatp_(); + + /* Compute the cross-sectional area of pipe. */ + c[AREA] = M_PI * (diam) * (diam) / 4.0; + + /* Compute volume of pipe. */ + vol = c[AREA] * le; + + /* Divide the volume in 2 identical volumes */ + c[HALFVOL] = 0.5 * vol; + + /* Compute exchange area of pipe. */ + areaex = M_PI * diam * le; + + /* Divide the exchange area of pipe in 2 identical areas */ + c[HALFAREAEX] = 0.5 * areaex; + +/* <<<<<<<<<<< W] basic variable input + 4 dm1 mass flow rate at port 1 [g/s -> kg/s] basic variable input + + Port 2 has 4 variables: + + 1 t2 temperature at port 2 [K] explicit state (derivative `dt2') + 2 p2 pressure at port 2 [Pa] explicit state (derivative `dp2') + 3 dh2 enthalpy flow rate at port 2 [J/s -> W] basic variable input + 4 dm2 mass flow rate at port 2 [g/s -> kg/s] basic variable input +*/ + +/* There are 7 internal variables. + + 1 dhctr enthalpy flow at center of pipe [J/s -> W] basic variable + 2 dmctr mass flow at center of pipe [g/s -> kg/s] basic variable + 3 mgas mass of gas in pipe [g -> kg] basic variable + 4 re Reynolds number [null] basic variable + 5 cm mass flow parameter (cm) [(kg*K/J)**(1/2)] basic variable + 6 v mean gas velocity [m/s] basic variable + 7 ff friction factor [null] basic variable +*/ + +void pnl0003_(int *n, double *t1, double *dt1, double *p1, double *dp1 + , double *dh1, double *dm1, double *t2, double *dt2, double *p2 + , double *dp2, double *dh2, double *dm2, double *dhctr + , double *dmctr, double *mgas, double *re, double *cm, double *v + , double *ff, double rp[6], int ip[2], double c[7], int ic[1]) + +{ + int loop; +/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */ + static double zero = 0.0; + double dh1i, dm1i; + double dh2i, dm2i; + double sdh1, sdm1; + double sdh2, sdm2; + double m1, m2; + double dq1, dq2; + double pa1, pa2; + double dmgas; + double r; + int dummyreg; +/* <<<<<<<<<<< SI units conversions. */ + + *dm1 *= 1.00000000000000e-003; + *dm2 *= 1.00000000000000e-003; + +/* + Set all submodel outputs below: + + *dt1 = ??; + *dp1 = ??; + *dt2 = ??; + *dp2 = ??; + *dhctr = ??; + *dmctr = ??; + *mgas = ??; + *re = ??; + *cm = ??; + *v = ??; + *ff = ??; +*/ + + + +/* >>>>>>>>>>>>Calculation Function Executable Statements. */ + + /* set absolute pressures */ + pa1 = *p1 + c[PATM]; + pa2 = *p2 + c[PATM]; + + /* Compute flow through the pipe */ + pn2pipefr_(&pa1, t1, &pa2, t2, &diam, &rr, &le, &c[AREA], re, v, ff, + &dh1i, &dm1i, &dh2i, &dm2i, cm, &c[TABFR], &gi, &ic[SPL_FR], &dummyreg); + + /* Enthalpy flow and mass flow at center of pipe */ + *dhctr = dh1i; /* = -dh2i */ + *dmctr = dm1i; /* = -dm2i */ + + /* Compute the sum of the flows inside each volume */ + sdm1 = *dm1 + dm1i; + sdh1 = *dh1 + dh1i; + sdm2 = *dm2 + dm2i; + sdh2 = *dh2 + dh2i; + + dmgas = sdm1 + sdm2; + + /*** temperature & pressure variation ***/ + if (mode == 1) /* Polytropic model. */ + { + r = pn2ri_(&gi); + + /* Current mass in each volume */ + m1 = pa1 * c[HALFVOL] / (*t1 * r); + m2 = pa2 * c[HALFVOL] / (*t2 * r); + + pn2vol1_(dt1, dp1, t1, &pa1, + &sdm1, &m1, &zero, &c[HALFVOL], &k,&gi); + + pn2vol1_(dt2, dp2, t2, &pa2, + &sdm2, &m2, &zero, &c[HALFVOL], &k,&gi); + } + else /* Heat exchange. */ + { + dq1 = kth * c[HALFAREAEX] * (extemp - *t1); + + pn2vol_(dt1, dp1, &m1, t1, &pa1, + &sdm1, &sdh1, &c[HALFVOL], &zero, &dq1, &gi); + + dq2 = kth * c[HALFAREAEX] * (extemp - *t2); + + pn2vol_(dt2, dp2, &m2, t2, &pa2, + &sdm2, &sdh2, &c[HALFVOL], &zero, &dq2, &gi); + } + + *mgas = m1 + m2; + +/* <<<<<<<<<<< Common units conversions. */ + + *dm1 /= 1.00000000000000e-003; + *dm2 /= 1.00000000000000e-003; + *dmctr /= 1.00000000000000e-003; + *mgas /= 1.00000000000000e-003; +} + diff --git a/AmesimModels/help/source/PNL0003.spe b/AmesimModels/help/source/PNL0003.spe new file mode 100644 index 0000000..45b3ec6 --- /dev/null +++ b/AmesimModels/help/source/PNL0003.spe @@ -0,0 +1,285 @@ + + + + + + 0 + 24 + p2port + Compressibility + friction submodel of pneumatic pipe (C-R-C) + 0 + 7 + 1 + 1 + + + 16 + diameter of pipe + diam + True + 1.00000000000000e+01 + 1.00000000000000e+01 + 1.00000000000000e-003 + 1.00000000000000e+007 + mm + + + 17 + pipe length + le + True + 1.00000000000000e+00 + 1.00000000000000e+00 + 1.00000000000000e-006 + 1.00000000000000e+004 + m + + + 18 + relative roughness + rr + True + 1.00000000000000e-05 + 1.00000000000000e-05 + 0.00000000000000e+000 + 1.00000000000000e-001 + null + + + 19 + polytropic constant + k + (mode == 1) + 1.35000000000000e+00 + 1.35000000000000e+00 + 5.00000000000000e-001 + 2.00000000000000e+000 + null + + + 20 + thermal exchange coefficient + kth + (mode == 2) + 0.00000000000000e+00 + 0.00000000000000e+00 + 0.00000000000000e+000 + 1.00000000000000e+006 + J/m**2/K/s + + + 21 + external temperature + extemp + (mode == 2) + 2.93150000000000e+02 + 2.93150000000000e+02 + 1.00000000000000e+000 + 1.00000000000000e+003 + K + + + + + 22 + gas type index + gi + True + 1 + 1 + 1 + 99 + + + 23 + model + mode + True + 2 + 2 + 1 + 2 + + + polytropic + + + with thermal exchange + + + + + + + 9 + enthalpy flow at center of pipe + dhctr + True + 0 + 1 + J/s + + + 10 + mass flow at center of pipe + dmctr + True + 0 + 1 + g/s + + + 24 + mass of gas in pipe + mgas + True + 0 + 1 + g + + + 12 + Reynolds number + re + True + 0 + 1 + null + + + 13 + mass flow parameter (cm) + cm + True + 0 + 1 + (kg*K/J)**(1/2) + + + 14 + mean gas velocity + v + True + 0 + 1 + m/s + + + 15 + friction factor + ff + True + 0 + 1 + null + + + + + + 1 + temperature at port 1 + t1 + dt1 + True + 1 + 1 + 2 + K + 0.00000000000000e+000 + 1.00000000000000e+006 + 2.93150000000000e+002 + 2.93150000000000e+002 + + + 2 + pressure at port 1 + p1 + dp1 + True + 1 + 1 + 2 + Pa + -1.01300000000000e+005 + 1.00000000000000e+012 + 0.00000000000000e+000 + 0.00000000000000e+000 + + + 3 + enthalpy flow rate at port 1 + dh1 + True + 0 + 1 + 1 + J/s + + + 4 + mass flow rate at port 1 + dm1 + True + 0 + 1 + 1 + g/s + + + + + 5 + temperature at port 2 + t2 + dt2 + True + 1 + 1 + 2 + K + 0.00000000000000e+000 + 1.00000000000000e+004 + 2.93150000000000e+002 + 2.93150000000000e+002 + + + 6 + pressure at port 2 + p2 + dp2 + True + 1 + 1 + 2 + Pa + -1.01300000000000e+005 + 1.00000000000000e+012 + 0.00000000000000e+000 + 0.00000000000000e+000 + + + 7 + enthalpy flow rate at port 2 + dh2 + True + 0 + 1 + 1 + J/s + + + 8 + mass flow rate at port 2 + dm2 + True + 0 + 1 + 1 + g/s + + + + 0 + + diff --git a/AmesimModels/help/source/PNL00R.c b/AmesimModels/help/source/PNL00R.c new file mode 100644 index 0000000..8bd124c --- /dev/null +++ b/AmesimModels/help/source/PNL00R.c @@ -0,0 +1,224 @@ +/* Submodel PNL00R skeleton created by AME Submodel editing utility + ven. 5. août 14:34:41 2016 */ + + + +#include +#include +#include +#include "ameutils.h" +/* ******************************************************************************* +TITLE : PNL00R +------------------------------------------------------------------------------ +DESCRIPTION : + PNL00R is a submodel of a pneumatic pipe with only friction effects. + + Pipe friction is taken into account using a friction factor based on + the Reynolds number and the relative roughness. +------------------------------------------------------------------------------ +USAGE : + Use this submodel to simulate a pneumatic pipe with friction effects, + when the Mach number is low, ie gas velocity < 0.3 * speed of sound . + + The submodels PNGD001 or PNGD002 should be included in your circuit to + define the characteristics of the gas. +------------------------------------------------------------------------------ +PARAMETER SETTINGS : +------------------------------------------------------------------------------ +DATE OF CREATION / AUTHOR : + 2002 FS from PNL0R SN +------------------------------------------------------------------------------ +REVISIONS : +------------------------------------------------------------------------------ +LIST OF FUNCTIONS USED : + pn2pipefr_() : frictional coefficient in pneumatic pipes + pn2getatp_() : get atmospheric pressure +------------------------------------------------------------------------------ +SOURCE : + + This material contains trade secrets or otherwise confidential + information owned by Siemens Industry Software Inc. or its + affiliates (collectively, "Siemens"), or its licensors. Access to + and use of this information is strictly limited as set forth in the + Customer's applicable agreements with Siemens. + + Unpublished work. Copyright 2023 Siemens + +******************************************************************************* */ + +#define _SUBMODELNAME_ "PNL00R" + +/* >>>>>>>>>>>>Insert Private Code Here. */ +#define TABFR 0 /* real store 0, 1 & 2 are used by pn2pipefr */ +#define PATM 3 +#define AREA 4 + + +#define SPL_FR 0 +/* <<<<<<<<<<< m] + le pipe length [m] + rr relative roughness [null] +*/ + + +/* There is 1 integer parameter: + + gi gas type index +*/ + +void pnl00rin_(int *n, double rp[3], int ip[1], double c[5], int ic[1]) + +{ + int loop, error; +/* >>>>>>>>>>>>Extra Initialization Function Declarations Here. */ +/* <<<<<<<<<<<>>>>>>>>>>>Initialization Function Check Statements. */ + + pn2_valid_gas_(&gi, &error); + + if (diam <= 0.0) + { + error = 2; + amefprintf(stderr, "\nDiameter of pipe should be > 0 [mm].\n"); + } + + if (le <= 0.0) + { + error = 2; + amefprintf(stderr, "\nPipe length should be > 0 [m].\n"); + } + + if (rr < 0.0) + { + error = 2; + amefprintf(stderr, "\nRelative roughness should be >= 0.\n"); + } + +/* <<<<<<<<<<< 99) + { + amefprintf(stderr, "\ngas type index must be in range [1..99].\n"); + error = 2; + } + + SUBMODEL_HANDLE_AND_RESET_ERROR(_SUBMODELNAME_, n, error) + +/* Common -> SI units conversions. */ + + rp[0] *= 1.00000000000000e-003; + diam = rp[0]; + + +/* >>>>>>>>>>>>Initialization Function Executable Statements. */ + + c[PATM] = pn2getatp_(); + + /* Compute the cross-sectional area of pipe. */ + c[AREA] = M_PI * (diam) * (diam) / 4.0; + +/* <<<<<<<<<<< W] basic variable output + 2 dm2 mass flow rate at port 2 [g/s -> kg/s] basic variable output + 3 t2 temperature at port 2 [K] basic variable input + 4 p2 pressure at port 2 [Pa] basic variable input +*/ + +/* There are 4 internal variables. + + 1 re Reynolds number [null] basic variable + 2 cm mass flow parameter (cm) [(kg*K/J)**(1/2)] basic variable + 3 v mean gas velocity [m/s] basic variable + 4 ff friction factor [null] basic variable +*/ + +void pnl00r_(int *n, double *t1, double *p1, double *dh2, double *dm2 + , double *t2, double *p2, double *re, double *cm, double *v + , double *ff, double rp[3], int ip[1], double c[5], int ic[1]) + +{ + int loop; +/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */ + double pa1, pa2; + double dh1loc, dm1loc; + int dummyreg; +/* <<<<<<<<<<<>>>>>>>>>>>Calculation Function Executable Statements. */ + + /* set absolute pressure */ + pa1 = *p1 + c[PATM]; + pa2 = *p2 + c[PATM]; + + /* Compute flow through the pipe */ + + pn2pipefr_(&pa2, t2, &pa1, t1, &diam, &rr, &le, &c[AREA], re, v, ff, + dh2, dm2, &dh1loc, &dm1loc, cm, &c[TABFR], &gi, &ic[SPL_FR], &dummyreg); + +/* <<<<<<<<<<< Common units conversions. */ + + *dm2 /= 1.00000000000000e-003; +} + diff --git a/AmesimModels/help/source/PNL00R.spe b/AmesimModels/help/source/PNL00R.spe new file mode 100644 index 0000000..48d20b3 --- /dev/null +++ b/AmesimModels/help/source/PNL00R.spe @@ -0,0 +1,185 @@ + + + + + + 0 + 18 + p2port + Friction submodel of pneumatic pipe (R) + 0 + 5 + 1 + 1 + + + 13 + diameter of pipe + diam + True + 1.00000000000000e+01 + 1.00000000000000e+01 + 1.00000000000000e-003 + 1.00000000000000e+007 + mm + + + 14 + pipe length + le + True + 1.00000000000000e+00 + 1.00000000000000e+00 + 1.00000000000000e-006 + 1.00000000000000e+004 + m + + + 15 + relative roughness + rr + True + 1.00000000000000e-05 + 1.00000000000000e-05 + 0.00000000000000e+000 + 1.00000000000000e-001 + null + + + + + 16 + gas type index + gi + True + 1 + 1 + 1 + 99 + + + + + 9 + Reynolds number + re + True + 0 + 1 + null + + + 10 + mass flow parameter (cm) + cm + True + 0 + 1 + (kg*K/J)**(1/2) + + + 11 + mean gas velocity + v + True + 0 + 1 + m/s + + + 12 + friction factor + ff + True + 0 + 1 + null + + + + + + 17 + dh1 + True + 4 + 1 + 0 + 1 + + + 18 + dm1 + True + 4 + 1 + 1 + 1 + + + 3 + temperature at port 1 + t1 + True + 0 + 1 + 1 + K + + + 4 + pressure at port 1 + p1 + True + 0 + 1 + 1 + Pa + + + + + 5 + enthalpy flow rate at port 2 + dh2 + True + 0 + 1 + 2 + J/s + + + 6 + mass flow rate at port 2 + dm2 + True + 0 + 1 + 2 + g/s + + + 7 + temperature at port 2 + t2 + True + 0 + 1 + 1 + K + + + 8 + pressure at port 2 + p2 + True + 0 + 1 + 1 + Pa + + + + 0 + + diff --git a/AmesimModels/help/source/PNOR001.c b/AmesimModels/help/source/PNOR001.c new file mode 100644 index 0000000..6dd3859 --- /dev/null +++ b/AmesimModels/help/source/PNOR001.c @@ -0,0 +1,240 @@ +/* Submodel PNOR001 skeleton created by AME Submodel editing utility + lun. 10. juil. 17:22:57 2017 */ + + + +#include +#include +#include +#include "ameutils.h" +/* ******************************************************************************* +TITLE : PNOR001 +------------------------------------------------------------------------------ +DATE OF CREATION / AUTHOR : + 2002 : Created by FS from PNOR01 +------------------------------------------------------------------------------ +SOURCE : + + This material contains trade secrets or otherwise confidential + information owned by Siemens Industry Software Inc. or its + affiliates (collectively, "Siemens"), or its licensors. Access to + and use of this information is strictly limited as set forth in the + Customer's applicable agreements with Siemens. + + Unpublished work. Copyright 2023 Siemens + +******************************************************************************* */ + +#define _SUBMODELNAME_ "PNOR001" + +/* >>>>>>>>>>>>Insert Private Code Here. */ + +/* real stores */ +#define PATM 0 +#define AREA 1 +#define CQ 2 + +/* integer stores */ +#define DISC_ORIF 0 + +/* <<<<<<<<<<< m**2] + Cv flow coefficient (Cv) [null] + Kv flow coefficient (Kv) [null] +*/ + + +/* There are 2 integer parameters: + + gi gas type index + flowset flow coefficient setting +*/ + +void pnor001in_(int *n, double rp[4], int ip[2], double c[3] + , int ic[1]) + +{ + int loop, error; +/* >>>>>>>>>>>>Extra Initialization Function Declarations Here. */ +/* <<<<<<<<<<<>>>>>>>>>>>Initialization Function Check Statements. */ + + pn2_valid_gas_(&gi, &error); + + if (flowset == 1) + { + if (area < 0.0) + { + error = 2; + amefprintf(stderr, "\nOrifice area should be positive.\n"); + } + + if (cq <= 0.0) + { + error = 2; + amefprintf(stderr, "\nFlow coefficient should be strictly positive.\n"); + } + } + else if (flowset == 2) + { + if (Cv < 0.0) + { + error = 2; + amefprintf(stderr, "\nFlow coefficient (Cv) should be positive (value is %g).\n", Cv); + } + } + else + { + if (Kv < 0.0) + { + error = 2; + amefprintf(stderr, "\nFlow coefficient (Kv) should be positive (value is %g).\n", Kv); + } + } + +/* <<<<<<<<<<< 99) + { + amefprintf(stderr, "\ngas type index must be in range [1..99].\n"); + error = 2; + } + if (flowset < 1 || flowset > 3) + { + amefprintf(stderr, "\nflow coefficient setting must be in range [1..3].\n"); + error = 2; + } + + SUBMODEL_HANDLE_AND_RESET_ERROR(_SUBMODELNAME_, n, error) + +/* Common -> SI units conversions. */ + + rp[1] *= 1.00000000000000e-006; + area = rp[1]; + + +/* >>>>>>>>>>>>Initialization Function Executable Statements. */ + + /* get atmospheric pressure */ + c[PATM] = pn2getatp_(); + + if (flowset == 1) + { + c[CQ] = cq; + c[AREA] = area; + } + else + { + /* calculation of equivalent area with Cv or Kv. + Default value of cq; the same value will be used in pn2rcqfix. */ + c[CQ] = 0.72; + + if (flowset == 2) /* Cv */ + orif_areafromcv_(&Cv, &c[CQ], &c[AREA]); + else + orif_areafromkv_(&Kv, &c[CQ], &c[AREA]); + } + +/* <<<<<<<<<<< W] basic variable output + 2 dm1 mass flow rate at port 1 [g/s -> kg/s] basic variable output + 3 temp1 temperature at port 1 [K] basic variable input + 4 press1 pressure at port 1 [Pa] basic variable input + + Port 2 has 4 variables: + + 1 dh2 duplicate of dh1 (sign reversed) + 2 dm2 duplicate of dm1 (sign reversed) + 3 temp2 temperature at port 2 [K] basic variable input + 4 press2 pressure at port 2 [Pa] basic variable input +*/ + +/* There are 2 internal variables. + + 1 cm mass flow parameter (cm) [(kg*K/J)**(1/2)] basic variable + 2 gasvel vena contracta gas velocity [m/s] basic variable +*/ + +void pnor001_(int *n, double *dh1, double *dm1, double *temp1 + , double *press1, double *temp2, double *press2, double *cm + , double *gasvel, double rp[4], int ip[2], double c[3] + , int ic[1]) + +{ + int loop; +/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */ + double pressa1, pressa2; +/* <<<<<<<<<<<>>>>>>>>>>>Calculation Function Executable Statements. */ + + /* set absolute pressures */ + pressa1 = *press1 + c[PATM]; + pressa2 = *press2 + c[PATM]; + + /* calculation of the flows */ + pn2rcqfix_( dh1, dm1, temp1, &pressa1, temp2, &pressa2, &c[AREA], &c[CQ], &gi, + cm, gasvel, &ic[DISC_ORIF]); + +/* <<<<<<<<<<< Common units conversions. */ + + *dm1 /= 1.00000000000000e-003; +} + diff --git a/AmesimModels/help/source/PNOR001.spe b/AmesimModels/help/source/PNOR001.spe new file mode 100644 index 0000000..fc8d153 --- /dev/null +++ b/AmesimModels/help/source/PNOR001.spe @@ -0,0 +1,199 @@ + + + + + + 0 + 18 + pn_orifice + pneumatic orifice (constant flow coefficient) + 0 + 3 + 1 + 1 + + + 12 + flow coefficient (Cq) + cq + flowset==1 + 7.20000000000000e-01 + 7.20000000000000e-01 + 1.00000000000000e-010 + 1.00000000000000e+000 + null + + + 11 + orifice area + area + flowset==1 + 5.00000000000000e+00 + 5.00000000000000e+00 + 0.00000000000000e+000 + 1.00000000000000e+006 + mm**2 + + + 17 + flow coefficient (Cv) + Cv + flowset==2 + 5.00000000000000e-01 + 5.00000000000000e-01 + 0.00000000000000e+000 + 1.00000000000000e+030 + null + + + 18 + flow coefficient (Kv) + Kv + flowset==3 + 4.00000000000000e-01 + 4.00000000000000e-01 + 0.00000000000000e+000 + 1.00000000000000e+030 + null + + + + + 13 + gas type index + gi + True + 1 + 1 + 1 + 99 + + + 14 + flow coefficient setting + flowset + True + 1 + 1 + 1 + 3 + + + Cq + + + Cv + + + Kv + + + + + + + 9 + mass flow parameter (cm) + cm + True + 0 + 1 + (kg*K/J)**(1/2) + + + 10 + vena contracta gas velocity + gasvel + True + 0 + 1 + m/s + + + + + + 1 + enthalpy flow rate at port 1 + dh1 + True + 0 + 1 + 2 + J/s + + + 2 + mass flow rate at port 1 + dm1 + True + 0 + 1 + 2 + g/s + + + 3 + temperature at port 1 + temp1 + True + 0 + 1 + 1 + K + + + 4 + pressure at port 1 + press1 + True + 0 + 1 + 1 + Pa + + + + + 5 + dh2 + True + 4 + 0 + 0 + 1 + + + 6 + dm2 + True + 4 + 0 + 1 + 1 + + + 7 + temperature at port 2 + temp2 + True + 0 + 1 + 1 + K + + + 8 + pressure at port 2 + press2 + True + 0 + 1 + 1 + Pa + + + + 0 + + diff --git a/AmesimModels/help/source/PNVO001.c b/AmesimModels/help/source/PNVO001.c new file mode 100644 index 0000000..1316872 --- /dev/null +++ b/AmesimModels/help/source/PNVO001.c @@ -0,0 +1,254 @@ +/* Submodel PNVO001 skeleton created by AME Submodel editing utility + ven. 6. oct. 11:10:58 2017 */ + + + +#include +#include +#include +#include "ameutils.h" +/* ******************************************************************************* +TITLE : PNVO001 +------------------------------------------------------------------------------ +DATE OF CREATION / AUTHOR : + 2002 : Created by FS from PNVO01 +------------------------------------------------------------------------------ +SOURCE : + + This material contains trade secrets or otherwise confidential + information owned by Siemens Industry Software Inc. or its + affiliates (collectively, "Siemens"), or its licensors. Access to + and use of this information is strictly limited as set forth in the + Customer's applicable agreements with Siemens. + + Unpublished work. Copyright 2023 Siemens + +******************************************************************************* */ + +#define _SUBMODELNAME_ "PNVO001" + +/* >>>>>>>>>>>>Insert Private Code Here. */ + +/* real stores */ +#define PATM 0 +#define AREAMAX 1 +#define CQ 2 + +/* integer stores */ +#define DISC_LIMIT 0 +#define DISC_ORIF 1 + +/* <<<<<<<<<<< m**2] + Cv maximum flow coefficient (Cv) [null] + Kv maximum flow coefficient (Kv) [null] +*/ + + +/* There are 2 integer parameters: + + gi gas type index + flowset flow coefficient setting +*/ + +void pnvo001in_(int *n, double rp[4], int ip[2], double c[3] + , int ic[2]) + +{ + int loop, error; +/* >>>>>>>>>>>>Extra Initialization Function Declarations Here. */ +/* <<<<<<<<<<<>>>>>>>>>>>Initialization Function Check Statements. */ + + pn2_valid_gas_(&gi, &error); + + if (flowset == 1) + { + if (area0 < 0.0) + { + error = 2; + amefprintf(stderr, "\nOrifice area at maximum opening should be positive.\n"); + } + + if (cq <= 0.0 ) + { + error = 2; + amefprintf(stderr, "\nFlow coefficient should be strictly positive.\n"); + } + } + else if (flowset == 2) + { + if (Cv < 0.0) + { + error = 2; + amefprintf(stderr, "\nMaximum flow coefficient (Cv) should be positive (value is %g).\n", Cv); + } + } + else + { + if (Kv < 0.0) + { + error = 2; + amefprintf(stderr, "\nMaximum flow coefficient (Kv) should be positive (value is %g).\n", Kv); + } + } + +/* <<<<<<<<<<< 99) + { + amefprintf(stderr, "\ngas type index must be in range [1..99].\n"); + error = 2; + } + if (flowset < 1 || flowset > 3) + { + amefprintf(stderr, "\nflow coefficient setting must be in range [1..3].\n"); + error = 2; + } + + SUBMODEL_HANDLE_AND_RESET_ERROR(_SUBMODELNAME_, n, error) + +/* Common -> SI units conversions. */ + + rp[1] *= 1.00000000000000e-006; + area0 = rp[1]; + + +/* >>>>>>>>>>>>Initialization Function Executable Statements. */ + + /* get atmospheric pressure */ + c[PATM] = pn2getatp_(); + + if (flowset == 1) + { + c[CQ] = cq; + c[AREAMAX] = area0; + } + else + { + /* calculation of equivalent maximal area with Cv or Kv. + Default value of cq; the same value will be used in pn2rcqfix. */ + c[CQ] = 0.72; + + if (flowset == 2) /* Cv */ + orif_areafromcv_(&Cv, &c[CQ], &c[AREAMAX]); + else + orif_areafromkv_(&Kv, &c[CQ], &c[AREAMAX]); + } + +/* <<<<<<<<<<< W] basic variable output + 2 dm2 mass flow rate at port 2 [g/s -> kg/s] basic variable output + 3 temp2 temperature at port 2 [K] basic variable input + 4 press2 pressure at port 2 [Pa] basic variable input + + Port 3 has 4 variables: + + 1 dh3 duplicate of dh2 (sign reversed) + 2 dm3 duplicate of dm2 (sign reversed) + 3 temp3 temperature at port 3 [K] basic variable input + 4 press3 pressure at port 3 [Pa] basic variable input +*/ + +/* There are 3 internal variables. + + 1 xv fractional opening [null] basic variable + 2 cm mass flow parameter (cm) [(kg*K/J)**(1/2)] basic variable + 3 gasvel vena contracta gas velocity [m/s] basic variable +*/ + +void pnvo001_(int *n, double *res, double *dh2, double *dm2 + , double *temp2, double *press2, double *temp3, double *press3 + , double *xv, double *cm, double *gasvel, double rp[4] + , int ip[2], double c[3], int ic[2]) + +{ + int loop; +/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */ + double marea; /* modulated area */ + double pressa2, pressa3; + static double zero = 0.0, one = 1.0; +/* <<<<<<<<<<<>>>>>>>>>>>Calculation Function Executable Statements. */ + + /* set absolute pressure */ + pressa2 = *press2 + c[PATM]; + pressa3 = *press3 + c[PATM]; + + *xv = dlimit_(res, &zero, &one, &ic[DISC_LIMIT]); + + /* limitation of the modulated area */ + marea = *xv * c[AREAMAX]; + + /*** calculation of the flows ***/ + pn2rcqfix_( dh2, dm2, temp2, &pressa2, temp3, &pressa3, &marea, &c[CQ], &gi, + cm, gasvel, &ic[DISC_ORIF] ); + +/* <<<<<<<<<<< Common units conversions. */ + + *dm2 /= 1.00000000000000e-003; +} + diff --git a/AmesimModels/help/source/PNVO001.spe b/AmesimModels/help/source/PNVO001.spe new file mode 100644 index 0000000..d81a91c --- /dev/null +++ b/AmesimModels/help/source/PNVO001.spe @@ -0,0 +1,220 @@ + + + + + + 0 + 20 + pn_morifice + modulated pneumatic orifice (constant flow coefficient) + 0 + 3 + 2 + 1 + + + 12 + flow coefficient (Cq) + cq + flowset==1 + 7.20000000000000e-01 + 7.20000000000000e-01 + 1.00000000000000e-010 + 1.00000000000000e+000 + null + + + 13 + orifice area at maximum opening + area0 + flowset==1 + 5.00000000000000e+00 + 5.00000000000000e+00 + 0.00000000000000e+000 + 1.00000000000000e+006 + mm**2 + + + 18 + maximum flow coefficient (Cv) + Cv + flowset==2 + 5.00000000000000e-01 + 5.00000000000000e-01 + 0.00000000000000e+000 + 1.00000000000000e+030 + null + + + 19 + maximum flow coefficient (Kv) + Kv + flowset==3 + 4.00000000000000e-01 + 4.00000000000000e-01 + 0.00000000000000e+000 + 1.00000000000000e+030 + null + + + + + 14 + gas type index + gi + True + 1 + 1 + 1 + 99 + + + 15 + flow coefficient setting + flowset + True + 1 + 1 + 1 + 3 + + + Cq + + + Cv + + + Kv + + + + + + + 20 + fractional opening + xv + True + 0 + 1 + null + + + 10 + mass flow parameter (cm) + cm + True + 0 + 1 + (kg*K/J)**(1/2) + + + 11 + vena contracta gas velocity + gasvel + True + 0 + 1 + m/s + + + + + + 1 + input signal + res + True + 0 + 1 + 1 + null + + + + + 2 + enthalpy flow rate at port 2 + dh2 + True + 0 + 1 + 2 + J/s + + + 3 + mass flow rate at port 2 + dm2 + True + 0 + 1 + 2 + g/s + + + 4 + temperature at port 2 + temp2 + True + 0 + 1 + 1 + K + + + 5 + pressure at port 2 + press2 + True + 0 + 1 + 1 + Pa + + + + + 6 + dh3 + True + 4 + 1 + 0 + 1 + + + 7 + dm3 + True + 4 + 1 + 1 + 1 + + + 8 + temperature at port 3 + temp3 + True + 0 + 1 + 1 + K + + + 9 + pressure at port 3 + press3 + True + 0 + 1 + 1 + Pa + + + + 0 + + diff --git a/AmesimModels/help/source/pn_public.h b/AmesimModels/help/source/pn_public.h new file mode 100644 index 0000000..15feacf --- /dev/null +++ b/AmesimModels/help/source/pn_public.h @@ -0,0 +1,1439 @@ +/****************************************************************************** +* This material contains trade secrets or otherwise confidential +* information owned by Siemens Industry Software Inc. or its +* affiliates (collectively, "Siemens"), or its licensors. Access to +* and use of this information is strictly limited as set forth in the +* Customer's applicable agreements with Siemens. +* +* Unpublished work. Copyright 2023 Siemens +******************************************************************************/ + +#ifndef PN_PUBLIC_H +#define PN_PUBLIC_H + +/**************************************************************************/ +/* */ +/* Generic Macros for the PNEUMATIC LIBRARY */ +/* */ +/**************************************************************************/ + +#define PN_SUBMODEL_WARNING(submodelInstance) \ + amefprintf(stderr, "\nWarning in %s instance %d.\n", _SUBMODELNAME_, *submodelInstance); + +#define PN_SUBMODEL_ERROR(submodelInstance) \ + amefprintf(stderr, "\nFatal error in %s instance %d.\n", _SUBMODELNAME_, *submodelInstance); \ + amefprintf(stderr, "Terminating the program.\n"); \ + AmeExit(1); + + /* Stores structures name */ +#define PN_STORESDEF2(x, y) x ## y +#define PN_STORESDEF(x, y) PN_STORESDEF2(x, y) +#define PN_SUBMODEL_IC_DEF PN_STORESDEF(PNSUBMODEL, _IC_DEF_) +#define PN_SUBMODEL_C_DEF PN_STORESDEF(PNSUBMODEL, _C_DEF_ ) +#define PN_SUBMODEL_PS_DEF PN_STORESDEF(PNSUBMODEL, _PS_DEF_) + +#define PN_NAMECHECK2(submodel, submodelname) \ + if (strcmp(submodelname, #submodel) != 0)\ + {\ + amefprintf(stderr, "\nPlease update \"PNSUBMODEL\" variable in %s code.\n", __FILE__);\ + PN_SUBMODEL_WARNING(n);\ + } +#define PN_NAMECHECK(submodel, submodelname) PN_NAMECHECK2(submodel, submodelname) + +/**************************************************************************/ +/* */ +/* Prototypes for the PNEUMATIC LIBRARY */ +/* */ +/**************************************************************************/ + +extern void pn2vol2_ +( + double *dtemp, + double *dpress, + double *temp, + double *press, + double *sdm, + double *mgas, + double *sdh, + double *vvolt, + double *volt, + double *kth, + double *sth, + double *extemp, + int *gi +); + + +/**************************************************************************/ +/* */ +/* Prototypes for the NEW PNEUMATIC LIBRARY */ +/* */ +/**************************************************************************/ + +/**************************** pn2atmos.c ******************************/ + +extern void pn2setatp_ +( + double *patmos +); + +extern double pn2getatp_(); + +/**************************** pn2lambda.c ******************************/ + +extern int pn2setlambda_ +( + double *lbda +); + +/**************************** pn2gasprops.c **************************/ + +extern void pn2CreateMixtureProp3_ +( + double *YiSpecies, + int *giSpecies, + int *nspec, + int *gi, + char *submodelName, + int *submodelInstance +); + +extern int pn2_valid_gas_(int *index, int *error); + +extern void pn2checkpt_ +( + double *p, + double *temp, + int *index +); + +extern double pn2cmpti_ +( + double *pr, + double *p, + double *temp, + int *index +); + +extern double pn2cppti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2cvpti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2gpti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2gspti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2hpti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2spti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2lampti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2mupti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2nupti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2pcpti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2rhopti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2cspti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2zpti_ +( + double *p, + double *temp, + int *index +); + +extern double pn2ri_ +( + int *index +); + +/*! pn2IsEosPerfect_: returns 1 if gas EoS is perfect. 0 otherwise */ +extern int pn2IsEosPerfect_ +( + int *index +); + +/**************************** pn2geta1b1.c **************************/ + +extern double pn2geta1b1_ +( + double *delta, + double *rc, + double *hdia, + double *A1, + double *B1 +); + +/**************************** pn2orif_zeta.c **************************/ + +extern void pn2orif_zeta_ +( + double *pa1, + double *t1, + double *pa2, + double *t2, + double *area, + double *diam, + int *n12, + int *n21, + double *dm1, + double *dmh1, + double *re, + double *v, + double *ff, + int *gi, + int *reg +); + +extern void pn2handledisc_ +( + double *p1, + double *p2, + int *handle_disc, + int *use_hyst, + double *hyst, + int *reg +); + +/**************************** pn2pipes.c **************************/ + +extern void pn2pipefr_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *diam, + double *rr, + double *l, + double *area, + double *re, + double *v, + double *ff, + double *dh1, + double *dm1, + double *dh2, + double *dm2, + double *cm, + double *c, + int *gi, + int *reg1, + int *reg2 +); + +extern void pn2pipifr_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *dm1, + double *diam, + double *rr, + double *l, + double *area, + double *re, + double *v, + double *ff, + double *dm1dot, + double *dh1, + double *c, + int *reg, + int *gi +); + +extern void pn2pipefrber_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *diam, + double *rr, + double *l, + double *area, + double *v, + double *re, + double *ff, + double *dh1, + double *dm1, + double *dh2, + double *dm2, + double *c, + int *gi, + int *reg +); + + +/**************************** pn2rcqfix.c **************************/ + +extern void pn2rcqfix_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *temp2, + double *press2, + double *area, + double *cq, + int *gi, + double *cm, + double *gasvel, + int *reg +); + + +/**************************** pn2rcqnor.c **************************/ + +extern void pn2rcqnor_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *temp2, + double *press2, + double *b, + double *c, + int *gi, + double *cm, + double *gasvel, + int *reg +); + + +/**************************** pn2rcqper.c **************************/ + +extern void pn2rcqper_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *temp2, + double *press2, + double *area, + double *cq, + int *gi, + double *cm, + double *gasvel, + int *reg +); + + +/**************************** pn2rtabprops.c **************************/ + +extern int pn2readeos_ +( + char *fileName, + double **eosValues +); + +extern int pn2readcphs_ +( + char *fileName, + double **cphsValues +); + +extern int pn2readmu_ +( + char *fileName, + double **muValues +); + +extern int pn2readlambda_ +( + char *fileName, + double **lambdaValues +); + + +/**************************** pn2init.c **************************/ +#define _PNGD00_RP_NUMBER_ 8 +#define _PNGD00_IP_NUMBER_ 4 +#define _PNGD00_TP_NUMBER_ 5 +#define _PNGD00_C_NUMBER_ 0 +#define _PNGD00_IC_NUMBER_ 1 +int preinit_pngd00_ +( + int *n, + double *rp, + int *ip, + char *tp[5], + double *c, + int *ic +); + + +/**************************** pnturb.c **************************/ + +extern double pnturbdmctable_ +( + int *index, double *ratio, double *Nc, double *ratiolimit, int *disc +); + +extern double pnturbpower_ +( + double *pressup, double *tempup, double *dhturbin, double *dhturbout, + double *dmturb, double *ratio, double *eff, int *gi +); + +extern double pnTurbineBackflowPower_( + double *pressDownBf, + double *tempDownBf, + double *pressUpBf, + double *tempUpBf, + double *BFarea, + double *cqbf, + int *gi, + double *dhTurbOut, + double *dhTurbIn, + double *dmc, + double *eff, + double *dmTurb, + int *reg1 +); + +extern double pnTurbineTorque_ +( + double *w, double *Pmec +); + +/**************************** pn2vol1.c **************************/ + +extern void pn2vol1_ +( + double *dtemp, + double *dpress, + double *temp, + double *press, + double *sdm, + double *mgas, + double *vvolt, + double *volt, + double *k, + int *gi +); + + +/**************************** pn2vol2.c **************************/ + +extern void pn2vol2_ +( + double *dtemp, + double *dpress, + double *temp, + double *press, + double *sdm, + double *mgas, + double *sdh, + double *vvolt, + double *volt, + double *kth, + double *sth, + double *extemp, + int *gi +); + + +/**************************** pn2vol.c **************************/ + +extern void pn2vol_ +( + double *dtemp, + double *dpress, + double *mgas, + double *temp, + double *press, + double *sdm, + double *sdh, + double *volt, + double *dvol, + double *dq, + int *gi +); + + +/************************** pnvalvearea.c ****************************/ + +/*! pnbuttvalvearea_: computes the cross-sectional area of a butterfly valve */ +extern void pnbuttvalvearea_ +( + double *phi, + double *d, + double *D, + double *area +); + +/*! pngatevalvearea_: computes the cross-sectional area of a gate valve */ +extern void pngatevalvearea_ +( + double *x, + double *d, + double *D, + double *area +); + + +/**************************************************************************/ +/* */ +/* Prototypes for the THERMAL-PNEUMATIC LIBRARY */ +/* */ +/**************************************************************************/ + +/**************************** tpzconv.c **************************/ + +extern double tpzconv_ +( + double *le, + double *diam, + double *alpha +); + +/**************************** tpzdiff.c **************************/ + +extern double tpzdiff_ +( + double *area1, + double *area2, + double *alpha +); + +/** Special heat exchanges **/ +extern void pn_Nu_extconv_free_plate_ +( + double *Pr, + double *Ra, + double *beta, + double *tFluid, + double *tPlate, + double *cdim_factor, + double *Nu +); + +extern void pn_Nu_extconv_forced_plate_ +( + double *Pr, + double *Re, + double *Nu +); + +extern void pn_Nu_extconv_free_cyl_ +( + double *Pr, + double *Ra, + double *Nu +); + +extern void pn_Nu_extconv_forced_cyl_ +( + double *Pr, + double *Re, + double *Nu +); + + +/* Obsolete utilities */ +extern double pngeta1b1_ +( + double *delta, double *rc, double *hdia, + double *A1, double *B1 +); + +extern double pngetcm_ +( + double *pr +); + +extern double pngetcp_(); + +extern double pngetcv_(); + +extern double pngetg_(); + +extern double pngetlcm_ +( + double *lambda, + double *pr +); + +extern double pngetmu_(); + +extern double pngetpc_(); + +extern double pngetr_(); + +extern double pngetrho_ +( + double *p, + double *temp +); + +extern double pnjetforc_ +( + double *dm, + double *v, + double *teta +); + +extern double pnsmooth_ +( + double *f1, + double *f2, + double *x, + double *x1, + double *x2 +); + +extern void pnchkgas_(); + +extern void pnpipefr_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *diam, + double *rr, + double *l, + double *area, + double *re, + double *v, + double *ff, + double *dh1, + double *dm1, + double *dh2, + double *dm2, + double *c, + int *reg +); + +extern void pnpipifr_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *dm1, + double *diam, + double *rr, + double *l, + double *area, + double *re, + double *v, + double *ff, + double *dm1dot, + double *dh1, + double *dh2, + double *c, + int *reg +); + +extern void pnrcqfix2_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *dh2, + double *dm2, + double *temp2, + double *press2, + double *area, + double *cq, + double *cm, + double *gasvel, + int *reg1, + int *reg2 +); + +extern void pnrcqfix_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *dh2, + double *dm2, + double *temp2, + double *press2, + double *area, + double *cq, + double *cm, + int *reg1, + int *reg2 +); + +extern void pnrcqnor2_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *dh2, + double *dm2, + double *temp2, + double *press2, + double *b, + double *c, + double *cm, + double *gasvel, + int *reg1, + int *reg2 +); + +extern void pnrcqnor_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *dh2, + double *dm2, + double *temp2, + double *press2, + double *b, + double *c, + double *cm, + int *reg1, + int *reg2 +); + +extern void pnrcqper2_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *dh2, + double *dm2, + double *temp2, + double *press2, + double *area, + double *cq, + double *cm, + double *gasvel, + int *reg1, + int *reg2 +); + +extern void pnrcqper_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *dh2, + double *dm2, + double *temp2, + double *press2, + double *area, + double *cq, + double *cm, + int *reg1, + int *reg2 +); + +extern void pnsetcpv2_ +( + double *cp, + double *cv, + double *mu +); + +extern void pnsetcpv_ +( + double *cp, + double *cv +); + +extern void pnsetgas2_ +( + double *cp, + double *cv, + double *g, + double *r, + double *mu +); + +extern void pnsetgas_ +( + double *cp, + double *cv, + double *g, + double *r +); + +extern void pnvol_ +( + double *dtemp, + double *dpress, + double *temp, + double *press, + double *sdm, + double *mgas, + double *sdh, + double *vvolt, + double *volt, + double *k, + double *kth, + double *sth, + double *extemp, + int *mode +); + +extern void pnvol1_ +( + double *dtemp, + double *dpress, + double *temp, + double *press, + double *sdm, + double *mgas, + double *vvolt, + double *volt, + double *k +); + +extern void pnvol2_ +( + double *dtemp, + double *dpress, + double *temp, + double *press, + double *sdm, + double *mgas, + double *sdh, + double *vvolt, + double *volt, + double *kth, + double *sth, + double *extemp +); + +extern void pn2CreateMixtureProp_ +( + double *lrp, + int *lip +); + +extern void pn2CreateMixtureProp2_ +( + double *YiSpecies, + int *giSpecies, + double *pRefA, + int *nspec, + int *gi +); + +extern void pn2CreateGasProp_ +( + int index +); + +extern void pn2RegisterPerfectGasProp_ +( + double cp, + double cv, + double mu, + double lam, + int index +); + +extern void pn2RegisterRealGasProp_ +( + char *tp0, double *rp1, double *rp2, + double *rp3, int *eosind, int *index +); + +extern void pn2RegisterGenericGasProp_ +( +#ifndef _NO_PROTO + double *eosValues, + double *cphsValues, + double *muValues, + double *lambdaValues, + char *gasName, + int *index, + char *submodelName, + int *submodelInstance +#endif +); + +extern void pn2RegisterGasProp_ +( + double *rp, + char *tp, + int index +); + +extern int pn2SetGasAsPerfectAt_( + double *pressA, + double *tempK, + int *index +); + +extern void pn2checkgas_(int *index); + +extern double pn2orift_ +( + double *pa, + double *ta, + double *pb, + double *tb, + double *area, + double *hdia, + double *coefab, + double *coefba, + double *lamcab, + double *lamcba, + int *fi, + int *ic +); + +extern int pn2rtabprops_ +( + char *name, + double *xvalues, + int *num +); + +extern double pnturbbfpower_ +( + double *pressup, double *tempup, double *pressdown, double *tempdown, + double *dhturbin, double *dhturbout, double *dmc, double *eff, double *dmturb, + double *BFarea, double *cqbf, int *gi, int *reg1 +); + + +extern double pnturbtorque_ +( + double *w, double *Pmec +); + +extern void pn2seteosuserd_(int index); + +extern void tp2setatp_ +( + double *patmos +); + +extern double tp2getatp_(); + +extern void tp2setlambda_ +( + double *lbda +); + +extern void tp2RegisterPerfectGasProp_ +( + double cp, + double cv, + double mu, + double lam, + int index +); + +extern void tp2RegisterRealGasProp_ +( + char *tp0, double *rp1, double *rp2, + double *rp3, int *eosind, int *index +); + +extern void tp3RegisterPerfectGasProp_ +( + double cp, + double cv, + double mu, + double lam, + double tmin, + double tmax, + int index +); + +extern void RegisterTpGasProp_ +( + double *rp, + char *tp, + int index +); + +extern void tp2CreateMixtureProp_ +( + double *lrp, + int *lip +); + +extern void tpcheckgas_ +( + int *index +); + +extern void tpcheckpt_ +( + double *p, + double *temp, + int *index +); + +extern double tpcmpti_ +( + double *pr, + double *p, + double *temp, + int *index +); + +extern double tpcppti_ +( + double *p, + double *temp, + int *index +); + +extern double tpcvpti_ +( + double *p, + double *temp, + int *index +); + +extern double tpgpti_ +( + double *p, + double *temp, + int *index +); + +extern double tpgspti_ +( + double *p, + double *temp, + int *index +); + +extern double tphpti_ +( + double *p, + double *temp, + int *index +); + +extern double tplampti_ +( + double *p, + double *temp, + int *index +); + +extern double tpalphapti_ +( + double *p, + double *temp, + int *index +); + +extern double tpcspti_ +( + double *p, + double *temp, + int *index +); + +extern double tpmupti_ +( + double *p, + double *temp, + int *index +); + +extern double tpnupti_ +( + double *p, + double *temp, + int *index +); + +extern double tppcpti_ +( + double *p, + double *temp, + int *index +); + +extern double tprhopti_ +( + double *p, + double *temp, + int *index +); + +extern double tpri_ +( + int *index +); + +extern void tpsetuserd_ +( + int index +); + +extern double tpzpti_ +( + double *p, + double *temp, + int *index +); + +extern double tpgeta1b1_ +( + double *delta, + double *rc, + double *hdia, + double *A1, + double *B1 +); + +extern double tporift_ +( + double *pa, + double *ta, + double *pb, + double *tb, + double *area, + double *hdia, + double *coefab, + double *coefba, + double *lamcab, + double *lamcba, + int *fi, + int *ic +); + +extern void tp2pipefr_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *diam, + double *rr, + double *l, + double *area, + double *re, + double *v, + double *ff, + double *dh1, + double *dm1, + double *dh2, + double *dm2, + double *cm, + double *c, + int *gi, + int *reg1, + int *reg2 +); + +extern void tp2pipifr_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *dm1, + double *diam, + double *rr, + double *l, + double *area, + double *re, + double *v, + double *ff, + double *dm1dot, + double *dh1, + double *c, + int *reg, + int *gi +); + +extern void tp2pipefrber_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *diam, + double *rr, + double *l, + double *area, + double *v, + double *re, + double *ff, + double *dh1, + double *dm1, + double *dh2, + double *dm2, + double *c, + int *gi, + int *reg +); + +extern void tp2rcqfix_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *temp2, + double *press2, + double *area, + double *cqmax, + int *gi, + double *cm, + double *gasvel, + int *reg +); + +extern void tp2rcqnor_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *temp2, + double *press2, + double *b, + double *c, + int *gi, + double *cm, + double *gasvel, + int *reg +); + + +extern void tp2rcqper_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *temp2, + double *press2, + double *area, + double *cq, + int *gi, + double *cm, + double *gasvel, + int *reg +); + +extern void tppipefr_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *diam, + double *rr, + double *l, + double *area, + double *re, + double *ff, + double *dh1, + double *dm1, + double *dh2, + double *dm2, + double *cm, + double *c, + int *gi, + int *reg1, + int *reg2 +); + +extern void tppipifr_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *dm1, + double *diam, + double *rr, + double *l, + double *area, + double *re, + double *v, + double *ff, + double *dm1dot, + double *dh1, + double *c, + int *reg, + int *gi +); + +extern void tppipefrber_ +( + double *p1, + double *t1, + double *p2, + double *t2, + double *diam, + double *rr, + double *l, + double *area, + double *v, + double *re, + double *ff, + double *dh1, + double *dm1, + double *dh2, + double *dm2, + double *c, + int *gi, + int *reg +); + +extern void tprcqfix_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *temp2, + double *press2, + double *area, + double *cq, + int *gi, + double *cm, + double *gasvel, + int *reg +); + +extern void tprcqnor_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *temp2, + double *press2, + double *b, + double *c, + int *gi, + double *cm, + double *gasvel, + int *reg +); + +extern void tprcqper_ +( + double *dh1, + double *dm1, + double *temp1, + double *press1, + double *temp2, + double *press2, + double *area, + double *cq, + int *gi, + double *cm, + double *gasvel, + int *reg +); + +extern int tprtabprops_ +( + char *name, + double *xvalues, + int *num +); + +extern double tpsmooth_ +( + double *f1, + double *f2, + double *x, + double *x1, + double *x2 +); + +extern void tpvol_ +( + double *dtemp, + double *dpress, + double *mgas, + double *temp, + double *press, + double *sdm, + double *sdh, + double *volt, + double *dvol, + double *dq, + int *gi +); + +#endif /* PN_PUBLIC_H */ diff --git a/AmesimModels/help/utilities/pn2pipefr_.pdf b/AmesimModels/help/utilities/pn2pipefr_.pdf new file mode 100644 index 0000000..45f264d Binary files /dev/null and b/AmesimModels/help/utilities/pn2pipefr_.pdf differ diff --git a/AmesimModels/help/utilities/pn2rcqfix_.pdf b/AmesimModels/help/utilities/pn2rcqfix_.pdf new file mode 100644 index 0000000..8ca95ef Binary files /dev/null and b/AmesimModels/help/utilities/pn2rcqfix_.pdf differ diff --git a/AmesimModels/help/utilities/pn2vol.pdf b/AmesimModels/help/utilities/pn2vol.pdf new file mode 100644 index 0000000..bace2b0 Binary files /dev/null and b/AmesimModels/help/utilities/pn2vol.pdf differ diff --git a/AmesimModels/help/utilities/pn2vol1.pdf b/AmesimModels/help/utilities/pn2vol1.pdf new file mode 100644 index 0000000..b3b00a5 Binary files /dev/null and b/AmesimModels/help/utilities/pn2vol1.pdf differ diff --git a/AmesimModels/help/utilities/pn2vol2_.pdf b/AmesimModels/help/utilities/pn2vol2_.pdf new file mode 100644 index 0000000..7c541eb Binary files /dev/null and b/AmesimModels/help/utilities/pn2vol2_.pdf differ diff --git a/PythonModels/runs/test_mql_20260715_085526_745726/test_mql_model_summary.txt b/PythonModels/runs/test_mql_20260715_085526_745726/test_mql_model_summary.txt new file mode 100644 index 0000000..1ad5ff1 --- /dev/null +++ b/PythonModels/runs/test_mql_20260715_085526_745726/test_mql_model_summary.txt @@ -0,0 +1,31 @@ +Model: test_mql +Source archive: /home/huojr/projects/SystemSimulationApp/AmesimModels/test_mql.ame +Components: 117 +Connections: 84 +Continuous states in AMESim modelinfo: 132 +Discrete states in AMESim modelinfo: 24 +Global parameters: + - D1: 20 + - D2: 20 + - D3: 14 + - P0: 153 + - Pdq: 1 + - V: 15 + - cf: 0.45 +Component submodels: + - F000: 16 + - FORC: 2 + - LMECHN1: 2 + - LSTP00A: 8 + - MECMAS21: 10 + - P4NODE2: 8 + - PN3NODE2: 8 + - PNCH012: 8 + - PNCH023: 4 + - PNGD00: 1 + - PNOR001: 8 + - PNPL01: 16 + - PNRP17: 8 + - PNVO001: 8 + - STEP0: 8 + - UD00: 2 diff --git a/PythonModels/runs/test_mql_20260715_085712_158379/test_mql_model_summary.txt b/PythonModels/runs/test_mql_20260715_085712_158379/test_mql_model_summary.txt new file mode 100644 index 0000000..1ad5ff1 --- /dev/null +++ b/PythonModels/runs/test_mql_20260715_085712_158379/test_mql_model_summary.txt @@ -0,0 +1,31 @@ +Model: test_mql +Source archive: /home/huojr/projects/SystemSimulationApp/AmesimModels/test_mql.ame +Components: 117 +Connections: 84 +Continuous states in AMESim modelinfo: 132 +Discrete states in AMESim modelinfo: 24 +Global parameters: + - D1: 20 + - D2: 20 + - D3: 14 + - P0: 153 + - Pdq: 1 + - V: 15 + - cf: 0.45 +Component submodels: + - F000: 16 + - FORC: 2 + - LMECHN1: 2 + - LSTP00A: 8 + - MECMAS21: 10 + - P4NODE2: 8 + - PN3NODE2: 8 + - PNCH012: 8 + - PNCH023: 4 + - PNGD00: 1 + - PNOR001: 8 + - PNPL01: 16 + - PNRP17: 8 + - PNVO001: 8 + - STEP0: 8 + - UD00: 2 diff --git a/PythonModels/runs/test_mql_20260715_091524_614886/test_mql_model_summary.txt b/PythonModels/runs/test_mql_20260715_091524_614886/test_mql_model_summary.txt new file mode 100644 index 0000000..1ad5ff1 --- /dev/null +++ b/PythonModels/runs/test_mql_20260715_091524_614886/test_mql_model_summary.txt @@ -0,0 +1,31 @@ +Model: test_mql +Source archive: /home/huojr/projects/SystemSimulationApp/AmesimModels/test_mql.ame +Components: 117 +Connections: 84 +Continuous states in AMESim modelinfo: 132 +Discrete states in AMESim modelinfo: 24 +Global parameters: + - D1: 20 + - D2: 20 + - D3: 14 + - P0: 153 + - Pdq: 1 + - V: 15 + - cf: 0.45 +Component submodels: + - F000: 16 + - FORC: 2 + - LMECHN1: 2 + - LSTP00A: 8 + - MECMAS21: 10 + - P4NODE2: 8 + - PN3NODE2: 8 + - PNCH012: 8 + - PNCH023: 4 + - PNGD00: 1 + - PNOR001: 8 + - PNPL01: 16 + - PNRP17: 8 + - PNVO001: 8 + - STEP0: 8 + - UD00: 2 diff --git a/PythonModels/runs/test_mql_20260720_084308_403642/test_mql_model_summary.txt b/PythonModels/runs/test_mql_20260720_084308_403642/test_mql_model_summary.txt new file mode 100644 index 0000000..1ad5ff1 --- /dev/null +++ b/PythonModels/runs/test_mql_20260720_084308_403642/test_mql_model_summary.txt @@ -0,0 +1,31 @@ +Model: test_mql +Source archive: /home/huojr/projects/SystemSimulationApp/AmesimModels/test_mql.ame +Components: 117 +Connections: 84 +Continuous states in AMESim modelinfo: 132 +Discrete states in AMESim modelinfo: 24 +Global parameters: + - D1: 20 + - D2: 20 + - D3: 14 + - P0: 153 + - Pdq: 1 + - V: 15 + - cf: 0.45 +Component submodels: + - F000: 16 + - FORC: 2 + - LMECHN1: 2 + - LSTP00A: 8 + - MECMAS21: 10 + - P4NODE2: 8 + - PN3NODE2: 8 + - PNCH012: 8 + - PNCH023: 4 + - PNGD00: 1 + - PNOR001: 8 + - PNPL01: 16 + - PNRP17: 8 + - PNVO001: 8 + - STEP0: 8 + - UD00: 2 diff --git a/PythonModels/runs/test_mql_20260720_085120_858664/test_mql_model_summary.txt b/PythonModels/runs/test_mql_20260720_085120_858664/test_mql_model_summary.txt new file mode 100644 index 0000000..1ad5ff1 --- /dev/null +++ b/PythonModels/runs/test_mql_20260720_085120_858664/test_mql_model_summary.txt @@ -0,0 +1,31 @@ +Model: test_mql +Source archive: /home/huojr/projects/SystemSimulationApp/AmesimModels/test_mql.ame +Components: 117 +Connections: 84 +Continuous states in AMESim modelinfo: 132 +Discrete states in AMESim modelinfo: 24 +Global parameters: + - D1: 20 + - D2: 20 + - D3: 14 + - P0: 153 + - Pdq: 1 + - V: 15 + - cf: 0.45 +Component submodels: + - F000: 16 + - FORC: 2 + - LMECHN1: 2 + - LSTP00A: 8 + - MECMAS21: 10 + - P4NODE2: 8 + - PN3NODE2: 8 + - PNCH012: 8 + - PNCH023: 4 + - PNGD00: 1 + - PNOR001: 8 + - PNPL01: 16 + - PNRP17: 8 + - PNVO001: 8 + - STEP0: 8 + - UD00: 2 diff --git a/PythonModels/runs/test_mql_baseline_20260716_024434_287016/test_mql_baseline_summary.txt b/PythonModels/runs/test_mql_baseline_20260716_024434_287016/test_mql_baseline_summary.txt new file mode 100644 index 0000000..e48fb2a --- /dev/null +++ b/PythonModels/runs/test_mql_baseline_20260716_024434_287016/test_mql_baseline_summary.txt @@ -0,0 +1,8 @@ +Model: test_mql +Mode: AMESim baseline passthrough +Samples: 1002 +Output schema signals: 858 +Compared signals: 858 +Observation bindings: 114 +Max absolute error: 0.0 +Max relative error: 0.0 diff --git a/PythonModels/runs/test_mql_baseline_20260720_084318_747036/test_mql_baseline_summary.txt b/PythonModels/runs/test_mql_baseline_20260720_084318_747036/test_mql_baseline_summary.txt new file mode 100644 index 0000000..e48fb2a --- /dev/null +++ b/PythonModels/runs/test_mql_baseline_20260720_084318_747036/test_mql_baseline_summary.txt @@ -0,0 +1,8 @@ +Model: test_mql +Mode: AMESim baseline passthrough +Samples: 1002 +Output schema signals: 858 +Compared signals: 858 +Observation bindings: 114 +Max absolute error: 0.0 +Max relative error: 0.0