Расчет динамики разгона судна.




Рис 1. Линейная аппроксимация полиномом 1й степени

 

Программа аппроксимации (методом наименьших квадратов), находим полиномы первой степени:

 

# include <iostream.h>

# include <math.h>

# include <fstream.h>

 

void main ()

{int i;

double x[16],y[16],b,a,s1,s2,s3,s4;

 

ifstream out;

out.open ("data_R.txt");

for (i=0;i<=15; i++)

{out>>x[i];}

for (i=0;i<=15;i++)

{out>>y[i];}

out.close ();

 

s1=s2=s3=s4=0;

 

for(i=0;i<=15;i++)

{s1=s1+x[i];

s2=s2+y[i];

s3=s3+pow(x[i],2);

s4=s4+x[i]*y[i];}

 

cout<<"s1="<<s1<<endl;

cout<<"s2="<<s2<<endl;

cout<<"s3="<<s3<<endl;

cout<<"s4="<<s4<<endl;

b=(s2*s3-s1*s4)/(16*s3-pow(s1,2));

a=(s4-s1*b)/s3;

cout<<endl;

cout<<"Function P(V):y="<<a<<"x+"<<b<<endl;

cout<<endl;}

 

T(V):y=- 1619.1*x+64675

R(V):y= 3160.4*x+1110.3

 

Определение стационарной скорости.

Для нахождения интервала изоляции используем шаговый метод:

 

#include <iostream.h>

#include <math.h>

double f(double x)

{return (- 1619.1*x+64675)-(3160.4*x+1110.3);}

void main ()

{

double a,h;

a=0;

h=1;

while (f(a)*f(a+h)>0)

{a=a+h;}

cout<<"interval ot "<<a<<" do "<<a+h<<endl;}

Интервал от 19 до 20

 

Находим стационарную скорость с помощью метода половинного деления:

 

# include <iostream.h>

# include <math.h>

 

double f (double x)

 

{return(- 1619.1*x+64675)-(3160.4*x+1110.3);}

 

void main ()

{ double a,b,c,e;

a=19;

b=20;

e=0.001;

c=(a+b)/2;

while (fabs(f(c))>e)

 

{cout<<c<<endl;

if (f(a)*f(c)<=0)

{b=c;}

else

{a=c;}

c=(a+b)/2;}

 

cout<<"x="<<c<<endl;}

Стационарная скорость Vст=19.5795 м/с

 

 

Определение времени разгона осуществляется методом трапеций:

 

#include <iostream.h>

#include <math.h>

double f(double x)

{return (52900/((- 1619.1*x+64675)-(3160.4*x+1110.3)));}

void main ()

{double t,a,h,b;

a=0;

b=19.5795;

t=0;

h=0.001;

while (a<b)

{t=t+h*((f(a)+f(a+h))/2);

a=a+h;}

cout<<"vremya razgona = "<<t<<endl;}

Время разгона t=134 с

 

 

Путь разгона находим методом Эйлера:

 

#include <iostream.h>

#include <math.h>

#include <fstream.h>

 

void main ()

{ double t,s,v,b,h,k;

{ofstream onstr1;

ofstream onstr2;

ofstream onstr3;

onstr1.open("data1.txt");

onstr2.open("data2.txt");

onstr3.open("data3.txt");

b=134;

h=b/100;

k=0;

v=0;s=0;

t=0;

while (t<=b)

{v=v+h*(((- 1619.1*x+64675)-(3160.4*x+1110.3))/52900);

s=s+v*h;

t=t+h;

k=k++;

onstr1<<" "<<t<<endl;

onstr2<<" "<<v<<endl;

onstr3<<" "<<s<<endl;}

onstr1.close();

onstr2.close();

onstr3.close();}

cout<<"k="<<k<<endl;}

Время Скорость Путь разгона
1.34 2.68 4.02 5.36 6.7 8.04 9.38 10.72 12.06 13.4 14.74 16.08 17.42 18.76 20.1 21.44 22.78 24.12 25.46 26.8 28.14 29.48 30.82 32.16 33.5 34.84 36.18 37.52 38.86 40.2 41.54 42.88 44.22 45.56 46.9 48.24 49.58 50.92 52.26 53.6 54.94 56.28 57.62 58.96 60.3 61.64 62.98 64.32 65.66 68.34 69.68 71.02 72.36 73.7 75.04 76.38 77.72 79.06 80.4 81.74 83.08 84.42 85.76 87.1 88.44 89.78 91.12 92.46 93.8 95.14 96.48 97.82 99.16 100.5 101.84 103.18 104.52 105.86 107.2 108.54 109.88 111.22 112.56 113.9 115.24 116.58 117.92 119.26 120.6 121.94 123.28 124.62 125.96 127.3 128.64 129.98 131.32 132.66 2.06906 3.91947 5.57435 7.05434 8.37794 9.56166 10.6203 11.5671 12.4138 13.171 13.8482 14.4539 14.9955 15.48 15.9132 16.3006 16.6471 16.957 17.2341 17.482 17.7036 17.9019 18.0792 18.2377 18.3795 18.5063 18.6197 18.7212 18.8119 18.893 18.9655 19.0304 19.0885 19.1404 19.1868 19.2283 19.2654 19.2986 19.3283 19.3548 19.3786 19.3998 19.4188 19.4358 19.451 19.4646 19.4767 19.4876 19.4973 19.506 19.5138 19.5207 19.5269 19.5325 19.5375 19.5419 19.5459 19.5494 19.5526 19.5555 19.558 19.5603 19.5623 19.5641 19.5658 19.5672 19.5685 19.5697 19.5707 19.5717 19.5725 19.5732 19.5739 19.5745 19.575 19.5755 19.5759 19.5763 19.5767 19.577 19.5772 19.5775 19.5777 19.5779 19.5781 19.5782 19.5784 19.5785 19.5786 19.5787 19.5788 19.5789 19.5789 19.579 19.5791 19.5791 19.5792 19.5792 19.5792 19.5793 2.77254 8.02464 15.4943 24.9471 36.1735 48.9861 63.2173 78.7172 95.3517 113.001 131.557 150.926 171.02 191.763 213.086 234.929 257.236 279.959 303.053 326.478 350.201 374.19 398.416 422.854 447.483 472.281 497.232 522.318 547.526 572.843 598.257 623.757 649.336 674.984 700.694 726.46 752.276 778.136 804.036 829.971 855.939 881.934 907.955 933.999 960.064 986.146 1012.25 1038.36 1064.48 1090.62 1116.77 1142.93 1169.1 1195.27 1221.45 1247.64 1273.83 1300.02 1326.22 1352.43 1378.64 1404.85 1431.06 1457.28 1483.49 1509.71 1535.94 1562.16 1588.38 1614.61 1640.84 1667.07 1693.29 1719.52 1745.75 1771.99 1798.22 1824.45 1850.68 1876.92 1903.15 1929.38 1955.62 1981.85 2008.09 2034.32 2060.56 2086.79 2113.03 2139.26 2165.5 2191.73 2217.97 2244.2 2270.44 2296.68 2322.91 2349.15 2375.38 2401.62

Рис 2. График зависимости V(t)

Рис 3. График зависимости S(t)

 

Вывод

Судно выходит на стационарную скорость 19.5795 м/с за 134 секунды, пройдя при этом 2402 метров.

 


 

 

Аппроксимация для метода Эйлера:

# include <iostream.h>

# include <math.h>

# include <fstream.h>

 

void main ()

{int i;

double x[100],y[100],b,a,s1,s2,s3,s4;

 

ifstream out;

out.open ("data.txt");

for (i=0;i<=99; i++)

{out>>x[i];}

for (i=0;i<=99;i++)

{out>>y[i];}

out.close ();

 

s1=s2=s3=s4=0;

 

for(i=0;i<=100;i++)

{s1=s1+x[i];

s2=s2+y[i];

s3=s3+pow(x[i],2);

s4=s4+x[i]*y[i];}

 

cout<<"s1="<<s1<<endl;

cout<<"s2="<<s2<<endl;

cout<<"s3="<<s3<<endl;

cout<<"s4="<<s4<<endl;

b=(s2*s3-s1*s4)/(100*s3-pow(s1,2));

a=(s4-s1*b)/s3;

cout<<endl;

cout<<"V(t):y="<<a<<"x+"<<b<<endl;

cout<<endl;}

V(t)=0.060296*x+13.8557

 

Кинетическую энергию разгона вычисляем методом правых прямоугольников:

#include <iostream.h>

#include <math.h>

double f(double x)

{return (0.060296*x+13.8557);}

 

void main ()

{

double e,a,b,S,h;

a=0,e=0.001, b=134, h=b/20;

S=f(a+h)*h;

do

{S=S+f(a+2*h)*h;

 

 

a=h+a;

}

while ((a+h)<b);

cout<<"E="<<S*25300<<endl;

}

Кинетическая энергия разгона равна 61453200 Дж

 


 

 

Модельная задача №2



Поделиться:




Поиск по сайту

©2015-2024 poisk-ru.ru
Все права принадлежать их авторам. Данный сайт не претендует на авторства, а предоставляет бесплатное использование.
Дата создания страницы: 2016-04-12 Нарушение авторских прав и Нарушение персональных данных


Поиск по сайту: