diff --git a/air.csproj b/air.csproj
index 206b89a..1c4317d 100644
--- a/air.csproj
+++ b/air.csproj
@@ -7,4 +7,8 @@
enable
+
+
+
+
diff --git a/air.sln b/air.sln
index b859968..c832710 100644
--- a/air.sln
+++ b/air.sln
@@ -1,9 +1,16 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
+Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
-VisualStudioVersion = 17.5.002.0
+VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "air", "air.csproj", "{2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{SRC_FOLDER_GUID}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{TESTS_FOLDER_GUID}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirTransmissionConsole", "src\AirTransmissionConsole\AirTransmissionConsole.csproj", "{CONSOLE_GUID}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirTransmission", "src\AirTransmission\AirTransmission.csproj", "{LIB_GUID}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirTransmission.Tests", "tests\AirTransmission.Tests\AirTransmission.Tests.csproj", "{TESTS_GUID}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -11,15 +18,22 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2A5A314C-58B2-4853-A6CA-F2B17F69A8E5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CONSOLE_GUID}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CONSOLE_GUID}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CONSOLE_GUID}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CONSOLE_GUID}.Release|Any CPU.Build.0 = Release|Any CPU
+ {LIB_GUID}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {LIB_GUID}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {LIB_GUID}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {LIB_GUID}.Release|Any CPU.Build.0 = Release|Any CPU
+ {TESTS_GUID}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {TESTS_GUID}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {TESTS_GUID}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {TESTS_GUID}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {16FD379F-2B2B-4334-A010-A5740A406481}
+ GlobalSection(NestedProjects) = preSolution
+ {CONSOLE_GUID} = {SRC_FOLDER_GUID}
+ {LIB_GUID} = {SRC_FOLDER_GUID}
+ {TESTS_GUID} = {TESTS_FOLDER_GUID}
EndGlobalSection
EndGlobal
diff --git a/docs/API.md b/docs/API.md
new file mode 100644
index 0000000..b2671c4
--- /dev/null
+++ b/docs/API.md
@@ -0,0 +1,224 @@
+# 大气透过率计算库 API 文档
+
+## 主要类和接口
+
+### AtmosphericTransmittanceCalculator
+
+静态类,提供各种电磁波透过率的计算方法。
+
+#### 方法
+
+##### CalcLaser
+
+```csharp
+public static double CalcLaser(WeatherCondition weather, double distance)
+```
+
+计算激光(1.06μm)在给定天气条件和距离下的大气透过率。
+
+- 参数:
+ - weather: 天气条件
+ - distance: 传输距离(米)
+- 返回值:0-1之间的透过率值
+
+##### CalcLaserWithSmoke
+
+```csharp
+public static double CalcLaserWithSmoke(WeatherCondition weather, double distance, double smokeConcentration, double smokeThickness)
+```
+
+计算有烟雾条件下的激光透过率。
+
+- 参数:
+ - weather: 天气条件
+ - distance: 传输距离(米)
+ - smokeConcentration: 烟雾浓度(g/m³)
+ - smokeThickness: 烟雾厚度(米)
+- 返回值:0-1之间的透过率值
+
+##### CalcTurbulenceEffect
+
+```csharp
+public static double CalcTurbulenceEffect(WeatherCondition weather, double distance)
+```
+
+计算湍流效应对激光透过率的影响。
+
+- 参数:
+ - weather: 天气条件
+ - distance: 传输距离(米)
+- 返回值:0-1之间的透过率值
+
+##### CalcIR
+
+```csharp
+public static double CalcIR(WeatherCondition weather, double distance)
+```
+
+计算红外线(3-12μm)透过率。
+
+- 参数:
+ - weather: 天气条件
+ - distance: 传输距离(米)
+- 返回值:0-1之间的透过率值
+
+##### CalcUV
+
+```csharp
+public static double CalcUV(WeatherCondition weather, double distance)
+```
+
+计算紫外线(0.2-0.4μm)透过率。
+
+- 参数:
+ - weather: 天气条件
+ - distance: 传输距离(米)
+- 返回值:0-1之间的透过率值
+
+##### CalcMillimeterWave
+
+```csharp
+public static double CalcMillimeterWave(WeatherCondition weather, double distance)
+```
+
+计算毫米波(94GHz)透过率。
+
+- 参数:
+ - weather: 天气条件
+ - distance: 传输距离(米)
+- 返回值:0-1之间的透过率值
+
+##### CalculateSmokeScreenTransmittance
+
+```csharp
+public static double CalculateSmokeScreenTransmittance(double smokeConcentration, double smokeThickness)
+```
+
+计算烟幕对电磁波的透过率。
+
+- 参数:
+ - smokeConcentration: 烟雾浓度(g/m³)
+ - smokeThickness: 烟雾厚度(米)
+- 返回值:0-1之间的透过率值
+
+##### CalculateReceivedRadiationSinglePath
+
+```csharp
+public static double CalculateReceivedRadiationSinglePath(double transmittance, double targetRadiation, double receiverDistance)
+```
+
+计算单程传输后接收到的辐射功率。
+
+- 参数:
+ - transmittance: 大气透过率
+ - targetRadiation: 目标辐射(W/Sr)
+ - receiverDistance: 接收器距离(米)
+- 返回值:接收到的辐射功率(W/Sr)
+
+##### CalculateReceivedRadiation
+
+```csharp
+public static double CalculateReceivedRadiation(double transmittance, double laserEnergy, double pulseWidth, double targetDistance, double receiverDistance, double targetReflectivity)
+```
+
+计算双程传输后接收到的辐射功率。
+
+- 参数:
+ - transmittance: 大气透过率
+ - laserEnergy: 激光能量(焦耳)
+ - pulseWidth: 脉冲宽度(纳秒)
+ - targetDistance: 目标距离(米)
+ - receiverDistance: 接收器距离(米)
+ - targetReflectivity: 目标反射率
+- 返回值:接收到的辐射功率(瓦特)
+
+### WeatherCondition
+
+表示大气环境条件的类。
+
+#### 构造函数
+
+```csharp
+public WeatherCondition(
+ WeatherType type,
+ double temperature,
+ double relativeHumidity,
+ double visibility,
+ double? precipitation = null,
+ double co2Concentration = 415)
+```
+
+- 参数:
+ - type: 天气类型
+ - temperature: 温度(摄氏度)
+ - relativeHumidity: 相对湿度(0-1)
+ - visibility: 能见度(米)
+ - precipitation: 降水量(mm/h),可选
+ - co2Concentration: 二氧化碳浓度(ppm),默认415
+
+#### 属性
+
+- `Type`: 天气类型(WeatherType 枚举)
+- `Temperature`: 温度(摄氏度)
+- `RelativeHumidity`: 相对湿度(0-1)
+- `Visibility`: 能见度(米)
+- `Precipitation`: 降水量(mm/h)
+- `CO2Concentration`: 二氧化碳浓度(ppm)
+
+### WeatherType
+
+天气类型枚举。
+
+```csharp
+public enum WeatherType
+{
+ 晴天, // 晴朗天气
+ 雨天, // 雨天
+ 雪天, // 雪天
+ 雾天, // 雾天
+ 沙尘 // 沙尘天气
+}
+```
+
+## 使用示例
+
+### 基本使用
+
+```csharp
+// 创建天气条件
+var weather = new WeatherCondition(
+ type: WeatherType.晴天,
+ temperature: 20, // 20℃
+ relativeHumidity: 0.45, // 45%
+ visibility: 23000 // 23km
+);
+// 计算1000米距离的激光透过率
+double transmittance = AtmosphericTransmittanceCalculator.CalcLaser(weather, 1000);
+```
+
+### 计算有烟雾条件下的透过率
+
+```csharp
+// 计算有烟雾条件下的透过率
+double smokeTransmittance = AtmosphericTransmittanceCalculator.CalcLaserWithSmoke(
+ weather,
+ distance: 1000, // 1000米
+ smokeConcentration: 0.1, // 0.1 g/m³
+ smokeThickness: 100 // 100米
+);
+```
+
+## 注意事项
+
+1. 所有透过率计算方法返回值范围都在0到1之间
+2. 距离单位统一使用米(m)
+3. 温度使用摄氏度(℃)
+4. 相对湿度使用0-1的小数表示
+5. 能见度使用米(m)表示
+6. 降水量使用毫米/小时(mm/h)表示
+
+## 性能考虑
+
+- 所有计算方法都是线程安全的
+- 计算过程中会考虑多种大气效应,包括分子散射、气溶胶散射、大气湍流等
+- 对于大量计算,建议复用 WeatherCondition 对象以提高性能
diff --git a/README.md b/docs/README.md
similarity index 69%
rename from README.md
rename to docs/README.md
index 88ae7f8..fbcf394 100644
--- a/README.md
+++ b/docs/README.md
@@ -1,12 +1,16 @@
-# 大气透过率计算器
+# 大气透过率计算库
## 项目简介
-大气透过率计算器是一个用于模拟和计算各种电磁波(包括激光、红外线、毫米波和紫外线)在不同大气条件下透过率的工具。本项目考虑了多种天气因素和大气湍流的影响,为光学和通信系统的设计与分析提供了有力支持。
+大气透过率计算库是一个用于模拟和计算各种电磁波(包括激光、红外线、毫米波和紫外线)在不同大气条件下透过率的工具。本项目考虑了多种天气因素和大气湍流的影响,为光学和通信系统的设计与分析提供了有力支持。
## 功能特性
- 支持多种电磁波类型:激光、红外线、毫米波和紫外线
+ - 激光 (1.06μm)
+ - 红外 (3-12μm)
+ - 紫外 (0.2-0.4μm)
+ - 毫米波 (94GHz)
- 考虑多种天气条件:晴天、雨天、雪天、雾天、沙尘天气
- 模拟大气湍流对光传输的影响
- 计算烟幕对透过率的影响
@@ -17,26 +21,32 @@
1. 确保您的系统已安装 .NET 7 或更高版本。
2. 克隆此仓库到本地机器: ```
- git clone https://github.com/11429339/atmospheric-transmittance-model.git ```
+ git clone https://github.com/11429339/atmospheric-transmittance-model.git ```
3. 进入项目目录: ```
- cd atmospheric-transmittance-model ```
+ cd atmospheric-transmittance-model ```
4. 编译项目: ```
- dotnet build ```
+ dotnet build ```
-## 使用方法
+## 快速开始
-1. 在项目根目录下运行程序: ```
- dotnet run ```
-2. 程序将自动执行一系列预设的测试场景,包括不同天气条件和传输距离。
-3. 查看控制台输出,了解各种条件下的透过率计算结果。
+```csharp
+// 创建天气条件
+var weather = new WeatherCondition(
+ type: WeatherType.晴天, // 天气类型
+ temperature: 20, // 温度(℃)
+ relativeHumidity: 0.45, // 相对湿度
+ visibility: 23000, // 能见度(米)
+ precipitation: 0 // 降雨量(mm/h)
+);
-### 示例代码
-
-如果您想在自己的程序中使用此计算器,可以参考Program.cs中的代码
+// 计算激光透过率
+double distance = 1000; // 1000米
+double transmittance = AtmosphericTransmittanceCalculator.CalcLaser(weather, distance);
+Console.WriteLine($"激光透过率: {transmittance:F4}");
+```
## 项目结构
-- `Program.cs`: 主程序入口,包含各种测试方法
- `AtmosphericTransmittanceCalculator.cs`: 主要的计算接口
- `TransmittanceModel.cs`: 透过率模型的基类
- `LaserTransmittanceModel.cs`: 激光透过率模型
diff --git a/src/AirTransmission/AirTransmission.csproj b/src/AirTransmission/AirTransmission.csproj
new file mode 100644
index 0000000..0956b39
--- /dev/null
+++ b/src/AirTransmission/AirTransmission.csproj
@@ -0,0 +1,25 @@
+
+
+
+ net8.0
+ enable
+ enable
+ true
+ AirTransmission.xml
+ AirTransmissionConsole
+ AirTransmission.Tests
+ $(NoWarn);CS1591;CS1573
+ 大气透过率计算库
+ 田建勇
+ 1.0.0
+ Copyright © 2024
+
+
+
+ Selective
+ docs
+ false
+ false
+
+
+
\ No newline at end of file
diff --git a/src/AirTransmission/AirTransmission.xml b/src/AirTransmission/AirTransmission.xml
new file mode 100644
index 0000000..5968676
--- /dev/null
+++ b/src/AirTransmission/AirTransmission.xml
@@ -0,0 +1,545 @@
+
+
+
+ AirTransmission
+
+
+
+
+ 大气透过率计算器
+
+
+
+
+ 计算激光在给定天气条件和距离下的大气透过率
+
+ 天气条件
+ 传输距离(米)
+ 大气透过率
+
+
+
+ 计算激光在有烟雾条件下的大气透过率
+
+ 天气条件
+ 传输距离(米)
+ 烟雾浓度
+ 烟雾厚度(米)
+ 大气透过率
+
+
+
+ 计算红外线在给定条件下的大气透过率
+
+ 天气条件
+ 传输距离(米)
+ 烟雾浓度
+ 烟雾厚度(米)
+ 大气透过率
+
+
+
+ 计算毫米波在给定条件下的大气透过率
+
+ 天气条件
+ 传输距离(米)
+ 烟雾浓度
+ 烟雾厚度(米)
+ 大气透过率
+
+
+
+ 计算双程传输后接收到的辐射功率
+
+ 大气透过率
+ 激光能量(焦耳)
+ 脉冲宽度(纳秒)
+ 目标距离(米)
+ 接收器距离(米)
+ 目标反射率
+ 接收到的辐射功率(瓦特)
+
+
+
+ 计算单程传输后接收到的辐射功率
+
+ 大气透过率
+ 目标辐射(W/Sr)
+ 接收器距离(米)
+ 接收到的辐射功率(W/Sr)
+
+
+
+ 计算紫外线在给定天气条件和距离下的大气透过率
+
+ 天气条件
+ 传输距离(米)
+ 大气透过率
+
+
+
+ 计算湍流效应对激光透过率的影响
+
+ 天气条件
+ 传输距离(米)
+ 大气透过率
+
+
+
+ 计算烟幕对电磁波的透过率
+
+ 烟幕浓度(g/m³)
+ 烟幕厚度(米)
+ 烟幕透过率(0到1之间的值)
+
+
+
+ 大气湍流模型类,用于计算大气湍流对光传输的影响
+
+
+
+
+ 计算大气湍流对光传输的综合影响
+
+ 传输距离(米)
+ 传输高度(米)
+ 风速(米/秒)
+ 大气折射率结构常数
+ 湍流效应(0到1之间的值,1表示无影响,0表示完全衰减)
+
+
+
+ 使用修改后的 Hufnagel-Valley 模型计算大气折射率结构常数
+
+ 高度(米)
+ 风速(米/秒)
+ 大气折射率结构常数
+
+
+
+ 计算弗里德参数(Fried parameter)
+
+ 大气折射率结构常数
+ 传输距离(米)
+ 弗里德参数(米)
+
+
+
+ 计算闪烁指数(Scintillation Index)
+
+ 大气折射率结构常数
+ 波数
+ 传输距离(米)
+ 闪烁指数(无量纲)
+
+
+
+ 计算光束漂移(Beam Wander)
+
+ 大气折射率结构常数
+ 传输距离(米)
+ 传输高度(米)
+ 光束漂移(弧度)
+
+
+
+ 计算相干长度(Coherence Length)
+
+ 大气折射率结构常数
+ 传输距离(米)
+ 相干长度(米)
+
+
+
+ 计算到达角(Angle of Arrival)
+
+ 大气折射率结构常数
+ 传输距离(米)
+ 接收器口径(米)
+ 到达角(弧度)
+
+
+
+ 计算等晕角(Isoplanatism Angle)
+
+ 大气折射率结构常数
+ 传输距离(米)
+ 等晕角(弧度)
+
+
+
+ 红外线传输模型类,用于计算红外线在大气中的传输特性
+
+
+
+
+ 激光传输模型类,用于计算激光在大气中的传输特性
+
+
+
+
+ 激光传输模型类,用于计算激光在大气中的传输特性
+
+
+
+
+ 激光波长(微米)
+
+
+
+
+ 计算给定距离的激光透过率
+
+ 传输距离(米)
+ 激光透过率(0到1之间的值)
+
+
+
+ 计算考虑湍流效应的激光透过率
+
+ 传输距离(米)
+ 考虑湍流效应的激光透过率
+
+
+
+ 计算雨对激光的衰减系数K
+
+ 波长(微米)
+ 雨衰减系数K
+
+
+
+ 计算雨对激光的衰减系数α
+
+ 波长(微米)
+ 雨衰减系数α
+
+
+
+ 计算雪对激光的衰减系数K
+
+ 波长(微米)
+ 雪衰减系数K
+
+
+
+ 计算雪对激光的衰减系数α
+
+ 波长(微米)
+ 雪衰减系数α
+
+
+
+ 计算激光的总衰减因子
+
+ 激光总衰减因子
+
+
+
+ 计算分子散射因子
+
+ 分子散射因子
+
+
+
+ 计算气溶胶散射因子
+
+ 气溶胶散射因子
+
+
+
+ 计算雾对激光的衰减
+
+ 传输路径长度(米)
+ 雾对激光的衰减
+
+
+
+ 计算考虑烟雾的激光透过率
+
+ 传输距离(米)
+ 烟雾浓度
+ 烟雾厚度(米)
+ 考虑烟雾的激光透过率
+
+
+
+ 应用湍流效应到透过率
+
+ 原始透过率
+ 传输距离(米)
+ 考虑湍流效应后的透过率
+
+
+
+ 毫米波传输模型类,用于计算毫米波在大气中的传输特性
+
+
+
+
+ 毫米波波长(毫米)
+
+
+
+
+ 计算给定距离的毫米波透过率
+
+ 传输距离(米)
+ 毫米波透过率(0到1之间的值)
+
+
+
+ 计算分子散射系数
+
+ 分子散射系数(km^-1)
+
+
+
+ 计算气溶胶散射系数
+
+ 气溶胶散射系数(km^-1)
+
+
+
+ 计算水汽吸收系数
+
+ 水汽吸收系数(km^-1)
+
+
+
+ 计算水汽密度
+
+ 水汽密度(g/m³)
+
+
+
+ 计算氧气吸收系数
+
+ 氧气吸收系数(km^-1)
+
+
+
+ 计算雾对毫米波的衰减
+
+ 传输路径长度(米)
+ 雾衰减
+
+
+
+ 大气透过率模型的抽象基类,提供了各种大气条件下的透过率计算方法
+
+
+
+
+ 大气透过率模型的抽象基类,提供了各种大气条件下的透过率计算方法
+
+
+
+
+ 标准大气透过率
+
+
+
+
+ 标准能见度(公里)
+
+
+
+
+ 标准气溶胶密度(粒子/立方厘米)
+
+
+
+
+ 当前天气条件
+
+
+
+
+ 温度(开尔文)
+
+
+
+
+ 大气压力(百帕)
+
+
+
+
+ 相对湿度(百分比)
+
+
+
+
+ 气溶胶密度(粒子/立方厘米)
+
+
+
+
+ 能见度(公里)
+
+
+
+
+ 是否下雨
+
+
+
+
+ 降雨量(毫米/小时)
+
+
+
+
+ 是否有雾
+
+
+
+
+ 是否有沙尘
+
+
+
+
+ 是否下雪
+
+
+
+
+ 降雪量(毫米/小时)
+
+
+
+
+ 二氧化碳浓度(ppm)
+
+
+
+
+ 计算给定距离的大气透过率
+
+ 传输距离(米)
+ 大气透过率(0到1之间的值)
+
+
+
+ 根据能见度计算气溶胶密度
+
+ 能见度(公里)
+ 气溶胶密度(粒子/立方厘米)
+
+
+
+ 计算雨对电磁波的衰减系数K
+
+ 波长(微米或毫米)
+ 雨衰减系数K
+
+
+
+ 计算雨对电磁波的衰减系数α
+
+ 波长(微米或毫米)
+ 雨衰减系数α
+
+
+
+ 计算雪对电磁波的衰减系数K
+
+ 波长(微米或毫米)
+ 雪衰减系数K
+
+
+
+ 计算雪对电磁波的衰减系数α
+
+ 波长(微米或毫米)
+ 雪衰减系数α
+
+
+
+ 计算雨对电磁波的衰减
+
+ 传输路径长度(米)
+ 波长(微米或毫米)
+ 雨衰减(dB)
+
+
+
+ 计算雪对电磁波的衰减
+
+ 传输路径长度(米)
+ 波长(微米或毫米)
+ 雪衰减(dB)
+
+
+
+ 计算沙尘对电磁波的衰减
+
+ 传输路径长度(米)
+ 沙尘衰减(dB)
+
+
+
+ 计算能见度因子
+
+ 能见度因子
+
+
+
+ 紫外线传输模型类,用于计算紫外线在大气中的传输特性
+
+
+
+
+ 天气条件类
+
+
+
+
+ 天气条件类
+
+
+
+
+ 天气类型
+
+
+
+
+ 温度(摄氏度)
+
+
+
+
+ 相对湿度(百分比)
+
+
+
+
+ 能见度(公里)
+
+
+
+
+ 降水量(毫米/小时)
+
+
+
+
+ 二氧化碳浓度(ppm)
+
+
+
+
+ 打印天气信息
+
+ 天气条件
+
+
+
+ 天气类型枚举
+
+
+
+
diff --git a/AirTransmission/AtmosphericTransmittanceCalculator.cs b/src/AirTransmission/AtmosphericTransmittanceCalculator.cs
similarity index 77%
rename from AirTransmission/AtmosphericTransmittanceCalculator.cs
rename to src/AirTransmission/AtmosphericTransmittanceCalculator.cs
index 34cb7c7..c8ec098 100644
--- a/AirTransmission/AtmosphericTransmittanceCalculator.cs
+++ b/src/AirTransmission/AtmosphericTransmittanceCalculator.cs
@@ -7,7 +7,7 @@
namespace AirTransmission
{
///
- /// 提供各种大气传输模型的计算方法
+ /// 大气透过率计算器
///
public static class AtmosphericTransmittanceCalculator
{
@@ -49,7 +49,7 @@ namespace AirTransmission
{
var model = new IRTransmittanceModel(weather);
double transmittance = model.CalculateTransmittance(distance);
- double smokeTransmittance = TransmittanceModel.CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
+ double smokeTransmittance = CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
return transmittance * smokeTransmittance;
}
@@ -65,12 +65,12 @@ namespace AirTransmission
{
var model = new MillimeterWaveTransmittanceModel(weather);
double transmittance = model.CalculateTransmittance(distance);
- double smokeTransmittance = TransmittanceModel.CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
+ double smokeTransmittance = CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
return transmittance * smokeTransmittance;
}
///
- /// 计算接收到的辐射功率
+ /// 计算双程传输后接收到的辐射功率
///
/// 大气透过率
/// 激光能量(焦耳)
@@ -110,7 +110,7 @@ namespace AirTransmission
}
///
- /// 计算单程传输中接收到的辐射功率
+ /// 计算单程传输后接收到的辐射功率
///
/// 大气透过率
/// 目标辐射(W/Sr)
@@ -144,5 +144,42 @@ namespace AirTransmission
var model = new UVTransmittanceModel(weather);
return model.CalculateTransmittance(distance);
}
+
+ ///
+ /// 计算湍流效应对激光透过率的影响
+ ///
+ /// 天气条件
+ /// 传输距离(米)
+ /// 大气透过率
+ public static double CalcTurbulenceEffect(WeatherCondition weather, double distance)
+ {
+ var model = new LaserTransmittanceModel(weather);
+ return model.CalculateTransmittanceWithTurbulence(distance);
+ }
+
+ ///
+ /// 计算烟幕对电磁波的透过率
+ ///
+ /// 烟幕浓度(g/m³)
+ /// 烟幕厚度(米)
+ /// 烟幕透过率(0到1之间的值)
+ public static double CalculateSmokeScreenTransmittance(double smokeConcentration, double smokeThickness)
+ {
+ if (smokeConcentration <= 0 || smokeThickness <= 0)
+ return 1; // 如果没有烟幕,返回1(无衰减)
+
+ // 烟幕衰减系数(假设值,需要根据实际烟幕特性调整)
+ double smokeAttenuationCoefficient = 0.5;
+
+ // 使用Beer-Lambert定律计算透过率
+ double transmittance = Math.Exp(-smokeAttenuationCoefficient * smokeConcentration * smokeThickness);
+
+ Console.WriteLine($"烟幕透过率计算:");
+ Console.WriteLine($"烟幕浓度: {smokeConcentration:F2} g/m³");
+ Console.WriteLine($"烟幕厚度: {smokeThickness:F2} m");
+ Console.WriteLine($"烟幕透过率: {transmittance:F4}");
+
+ return transmittance;
+ }
}
}
diff --git a/AirTransmission/AtmosphericTurbulenceModel.cs b/src/AirTransmission/AtmosphericTurbulenceModel.cs
similarity index 99%
rename from AirTransmission/AtmosphericTurbulenceModel.cs
rename to src/AirTransmission/AtmosphericTurbulenceModel.cs
index 38ad81c..ba624a0 100644
--- a/AirTransmission/AtmosphericTurbulenceModel.cs
+++ b/src/AirTransmission/AtmosphericTurbulenceModel.cs
@@ -9,7 +9,7 @@ namespace AirTransmission
///
/// 大气湍流模型类,用于计算大气湍流对光传输的影响
///
- public class AtmosphericTurbulenceModel
+ internal class AtmosphericTurbulenceModel
{
// 波数,假设波长为1.06微米(常用的激光波长)
private const double k = 2 * Math.PI / 1.06e-6;
diff --git a/AirTransmission/IRTransmittanceModel.cs b/src/AirTransmission/IRTransmittanceModel.cs
similarity index 99%
rename from AirTransmission/IRTransmittanceModel.cs
rename to src/AirTransmission/IRTransmittanceModel.cs
index 7e5df81..0afe64c 100644
--- a/AirTransmission/IRTransmittanceModel.cs
+++ b/src/AirTransmission/IRTransmittanceModel.cs
@@ -9,7 +9,7 @@ namespace AirTransmission
///
/// 红外线传输模型类,用于计算红外线在大气中的传输特性
///
- public class IRTransmittanceModel : TransmittanceModel
+ internal class IRTransmittanceModel : TransmittanceModel
{
// 光谱分段参数
private const double MIN_WAVELENGTH = 3.0; // 红外波段最小波长(微米)
diff --git a/AirTransmission/LaserTransmittanceModel.cs b/src/AirTransmission/LaserTransmittanceModel.cs
similarity index 96%
rename from AirTransmission/LaserTransmittanceModel.cs
rename to src/AirTransmission/LaserTransmittanceModel.cs
index 1f18137..97d12d7 100644
--- a/AirTransmission/LaserTransmittanceModel.cs
+++ b/src/AirTransmission/LaserTransmittanceModel.cs
@@ -9,7 +9,7 @@ namespace AirTransmission
///
/// 激光传输模型类,用于计算激光在大气中的传输特性
///
- public class LaserTransmittanceModel(WeatherCondition weather) : TransmittanceModel(weather)
+ internal class LaserTransmittanceModel(WeatherCondition weather) : TransmittanceModel(weather)
{
///
/// 激光波长(微米)
@@ -183,7 +183,7 @@ namespace AirTransmission
public double CalculateTransmittanceWithSmoke(double distance, double smokeConcentration, double smokeThickness)
{
double transmittance = CalculateTransmittance(distance);
- double smokeTransmittance = CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
+ double smokeTransmittance = AtmosphericTransmittanceCalculator.CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
return transmittance * smokeTransmittance;
}
diff --git a/AirTransmission/MillimeterWaveTransmittanceModel.cs b/src/AirTransmission/MillimeterWaveTransmittanceModel.cs
similarity index 98%
rename from AirTransmission/MillimeterWaveTransmittanceModel.cs
rename to src/AirTransmission/MillimeterWaveTransmittanceModel.cs
index 07c7d6e..412cfd9 100644
--- a/AirTransmission/MillimeterWaveTransmittanceModel.cs
+++ b/src/AirTransmission/MillimeterWaveTransmittanceModel.cs
@@ -9,7 +9,7 @@ namespace AirTransmission
///
/// 毫米波传输模型类,用于计算毫米波在大气中的传输特性
///
- public class MillimeterWaveTransmittanceModel : TransmittanceModel
+ internal class MillimeterWaveTransmittanceModel : TransmittanceModel
{
///
/// 毫米波波长(毫米)
diff --git a/AirTransmission/TransmittanceModel.cs b/src/AirTransmission/TransmittanceModel.cs
similarity index 72%
rename from AirTransmission/TransmittanceModel.cs
rename to src/AirTransmission/TransmittanceModel.cs
index 8358fe3..d4e20e9 100644
--- a/AirTransmission/TransmittanceModel.cs
+++ b/src/AirTransmission/TransmittanceModel.cs
@@ -9,7 +9,7 @@ namespace AirTransmission
///
/// 大气透过率模型的抽象基类,提供了各种大气条件下的透过率计算方法
///
- public abstract class TransmittanceModel(WeatherCondition weather)
+ internal abstract class TransmittanceModel(WeatherCondition weather)
{
// 常量
///
@@ -103,7 +103,8 @@ namespace AirTransmission
///
/// 波长(微米或毫米)
/// 雨衰减系数K
- protected abstract double CalculateRainKCoefficient(double wavelength);
+ protected abstract double CalculateRainKCoefficient(double wavelength);
+
///
/// 计算雨对电磁波的衰减系数α
///
@@ -206,81 +207,5 @@ namespace AirTransmission
return factor;
}
-
- ///
- /// 计算烟幕对电磁波的透过率
- ///
- /// 烟幕浓度(g/m³)
- /// 烟幕厚度(米)
- /// 烟幕透过率(0到1之间的值)
- public static double CalculateSmokeScreenTransmittance(double smokeConcentration, double smokeThickness)
- {
- if (smokeConcentration <= 0 || smokeThickness <= 0)
- return 1; // 如果没有烟幕,返回1(无衰减)
-
- // 烟幕衰减系数(假设值,需要根据实际烟幕特性调整)
- double smokeAttenuationCoefficient = 0.5;
-
- // 使用Beer-Lambert定律计算透过率
- double transmittance = Math.Exp(-smokeAttenuationCoefficient * smokeConcentration * smokeThickness);
-
- Console.WriteLine($"烟幕透过率计算:");
- Console.WriteLine($"烟幕浓度: {smokeConcentration:F2} g/m³");
- Console.WriteLine($"烟幕厚度: {smokeThickness:F2} m");
- Console.WriteLine($"烟幕透过率: {transmittance:F4}");
-
- return transmittance;
- }
-
- ///
- /// 打印天气信息
- ///
- /// 天气条件
- public static void PrintWeatherInfo(WeatherCondition weather){
- Console.WriteLine($"---天气类型: {weather.Type}, 温度: {weather.Temperature}°C, 相对湿度: {weather.RelativeHumidity}%, 能见度: {weather.Visibility}km, 降水量: {weather.Precipitation ?? 0}mm/h");
- }
- }
-
- ///
- /// 天气类型枚举
- ///
- public enum WeatherType
- {
- 晴天,
- 雨天,
- 雪天,
- 雾天,
- 沙尘
- }
-
- ///
- /// 天气条件类
- ///
- public class WeatherCondition(WeatherType type, double temperature, double relativeHumidity, double visibility, double? precipitation = null, double co2Concentration = 415)
- {
- ///
- /// 天气类型
- ///
- public WeatherType Type { get; set; } = type; // 天气类型
- ///
- /// 温度(摄氏度)
- ///
- public double Temperature { get; set; } = temperature; // 温度
- ///
- /// 相对湿度(百分比)
- ///
- public double RelativeHumidity { get; set; } = relativeHumidity; // 相对湿度
- ///
- /// 能见度(公里)
- ///
- public double Visibility { get; set; } = visibility; // 能见度
- ///
- /// 降水量(毫米/小时)
- ///
- public double? Precipitation { get; set; } = precipitation; // 降水量
- ///
- /// 二氧化碳浓度(ppm)
- ///
- public double CO2Concentration { get; set; } = co2Concentration;
}
}
\ No newline at end of file
diff --git a/AirTransmission/UVTransmittanceModel.cs b/src/AirTransmission/UVTransmittanceModel.cs
similarity index 98%
rename from AirTransmission/UVTransmittanceModel.cs
rename to src/AirTransmission/UVTransmittanceModel.cs
index 3b62392..4785002 100644
--- a/AirTransmission/UVTransmittanceModel.cs
+++ b/src/AirTransmission/UVTransmittanceModel.cs
@@ -9,7 +9,7 @@ namespace AirTransmission
///
/// 紫外线传输模型类,用于计算紫外线在大气中的传输特性
///
- public class UVTransmittanceModel : TransmittanceModel
+ internal class UVTransmittanceModel : TransmittanceModel
{
// 光谱分段参数
private const double MIN_WAVELENGTH = 0.2; // 紫外波段最小波长(微米)
diff --git a/src/AirTransmission/WeatherCondition.cs b/src/AirTransmission/WeatherCondition.cs
new file mode 100644
index 0000000..415f91a
--- /dev/null
+++ b/src/AirTransmission/WeatherCondition.cs
@@ -0,0 +1,55 @@
+using System;
+
+namespace AirTransmission
+{
+ ///
+ /// 天气条件类
+ ///
+ public class WeatherCondition(WeatherType type, double temperature, double relativeHumidity, double visibility, double? precipitation = null, double co2Concentration = 415)
+ {
+ ///
+ /// 天气类型
+ ///
+ public WeatherType Type { get; set; } = type; // 天气类型
+ ///
+ /// 温度(摄氏度)
+ ///
+ public double Temperature { get; set; } = temperature; // 温度
+ ///
+ /// 相对湿度(百分比)
+ ///
+ public double RelativeHumidity { get; set; } = relativeHumidity; // 相对湿度
+ ///
+ /// 能见度(公里)
+ ///
+ public double Visibility { get; set; } = visibility; // 能见度
+ ///
+ /// 降水量(毫米/小时)
+ ///
+ public double? Precipitation { get; set; } = precipitation; // 降水量
+ ///
+ /// 二氧化碳浓度(ppm)
+ ///
+ public double CO2Concentration { get; set; } = co2Concentration;
+
+ ///
+ /// 打印天气信息
+ ///
+ /// 天气条件
+ public static void PrintWeatherInfo(WeatherCondition weather){
+ Console.WriteLine($"---天气类型: {weather.Type}, 温度: {weather.Temperature}°C, 相对湿度: {weather.RelativeHumidity}%, 能见度: {weather.Visibility}km, 降水量: {weather.Precipitation ?? 0}mm/h");
+ }
+ }
+
+ ///
+ /// 天气类型枚举
+ ///
+ public enum WeatherType
+ {
+ 晴天, // 晴朗天气
+ 雨天, // 雨天
+ 雪天, // 雪天
+ 雾天, // 雾天
+ 沙尘 // 沙尘
+ }
+}
\ No newline at end of file
diff --git a/src/AirTransmissionConsole/AirTransmissionConsole.csproj b/src/AirTransmissionConsole/AirTransmissionConsole.csproj
new file mode 100644
index 0000000..fc3d1e0
--- /dev/null
+++ b/src/AirTransmissionConsole/AirTransmissionConsole.csproj
@@ -0,0 +1,23 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ AirTransmissionConsole
+ AirTransmissionConsole
+
+
+
+
+
+
+
+ 大气透过率计算程序
+ 田建勇
+ 1.0.0
+ Copyright © 2024
+
+
+
\ No newline at end of file
diff --git a/Program.cs b/src/AirTransmissionConsole/Program.cs
similarity index 85%
rename from Program.cs
rename to src/AirTransmissionConsole/Program.cs
index 9778fad..4751819 100644
--- a/Program.cs
+++ b/src/AirTransmissionConsole/Program.cs
@@ -50,9 +50,6 @@ class Program
Console.WriteLine("\n不同天气条件下的紫外线透过率测试");
TestUVTransmittanceInDifferentWeather();
-
- Console.WriteLine("\n湍流效应对激光透过率的影响");
- TestTurbulenceEffect();
}
// 测试不同天气条件下的激光透过率
@@ -85,10 +82,11 @@ class Program
// 输出结果
Console.WriteLine($"\n[{description}条件下的激光透过率]");
- TransmittanceModel.PrintWeatherInfo(weatherCondition);
+ WeatherCondition.PrintWeatherInfo(weatherCondition);
foreach (var d in distances){
double laserTransmittance = AtmosphericTransmittanceCalculator.CalcLaser(weatherCondition, d);
- Console.WriteLine($"距离:{d}公里, 1.06μm激光透过率为: {laserTransmittance:P2}");
+ double turbulenceEffect = AtmosphericTransmittanceCalculator.CalcTurbulenceEffect(weatherCondition, d);
+ Console.WriteLine($"距离:{d}公里, 1.06μm激光透过率为: {laserTransmittance:P2}, 湍流效应: {turbulenceEffect:P2}");
}
}
@@ -131,7 +129,7 @@ class Program
// 输出结果
Console.WriteLine($"\n[{description}条件下的红外线透过率]");
- TransmittanceModel.PrintWeatherInfo(weatherCondition);
+ WeatherCondition.PrintWeatherInfo(weatherCondition);
foreach (var d in distances)
{
double irTransmittance = AtmosphericTransmittanceCalculator.CalcIR(weatherCondition, d);
@@ -154,7 +152,7 @@ class Program
double smokeThickness = 15; // 假设烟幕墙厚度为5米
// 计算烟幕透过率
- double smokeScreenTransmittance = TransmittanceModel.CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
+ double smokeScreenTransmittance = AtmosphericTransmittanceCalculator.CalculateSmokeScreenTransmittance(smokeConcentration, smokeThickness);
Console.WriteLine($"\n仅考虑烟幕的透过率: {smokeScreenTransmittance:P2}");
}
@@ -188,7 +186,7 @@ class Program
// 输出结果
Console.WriteLine($"\n[{description}条件下的毫米波透过率]");
- TransmittanceModel.PrintWeatherInfo(weatherCondition);
+ WeatherCondition.PrintWeatherInfo(weatherCondition);
foreach (var d in distances)
{
double mmWaveTransmittance = AtmosphericTransmittanceCalculator.CalcMillimeterWave(weatherCondition, d);
@@ -238,7 +236,7 @@ class Program
// 输出结果
Console.WriteLine($"\n[{description}条件下的紫外线透过率]");
- TransmittanceModel.PrintWeatherInfo(weatherCondition);
+ WeatherCondition.PrintWeatherInfo(weatherCondition);
foreach (var d in distances)
{
double uvTransmittance = AtmosphericTransmittanceCalculator.CalcUV(weatherCondition, d);
@@ -246,28 +244,4 @@ class Program
}
}
- // 测试湍流效应对激光透过率的影响
- static void TestTurbulenceEffect()
- {
- // 创建天气条件
- var weatherCondition = new WeatherCondition(
- type: WeatherType.晴天,
- temperature: 25,
- relativeHumidity: 60,
- visibility: 10
- );
-
- var laserModel = new LaserTransmittanceModel(weatherCondition);
-
- double[] distances = [0.1, 0.5, 1, 5, 10]; // 测试不同距离(公里)
-
- // 输出结果
- Console.WriteLine("\n[湍流效应对激光透过率的影响]");
- foreach (var d in distances)
- {
- double transmittanceWithoutTurbulence = laserModel.CalculateTransmittance(d);
- double transmittanceWithTurbulence = laserModel.CalculateTransmittanceWithTurbulence(d);
- Console.WriteLine($"距离:{d}公里, 无湍流透过率: {transmittanceWithoutTurbulence:P2}, 有湍流透过率: {transmittanceWithTurbulence:P2}");
- }
- }
}
diff --git a/tests/AirTransmission.Tests/AirTransmission.Tests.csproj b/tests/AirTransmission.Tests/AirTransmission.Tests.csproj
new file mode 100644
index 0000000..0c3716c
--- /dev/null
+++ b/tests/AirTransmission.Tests/AirTransmission.Tests.csproj
@@ -0,0 +1,23 @@
+
+
+
+ net8.0
+ enable
+ enable
+ false
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/AirTransmission.Tests/AtmosphericTransmittanceCalculatorTests.cs b/tests/AirTransmission.Tests/AtmosphericTransmittanceCalculatorTests.cs
new file mode 100644
index 0000000..6b3606c
--- /dev/null
+++ b/tests/AirTransmission.Tests/AtmosphericTransmittanceCalculatorTests.cs
@@ -0,0 +1,29 @@
+using Xunit;
+
+namespace AirTransmission.Tests;
+
+public class AtmosphericTransmittanceCalculatorTests
+{
+ [Fact]
+ public void CalcLaser_WithValidInput_ReturnsExpectedResult()
+ {
+ // Arrange
+ var weather = new WeatherCondition(
+ WeatherType.晴天, // 天气类型
+ temperature: 20, // 温度(℃)
+ relativeHumidity: 45, // 相对湿度
+ visibility: 10, // 能见度(公里)
+ precipitation: 0 // 降雨量(mm/h)
+ );
+ double distance = 1; // 1公里
+
+ // Act
+ double result = AtmosphericTransmittanceCalculator.CalcLaser(weather, distance);
+
+ Console.WriteLine($"计算得到的透过率为: {result}");
+
+ // Assert
+ Assert.True(result > 0 && result <= 1);
+ Assert.True(result > 0.5); // 在晴朗天气下,1公里距离的透过率应该大于0.5
+ }
+}
\ No newline at end of file