123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- using System;
- namespace SJ
- {
- public class MuShiModel
- {
- static void Main(string[] args)
- {
- //距离(km)举例
- double distance = 2;
- //能见度(km)举例
- double visibility = 7.5;
- //浪高(m)举例;陆上搜救任务可取0
- double WaveHeight = 1.5;
- //a、b、c、d、r、e均为修正系数
- double[] a = { 9.5128, 1.3738, 0.0875 };
- double[] b = { -49.6937, -13.2945, -2.5112 };
- double[] c = { 31.6031, 13.1456, 6.1604 };
- double[] d = { 95.0664, 97.0952, 94.9145 };
- double[][] r = new double[3][];
- r[0] = new double[] { 4.375, 1.18, 1.01, 1 };
- r[1] = new double[] { 2.85, 1.51, 1.18, 1 };
- r[2] = new double[] { 2.75, 2.1, 1.2, 1 };
- double[][] e = new double[3][];
- e[0] = new double[] { -10, -30, -50, -65, -80, -90 };
- e[1] = new double[] { -2, -15, -30, -50, -70, -80 };
- e[2] = new double[] { 0, 0, -10, -20, -30, -40 };
- double[] posibility = { 0, 0, 0 };
- if (distance >= 0 && distance < 2)
- {
- posibility = GetPosibilityClear(distance, a, b, c, d, r, e, visibility, WaveHeight);
- while (posibility[0] <= 0 || posibility[1] <= 0 || posibility[2] <= 0)
- {
- distance += 0.1;
- posibility = GetPosibilityClear(distance, a, b, c, d, r, e, visibility, WaveHeight);
- }
- }
- if (distance >= 2)
- {
- posibility = GetPosibilityFar(distance, a, b, c, d);
- while (posibility[0] <= 0 || posibility[1] <= 0 || posibility[2] <= 0)
- {
- distance += 0.5;
- posibility = GetPosibilityFar(distance, a, b, c, d);
- }
- if (distance > 3.5)
- {
- posibility[0] = 0;
- }
- if (distance > 5)
- {
- posibility[1] = 0;
- }
- if (distance > 10)
- {
- posibility[2] = 0;
- }
- }
- // double[] posibilityTest = GetPosibilityFar(distance, a, b, c, d);
- // Console.WriteLine(posibilityTest[0]);
- // Console.WriteLine(posibilityTest[1]);
- // Console.WriteLine(posibilityTest[2]);
- // Console.ReadKey();
- Console.WriteLine(posibility[0]);
- Console.WriteLine(posibility[1]);
- Console.WriteLine(posibility[2]);
- Console.ReadKey();
- }
- //Clear为2Km以内的模型
- public static double[] GetPosibilityClear(double distance, double[] a, double[] b, double[] c, double[] d, double[][] r, double[][] e, double visibility, double WaveHeight)
- {
- //r取值范围判断
- int i = 0;
- if (visibility >= 0 && visibility < 3)
- {
- i = 0;
- }
- if (visibility >= 3 && visibility < 5)
- {
- i = 1;
- }
- if (visibility >= 5 && visibility < 10)
- {
- i = 2;
- }
- if (visibility >= 10)
- {
- i = 3;
- }
- //e取值范围判断
- int j = 0;
- if (WaveHeight >= 0 && WaveHeight < 0.5)
- {
- j = 0;
- }
- if (WaveHeight >= 0.5 && WaveHeight < 1.25)
- {
- j = 1;
- }
- if (WaveHeight >= 1.25 && WaveHeight < 2.5)
- {
- j = 2;
- }
- if (WaveHeight >= 2.5 && WaveHeight < 4)
- {
- j = 3;
- }
- if (WaveHeight >= 4 && WaveHeight < 6)
- {
- j = 4;
- }
- if (WaveHeight >= 6 && WaveHeight < 9)
- {
- j = 5;
- }
- //posibility1为小目标目视发现概率
- double posibility1 = (a[0] * Math.Pow((distance * r[0][i]), 3) + b[0] * Math.Pow((distance * r[0][i]), 2) + c[0] * Math.Pow((distance * r[0][i]), 1) + d[0] + e[0][j]) / 100;
- ////posibility2为中目标目视发现概率
- double posibility2 = (a[1] * Math.Pow((distance * r[1][i]), 3) + b[1] * Math.Pow((distance * r[1][i]), 2) + c[1] * Math.Pow((distance * r[1][i]), 1) + d[1] + e[1][j]) / 100;
- ////posibility3为大目标目视发现概率
- double posibility3 = (a[2] * Math.Pow((distance * r[2][i]), 3) + b[2] * Math.Pow((distance * r[2][i]), 2) + c[2] * Math.Pow((distance * r[2][i]), 1) + d[2] + e[2][j]) / 100;
- double[] posibility = new double[3];
- posibility[0] = posibility1;
- posibility[1] = posibility2;
- posibility[2] = posibility3;
- return posibility;
- }
- //Far为2km以外的模型
- public static double[] GetPosibilityFar(double distance, double[] a, double[] b, double[] c, double[] d)
- {
- //posibility1为小目标目视发现概率
- double posibility1 = (a[0] * Math.Pow(distance, 3) + b[0] * Math.Pow(distance, 2) + c[0] * Math.Pow(distance, 1) + d[0]) / 100;
- ////posibility2为中目标目视发现概率
- double posibility2 = (a[1] * Math.Pow(distance, 3) + b[1] * Math.Pow(distance, 2) + c[1] * Math.Pow(distance, 1) + d[1]) / 100;
- ////posibility3为大目标目视发现概率
- double posibility3 = (a[2] * Math.Pow(distance, 3) + b[2] * Math.Pow(distance, 2) + c[2] * Math.Pow(distance, 1) + d[2]) / 100;
- double[] posibility = new double[3];
- posibility[0] = posibility1;
- posibility[1] = posibility2;
- posibility[2] = posibility3;
- return posibility;
- }
- }
- }
|