1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Công nghệ bôi trơn Lập trình mô phỏng áp suất ổ đỡ bằng phương pháp số

5 143 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 61,04 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

‐‐‐‐ This following program solves Reynolds equation for the bearings ‐‐‐‐‐‐‐‐‐‐‐ by the numerical method to determine its quantities ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ Chương trình sau giải phương trình Reynold viết cho ổ đỡ ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ bằng phương pháp số để xác định các đại lượng làm việc của ổ ‐‐

Trang 1

Simulation Program.cpp // Họ và tên: Đặng Xuân Hải

// MSSV: 20131217

// Mã lớp: 98135

// Học phần: Công nghệ bôi trơn ‐ ME4972

// Ngày thi: 28/12/2017

#include <stdio.h>

#include <conio.h>

#include <math.h>

//‐‐‐‐ This following program solves Reynold's equation for the bearings ‐‐

//‐‐‐‐‐‐‐‐‐ by the numerical method to determine its quantities ‐‐‐‐‐‐‐‐‐‐‐

//‐‐‐‐‐ Chương trình sau giải phương trình Reynold viết cho ổ đỡ ‐‐‐‐‐‐‐‐‐‐

//‐‐‐‐‐‐‐‐‐ bằng phương pháp số để xác định các đại lượng làm việc của ổ ‐‐

main(void) {

int i,j,x,m,n,dem=1;

float c,L,exp,R; //input

float a1,a2,a3,dh,theta,l,k,H;

float A1,B,C,D,s,a; //các biến tính ma trận áp suất

char tieptuc; //lap lai chuong trinh

float coxi, muy, N1,N2,N3,N4,w=0; float W; //các biến tính khả năng tải float A[300][301]; //ma tran he so

float P[50][50]; //ma tran ap suat

float pg[4]; //ap suat tai cac diem Gauss

float h[50][50], h1[50][50], h2[50][50], h1g[4], h2g[4]; //h matrix

float hs;//h min

float I1=0,I2=0; //Numerical Intergration

float Ca; //frictional moment

float omega, Muy; int speed; //Các thông số làm việc của ổ và dầu bôi trơn const float pi=3.141593;

//Main Prog

printf("‐‐Chuong trinh tinh ma tran ap suat cua o do va kha nang tai‐‐"); while(1) {

printf("\n\nLan chay thu %d!",dem); dem++;

printf("\nHay nhap cac thong so dau vao cua o do!");

//Input

printf("\nNhap chieu dai o L(mm)= "); scanf("%f",&L);

printf("Nhap ban kinh o R(mm)= "); scanf("%f", &R);

printf("Nhap khe ho ban kinh C(mm)= "); scanf("%f",&c);

printf("Nhap do lech tam tuong doi epsilon= "); scanf("%f",&exp);

printf("Nhap so khoang chia chieu dai n= "); scanf("%d",&n);

printf("Nhap so khoang chia chu vi m= "); scanf("%d", &m);

c=c/1000; R=R/1000; L=L/1000; //đổi đơn vị sang mét

Trang 2

//Set unchange variable

k=2*pi/(m+1); l=1./(n+1); a1=1/(k*k);

//Tính các hệ số của hệ

for(j=1;j<n+1;j++)

 for(i=1;i<m+1;i++) {

//tính các đại lượng cơ bản   theta=2*pi*i/(m+1); dh=‐exp*sin(theta); H=1+exp*cos(theta); 

//Tính các đại lượng trung gian   a2=3*dh/(2*k*H); a3=(1/(l*l))*(R/L)*(R/L); 

//tính các hệ số của hệ   A1=(a1‐a2)/(a1+a3); B=(a1+a2)/(a1+a3); 

C=a3/(a1+a3); D=dh/((H*H*H)*(a1+a3));

//Gán vào ma trận hệ số A A[(j‐1)*m+i‐1][(j‐1)*m+i‐1]=‐2;

if (i!=1) A[(j‐1)*m+i‐1][(j‐1)*m+i‐2]=A1;

if (i!=m) A[(j‐1)*m+i‐1][(j‐1)*m+i]=B; 

    else A[(j‐1)*m+i‐1][(j‐1)*m+i]=0; //set point on boundary of 0

if (j!=n) A[(j‐1)*m+i‐1][j*m+i‐1]=C; 

    else A[(j‐1)*m+i‐1][j*m+i‐1]=0;

if (j!=1) A[(j‐1)*m+i‐1][(j‐2)*m+i‐1]=C;

A[(j‐1)*m+i‐1][m*n]=D;

 }

printf("\n"); //Enter

printf("\nMa tran ap suat khong thu nguyen:");

//Solve this equal system by Gauss Algorithm

for (i=0;i<(m*n);i++)

{

s=A[i][i];

for (j=0;j<(m*n+1);j++)  A[i][j]=A[i][j]/s;

for (j=0;j<m*n;j++) {

 if (j!=i) {

  for (x=0;x<(m*n+1);x++)    A[j][x]=A[j][x]‐a*A[i][x]; }

Trang 3

Simulation Program.cpp }

//The answer of the above equal system is A[i][m*n], set i=0‐>m*n‐1

//Build Pressure Matrix

for (j=1;j<n+1;j++) {

for (i=1;i<m+1;i++) {

P[j][i]=A[(j‐1)*m+i‐1][m*n];

} }

//Print out the Pressure matrix (boundary = 0)

for (j=0; j<n+2;j++) {

for (i=0;i<m+2;i++) {

printf(" %f",P[j][i]);

} printf("\n");

}

printf("\n\n"); //Enter

//Chapter II: Calculate Load Capability

for (j=0;j<n+1;j++) {

for (i=0;i<m+1;i++) {

for (x=0;x<4;x++) {    switch(x+1) {        case 1: coxi=‐1/sqrt(3); muy=‐1/sqrt(3);

   case 2: coxi=1/sqrt(3); muy=‐1/sqrt(3);

   case 3: coxi=1/sqrt(3); muy=1/sqrt(3);

   case 4: coxi=‐1/sqrt(3); muy=1/sqrt(3);

   N1=0.25*(1‐coxi)*(1‐muy);

   N2=0.25*(1+coxi)*(1‐muy);

   N3=0.25*(1+coxi)*(1+muy);

   N4=0.25*(1‐coxi)*(1+muy);

   pg[x]=N1*P[j][i]+N2*P[j][i+1]+N3*P[j+1][i+1]

+N4*P[j+1][i];

//Specify the Numerical Intergration of Load

if (pg[x]>0) w+=pg[x]; }  }

} }

w=k*l*w/4; //tính tải không thứ nguyên

printf(" Kha nang tai khong thu nguyen W= %.2f",w);

Trang 4

//Nhập các thông số làm việc

//Input

printf("\n\nHay nhap cac thong so lam viec!");

printf("\nDo nhot dong luc hoc cua dau boi tron Muy: "); scanf("%f",&Muy); printf("Toc do lam viec cua o (vong/phut):"); scanf("%d",&speed);

//Xây dựng ma trận h,h1,h2

for (j=0;j<=n+1;j++) {

for (i=0;i<=m+1;i++) {

theta=2*pi*i/(m+1);

h[j][i]=c*(1+exp*cos(theta));

h1[j][i]=1/h[j][i];

h2[j][i]=1/(h[j][i]*h[j][i]);

} }

//Tính tích phân số I1,I2

for (j=0;j<n+1;j++) {

for (i=0;i<m+1;i++) {

for (x=0;x<4;x++) {    switch(x+1) {        case 1: coxi=‐1/sqrt(3); muy=‐1/sqrt(3);

   case 2: coxi=1/sqrt(3); muy=‐1/sqrt(3);

       case 3: coxi=1/sqrt(3); muy=1/sqrt(3);

   case 4: coxi=‐1/sqrt(3); muy=1/sqrt(3);

   N1=0.25*(1‐coxi)*(1‐muy);

   N2=0.25*(1+coxi)*(1‐muy);

      N3=0.25*(1+coxi)*(1+muy);

   N4=0.25*(1‐coxi)*(1+muy);

   h1g[x]=N1*h1[j][i]+N2*h1[j][i+1]+N3*h1[j+1][i+1]

      +N4*h1[j+1][i];

   h2g[x]=N1*h2[j][i]+N2*h2[j][i+1]+N3*h2[j+1][i+1]

  +N4*h2[j+1][i];

   if (i<(m+1)/2) I1+=h1g[x]; //Tính tích phân số Gauss

   if (i>=(m+1)/2) I2+=h2g[x]; } }

} }

//Tính omega (rad/s)

omega=speed*pi/30;

printf("omega= %f",omega);

Trang 5

Simulation Program.cpp hs=c*(1+exp*cos(pi));

//Tính tải có thứ nguyên

W=w*6*Muy*omega*(R/c)*(R/c)*(R*L);

printf("\nTai co thu nguyen W= %f",W);

//Tính moment ma sát

Ca=exp*c*W*sin(70*pi/180)/2+Muy*omega*R*R*R*k*l*(I1+hs*I2)*R*L/4; printf("\nMomen ma sat cua o Ca= %f", Ca);  fflush(stdin);

printf("\n Nhap 1 de tiep tuc, bam phim bat ky de thoat: ");  scanf("%c",&tieptuc);

if (tieptuc=='1') continue; else break;

 } //end while

return(0);

} //end Prog

Ngày đăng: 13/01/2019, 18:50

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm

w