- •1 Содержание задания
- •2 Исходные данные
- •2.1 Характеристика объекта автоматизации:
- •2.2 Требования к информационному обеспечению:
- •Реферат
- •Введение
- •Системотехническая часть
- •Описание и анализ предметной области
- •Основные понятия и определения
- •Классификация случайных процессов
- •Моделирование сп
- •Статистическая оценка характеристик сп
- •Описание аналогов системы
- •Постановка задачи
- •Разработка структурной схемы системы
- •Разработка и описание алгоритмов
- •Выбор и обоснование программных средств
- •Выбор операционной системы
- •Выбор языка программирования
- •Конструкторско-технологическая часть
- •Разработка пользовательского интерфейса системы
- •Описание контрольного примера
- •Список использованной литературы
- •МодульExponent
- •Модуль Veibulla
- •Модуль Sum_process
Модуль Veibulla
Данный модуль осуществляет расчет основных характеристик распределения Вейбулла
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZedGraph;
namespace Kyrsovoi_erm
{
public class Veibolla
{
private PointPairList flist = new PointPairList();
private Double alpha=1;
private Double betta=1;
// private Double discret;
// private Double ymin = 0;
// private Double ymax = 1;
private PointPairList glist;
private int size = 0;
private int c_count; // количество коридоров
private Double korigor;
private Double xmin ;
private Double xmax;
private Double [] process;
Double[] gistX; // серидины коридоров
public Double[] getProcess()
{
return process;
}
public void Set_alpha_betta(Double a,Double b)
{
alpha = a;
betta = b;
}
public void Analise_process(Double[] p)
{
process = new Double[p.Length];
xmax = process[0];
xmin = process[0];
process = p;
size = p.Length;
// c_count = c;
for (int i = 0; i < process.Length; i++)
{
if (process[i] < xmin)
{
xmin = process[i];
}
if (process[i] > xmax)
{
xmax = process[i];
}
}
}
public PointPairList Calculate_Veobulla_func_from_file()
{
//process_sort = new Double[size];
double x;
double y_res;
flist.Clear();
for (int i = 0; i < size; i++)
{
x = process[i];
y_res = f_veib(x);
flist.Add(x, y_res);
}
flist.Sort();
return flist;
}
public bool glistIsEmpty()
{
if (glist == null)
return true;
return false;
}
public bool flistIsEmpty()
{
if (flist.Count == 0)
return true;
return false;
}
public int getflistCount()
{
return flist.Count();
}
public PointPairList getGlist()
{
return glist;
}
/* public Double getDiscret()
{
return discret;
}
* */
public PointPairList getFlist()
{
return flist;
}
public void update(Double a, Double b, int s)
{
alpha = a;
betta = b;
size = s;
// discret = d;
}
public PointPairList Calculate_Veibolla_func(Double a, Double b, int s)
{
process = new Double [s];
Random r = new Random();
double y;
double x_res;
update(a,b,s);
flist.Clear();
y = r.NextDouble();
x_res = f_veib_r(a,b,y);
process[0] = x_res;
xmax = x_res;
xmin = x_res;
flist.Add(x_res, y);
// Сохраняем значения в объекте класса
/* for (double y = ymin; y < ymax; y += d)
{
x_res = f_veib(a,b,y);
// добавим в список точку
flist.Add(x_res,y);
if (x_res > xmax)
xmax = x_res;
}*/
for (int i = 1; i < size; i++)
{
y = r.NextDouble();
x_res = f_veib_r(a,b,y);
// добавим в список точку
flist.Add(x_res, y);
process[i] = x_res;
if (x_res > xmax)
{
xmax = x_res;
// ymax2 = y;
}
if (x_res < xmin)
{
xmin = x_res;
// ymax2 = y;
}
}
flist.Sort();
return flist;
}
private double f_veib(Double x)
{
if (x == 0)
{
return 0;
}
return 1-Math.Exp(-betta*Math.Pow(x,alpha));
}
private double f_veib_r(Double a, Double b, Double y)
{
if (y == 0)
{
return 0;
}
return Math.Pow(-1 / b * Math.Log(1 - y, Math.E), 1/a); //(-1 / Double.Parse(textBox1.Text)) * (Math.Log((1 - y), Math.E));
}
private double f_veib_densitY(double x)
{
if (x < 0)
{
return 0;
}
else
{
return alpha *betta* Math.Pow(x, (alpha - 1))*Math.Pow(Math.E,(-betta*Math.Pow(x,alpha)));
}
}
public PointPairList Calculate_theoretical_density()
{
PointPairList list = new PointPairList();
Double y;
Double x;
Double sum = 0;
for (int i = 0; i < c_count; i++)
{
x = gistX[i];
y = f_veib_densitY(x);
sum += y;
//list.Add(x,y);
}
for (int i = 0; i < c_count; i++)
{
x = gistX[i];
y = f_veib_densitY(x);
list.Add(x, y / sum);
}
return list;
}
public Double getxmin()
{
return xmin;
}
public Double getxmax()
{
return xmax;
}
public PointPairList Calculate_gist(int c_c)
{
c_count = c_c;
Double [] gistY = new Double[c_c];
gistX = new Double[c_c];
korigor = (xmax - xmin) / c_c; //ширина коридора
//Считаем середину для каждого столбика гистограммы
int h = 0;
for (Double i = xmin+korigor/2; i < xmax; i +=korigor)
{
gistX[h] = i;
h++;
}
int j;
for (int i = 0; i < size; i++)
{
j = (int)(((process[i]) - xmin) / korigor);
if ((((process[i]) - xmin) % korigor != 0) && ((process[i]) != xmax))
{
gistY[j] = gistY[j] + 1;
}
else
{
if (((process[i]) != xmax) && ((process[i]) != xmin))
{
gistY[j - 1] = gistY[j - 1] + 1/2;
gistY[j] = gistY[j] + 1/2;
}
else
{
if ((process[i]) == xmax)
gistY[j - 1] = gistY[j - 1] + 1;
if ((process[i]) == xmin)
gistY[j] = gistY[j] + 1;
}
}
}
Double temp=0;
for (int i = 0; i < c_c; i++)
{
gistY[i] = gistY[i] / size;
temp += gistY[i];
}
temp = temp * korigor;
glist = new PointPairList(gistX, gistY);
return glist;
}
}
}
