当前位置:网站首页>平均风向风速计算(单位矢量法)
平均风向风速计算(单位矢量法)
2022-06-27 02:08:00 【这被禁忌的游戏】

单位矢量法计算公式:

C# 代码
static void Main(string[] args)
{
int[] Met_Dir_Test = {
259, 259, 259, 259, 259, 259, 259, 259, 259, 259 };
int[] Met_Dir = {
297, 317, 356, 23, 21, 19, 26, 32, 28, 30 };
double[] Met_Speed = {
2.5, 1.8, 2.9, 4.4, 4.5, 4.6, 4.0, 3.7, 4.3, 4.3 };
for (int i = 0; i < 360; i++)
{
for (int j = 0; j < Met_Dir_Test.Length; j++)
{
Met_Dir_Test[j] = i;
}
int Dir_Avg = Met_Dir_Average(Met_Dir_Test, Met_Speed);
Console.WriteLine(i + " 平均风向:" + Dir_Avg);
}
Console.WriteLine("平均风向:" + Met_Dir_Average(Met_Dir, Met_Speed));
Console.Read();
}
static int Met_Dir_Average(int[] Dir_Buf,double[] Speed_Buf)
{
double Dir_Avg = 0;
double SinSum = 0;
double CosSum = 0;
for (int i = 0; i < Dir_Buf.Length; i++)
{
if (Dir_Buf[i] == 0 && Speed_Buf[i] == 0)
continue;
SinSum += Math.Sin(Dir_Buf[i] / 180.0f * Math.PI);//将角度转换为弧度角再代入计算
CosSum += Math.Cos(Dir_Buf[i] / 180.0f * Math.PI);//将角度转换为弧度角再代入计算
}
Dir_Avg = SinSum / CosSum;
Dir_Avg = Math.Atan(SinSum / CosSum) / Math.PI * 180.0;
Dir_Avg = Math.Round(Dir_Avg);
/* 方位角还原 数学中根据象限对角度进行划分。分别通过计算所得的东西方位平均分量u与南北方位平均分量v的正负数值判断真实的角度所处的象限在根据象限属性进行角度修正即可获得正式的角度。 经过计算与事例论证现给出各个方位计算结果的修正值: ①u > 0; v > 0:真实角度处于第一象限修正值为 + 0°; ②u > 0; v < 0:真实角度处于第二象限修正值为 + 180°; ③u < 0; v < 0:真实角度处于第三象限修正值为 + 180°; ④u < 0; v > 0:真实角度处于第四象限修正值为 + 360°。 简单分析 当角度处于一象限时无需修正,计算值即使真值;角度处于第二、三象限时根据正切函数特性,可通过将计算值向右平移一个正切函数周期计算获得,即向正方向修正180°;角度处于第四象限时,正切函数的定义域在(-3π / 2,2π)上,实际通过反正切求得值域(即为正切的定义域)为(-π / 2,0)上,,根据正切函数周期、对称特性可知此时应在计算值上向正向修正 + 360°可还原数据。*/
if (SinSum > 0 && CosSum > 0) Dir_Avg += 0;
else if (SinSum > 0 && CosSum < 0) Dir_Avg += 180;
else if(SinSum < 0 && CosSum < 0) Dir_Avg += 180;
else if(SinSum < 0 && CosSum > 0) Dir_Avg += 360;
return (int)Dir_Avg;
}
风向平均值采样单位矢量法计算,风速平均值直接用算术平均方法计算就好了
边栏推荐
- 别被洗脑了,这才是90%中国人的工资真相
- Shell脚本系列篇(1) 入门
- Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
- 二叉树oj题目
- 宁愿去996也不要待业在家啦!24岁,失业7个月,比上班更惨的,是没班可上
- 二叉樹oj題目
- I earned 3W yuan a month from my sideline: the industry you despise really makes money!
- Parameter estimation -- Chapter 7 study report of probability theory and mathematical statistics (point estimation)
- 企业数字化转型:信息化与数字化
- Oracle/PLSQL: Soundex Function
猜你喜欢

canvas粒子篇之鼠标跟随js特效

lottie. JS creative switch button animal head

What if asreml-r does not converge in operation?

“所有专业都在劝退”,对大学生最友好的竟然是它?

热议:月薪1.8万却毫无意义的工作,你干吗?

简单学习GoogleColab的入门级概念

Google began to roll itself, AI architecture pathways was blessed, and 20billion generation models were launched

Don't be brainwashed. This is the truth about the wages of 90% of Chinese people

速看!2022年6月编程语言排行榜出炉!第一名太牛啦

CVPR2022 | PointDistiller:面向高效紧凑3D检测的结构化知识蒸馏
随机推荐
热议:月薪1.8万却毫无意义的工作,你干吗?
Cvpr2022 | pointdistiller: structured knowledge distillation for efficient and compact 3D detection
snakemake 使用的注意事项
bluecms代码审计入门
XSS attack (note)
Installing the Damon database using the command line
Dameng database installation
perl语言中 fork()、exec()、waitpid() 、 $? >> 8 组合
TechSmith Camtasia最新2022版详细功能讲解下载
我靠副业一个月挣了3W块:你看不起的行业,真的很挣钱!
图论知识及其应用初步调研
Leetcode 785: judgment bipartite graph
Binary tree OJ problem
idea 插件开发一些异常处理
D's appendto packaging
On the operation mechanism of numpy array
pytorch 23 hook的使用与介绍 及基于hook实现即插即用的DropBlock
Precautions for using sneakemake
消费者追捧iPhone,在于它的性价比超越国产手机
Consumers pursue the iPhone because its cost performance exceeds that of domestic mobile phones