# 通风模拟

Tx3d Engine通风模拟解算相关功能由 @tx3d/ventilation 包提供。开发时需要先注册AirwayManager,如下所示:

import { AirwayManager } from @tx3d/ventilation;

// 注册AirwayManager模块
const airwayManager = engine.registerModule( AirwayManager );
1
2
3
4

提示

AirwayManager的初始化参数,详见AriwayManagerParameters

# 属性

🌏 basePressure 基点气压值(单位:pa)。

// 获取基点气压值
const basePressure = airwayManager.basePressure;

// 设置基点气压值
airwayManager.basePressure = 101000.0;
1
2
3
4
5

🌏 baseT 基点温度(单位:摄氏度)。

// 获取基点温度
const baseT = airwayManager.baseT;

// 设置基点温度
airwayManager.baseT = 22.0;
1
2
3
4
5

🌏 defaultNodeT 节点缺省温度(单位:摄氏度)。

// 获取节点缺省温度
const defaultNodeT = airwayManager.defaultNodeT;

// 设置节点缺省温度
airwayManager.defaultNodeT = 22.0
1
2
3
4
5

🌏 defaultNodeHum 节点缺省湿度。

// 获取节点缺省湿度
const defaultNodeHum = airwayManager.defaultNodeHum;

// 设置节点缺省湿度
airwayManager.defaultNodeHum = 50.0;
1
2
3
4
5

🌏 isCalNatureHr 是否计算自然风压。

// 获取是否计算自然风压
const isCalNatureHr = airwayManager.isCalNatureHr;

// 设置是否计算自然风压
airwayManager.isCalNatureHr = true;
1
2
3
4
5

🌏 iterAcc 迭代精度。

// 获取迭代精度
const iterAcc = airwayManager.iterAcc;

// 设置迭代精度
airwayManager.iterAcc = 0.00001;
1
2
3
4
5

🌏 localFriction 全局摩阻系数。

// 获取全局摩阻系数
const localFriction = airwayManager.localFriction;

// 设置全局摩阻系数
airwayManager.localFriction = 1.0;
1
2
3
4
5

🌏 textSize 风路文本标签尺寸(单位:像素)。

// 获取风路文本标签尺寸
const textSize = airwayManager.textSize;

// 设置风路文本标签尺寸
airwayManager.textSize = 16;
1
2
3
4
5

🌏 textColor 风路文本标签颜色。

// 获取风路文本标签颜色
const textColor = airwayManager.textColor;

// 设置风路文本标签颜色
airwayManager.textColor = '#ff0000';
1
2
3
4
5

🌏 textVisibleDistance 风路文本标签可视距离。

// 获取风路文本标签可视距离
const textVisibleDistance = airwayManager.textVisibleDistance;

// 设置风路文本标签可视距离
airwayManager.textVisibleDistance = 1000.0;
1
2
3
4
5

🌏 airwayTextVisible 风路文本标签是否可见。

// 获取风路文本标签是否可见
const visible = airwayManager.airwayTextVisible;

// 隐藏风路文本标签
airwayManager.airwayTextVisible = false;
1
2
3
4
5

🌏 airwayNodeTextVisible 风路节点文本标签是否可见。

// 获取风路节点文本标签是否可见
const visible = airwayManager.airwayNodeTextVisible;

// 隐藏风路节点文本标签
airwayManager.airwayNodeTextVisible = false;
1
2
3
4
5

🌏 displayAirwayProperties 设置风路文本标签展示的风路属性(只写)。

// 设置文本标签展示"风量"和"实测风量"两种属性
airwayManager.displayAirwayProperties = [ '风量', '实测风量' ];
1
2

提示

当前可展示的风路属性包括:风量实测风量初始风量风速风压风阻实测风阻解算风阻风路名称面积周长长度

🌏 displayAirwayNodeProperties 设置风路节点文本标签展示的风路节点属性(只写)。

// 设置文本标签展示"编号"和"温度"属性
airwayManager.displayAirwayNodeProperties = [ '编号', '温度' ];
1
2

提示

当前可展示的风路节点属性包括:编号标高温度湿度

🌏 displayPropertyName 风路文本标签是否显示属性名称。

// 获取风路文本标签是否显示属性名称
const displayPropertyName = airwayManager.displayPropertyName;

// 设置风路文本标签不显示属性名称
airwayManager.displayPropertyName = false;
1
2
3
4
5

🌏 displayPropertyUnit 风路文本标签是否显示属性单位。

// 获取风路文本标签是否显示属性单位
const displayPropertyUnit = airwayManager.dispalyPropertyUnit;

// 设置风路文本标签不显示属性单位
airwayManager.displayPropertyUnit = false;
1
2
3
4
5

🌏 colorType 风路颜色配色类型。

// 获取风路颜色配色类型
const colorType = airwayManager.colorType;

// 设置风路颜色配色类型
airwayManager.colorType = '默认';
1
2
3
4
5

提示

当前支持的风路颜色配色类型包括:默认风量对比

🌏 validColor 默认配色方案有效风路颜色。

// 获取默认配色方案有效风路颜色
const validColor = airwayManager.validColor;

// 设置默认配色方案有效风路颜色
airwayManager.validColor = '#ff00de';
1
2
3
4
5

🌏 invalidColor 默认配色方案无效风路颜色。

// 获取默认配色方案无效风路颜色
const invalidColor = airwayManager.invalidColor;

// 设置默认配色方案无效风路颜色
airwayManager.invalidColor = '#ff00de';
1
2
3
4
5

🌏 excludedColor 默认配色方案不参与解算风路颜色。

// 获取默认配色方案不参与解算风路颜色
const excludedColor = airwayManager.excludedColor;

// 设置默认配色方案不参与解算风路颜色
airwayManager.excludedColor = '#ff00de';
1
2
3
4
5

🌏 negativeColor 默认配色方案解算风量小于0的风路颜色。

// 获取默认配色方案解算风量小于0的风路颜色
const negativeColor = airwayManager.negativeColor;

// 设置默认配色方案解算风量小于0的风路颜色
airwayManager.negativeColor = '#ff00de';
1
2
3
4
5

🌏 singleEntryColor 默认配色方案独头风路颜色。

// 获取默认配色方案独头风路颜色
singleEntryColor = airwayManager.singleEntryColor;

// 设置默认配色方案独头风路颜色
airwayManager.singleEntryColor = '#ff00de';
1
2
3
4
5

🌏 airflowZeroColor 风量对比配色方案量风量或解算风量等于0的风路颜色。

// 获取风量对比配色方案测量风量或解算风量等于0的风路颜色
const airflowZeroColor = airwayManager.airflowZeroColor;

// 设置风量对比配色方案测量风量或解算风量等于0的风路颜色
airwayManager.airflowZeroColor = '#ff00de';
1
2
3
4
5

🌏 airflowLowColor 风量对比配色方案测量风量与解算风量的比率小于%15的风路颜色。

// 获取风量对比配色方案测量风量与解算风量的比率小于%15的风路颜色
const airflowLowColor = airwayManager.airflowLowColor;

// 设置风量对比配色方案测量风量与解算风量的比率小于%15的风路颜色
airwayManager.airflowLowColor = '#ff00de';
1
2
3
4
5

🌏 airflowMiddleColor 风量对比配色方案测量风量与解算风量的比率在[%15~%30]之间的风路颜色

// 获取风量对比配色方案测量风量与解算风量的比率在[%15~%30]之间的风路颜色
const airflowMiddleColor = airwayManager.airflowMiddleColor;

// 设置风量对比配色方案测量风量与解算风量的比率在[%15~%30]之间的风路颜色
airwayManager.airflowMiddleColor = '#ff00de';
1
2
3
4
5

🌏 airflowHighColor 风量对比配色方案测量风量与解算风量的比率大于30%的风路颜色。

// 获取风量对比配色方案测量风量与解算风量的比率大于30%的风路颜色
const airflowHighColor = airwayManager.airflowHighColor;

// 设置风量对比配色方案测量风量与解算风量的比率大于30%的风路颜色
airwayManager.airflowHighColor = '#ff00de';
1
2
3
4
5

🌏 excludedAirwayVisible 不参与解算的风路可见性。

// 获取不参与解算的风路是否可见
const excludedAirwayVisible = airwayManager.excludedAirwayVisible;

// 隐藏不参与解算的风路
airwayManager.excludedAirwayVisible = false;
1
2
3
4
5

# 接口

🌏 openScene 打开通风场景。

import { AssetsManager } from '@tx3d/core';

// 加载通风场景
AssetsManager.loadFile( './assets/jsons/mine/通风.json' ).then( ( data ) => {

    // 打开通风场景
    airwayManager.openScene( JSON.parse( data ) );

} );
1
2
3
4
5
6
7
8
9

🌏 saveScene 保存通风场景。

// 保存通风场景
const data = airwayManager.saveScene();

// TODO:保存到文件或数据库
1
2
3
4

🌏 ventilateSolve 进行网络解算。

// 网络解算
airwayManager.ventilateSolve( 'http://117.107.137.226:60000/ventop' ).then( ( results ) => {

    // TODO:解算成功处理

}, ( error ) => {

    // TODO:解算失败处理

} );
1
2
3
4
5
6
7
8
9
10

🌏 ventilateOpSolve 进行网络优化解算。

// 网络优化解算
airwayManager.ventilateOpSolve( 'http://117.107.137.226:60000/ventop' ).then( ( results ) => {

    // TODO:解算成功处理

}, ( error ) => {

    // TODO:解算失败处理

} );
1
2
3
4
5
6
7
8
9
10

🌏 refreshTopologyNetwork 刷新通风拓扑网络。

// 刷新通风拓扑网络
airwayManager.refreshTopologyNetwork();
1
2

🌏 createOrRetrieveAirway 通过巷道实体或风筒实体创建或检索风路对象。

// 创建或检索风路对象
const airway = airwayManager.createOrRetrieveAirway( entity );
1
2

注意

传入的实体参数必须包括Laneway(巷道)组件或AirDuct(风筒)组件,否则将返回null

🌏 getAirway 获取指定GUID的风路对象。

// 获取指定GUID的风路对象
const airway = airwayManager.getAirway( 'xxxx-xxxx-xxxx' );
1
2

提示

  • 风路GUID与其关联的巷道或风筒GUID一致
  • 风路对象结构详见Airway

🌏 getAirwayNode 获取指定GUID的风路节点对象。

// 获取指定GUID的风路节点对象
const airwayNode = airwayManager.getAirwayNode( 'xxxx-xxxx-xxxx' );
1
2

提示

风路节点对象结构详见AirwayNode

🌏 removeAirway 删除指定GUID的风路对象。

// 删除指定GUID的风路对象
airwayManager.removeAirway( 'xxxx-xxxx-xxxx' );
1
2
Last Updated: 11/29/2023, 1:19:36 PM