required c++ code for pin bushed flexible coupling

yadavundertaker mohit
@yadavundertaker-0p3HBs Oct 19, 2024

please help me

i need c/c++/matlab code for PIN BUSHED FLEXIBLE COUPLING

PLEASE I NEED TO SUBMIT IT REAL SOON
SO IF ANYONE CAN PROVIDE ME THE CODE OR ANY TYPE OF THE HELP

IT WILL BE MOST APPRECIATED

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • yadavundertaker mohit

    @yadavundertaker-0p3HBs Oct 14, 2009

    i finally completed the programming..




    #include<stdio.h>
    #include<conio.h>
    #include<math.h>
    #include<string.h>
    float arr[20];
    float *am(float d1,int d,float T,float pb,float n,float ta)
    {
    int d2,t1,t2,d3,e;
    float a,d0,q,D1,k,F,l,ti,D2,D3,tp,z,M,c,qp,qb,w,t,l1;


    /* Enlarged dia of pin */

    d2=d1+2*3;
    arr[0]=d2;

    t1=2;
    t2=6;
    d3=d2+2*t1+2*t2;
    arr[1]=d3;


    /* STEP 3*/
    D1=1.75*d;
    D1 = abs(D1)+1;


    /* check suitability of hub*/

    k=d/D1;
    k=pow(k,4);
    ti=(16*T)/(3.14*D1*D1*D1);
    ti=ti/(1-k);

    if(ti<ta)
    printf("\n\n\t");
    else
    D1=2*d;

    arr[2]=D1;

    /* PIN CIRCLE DIA*/
    D2=3*d;
    arr[3]=D2;

    /* FORCE PER PIN*/

    F=2*T/(D2*n);
    arr[4]=F;

    /* STEP 4*/

    l=F/(pb*d3);
    l=abs(l)+1;
    arr[5]=l;


    /* SHEAR STRESS IN PIN*/

    tp=(4*F)/(3.14*d1*d1);
    arr[6]=tp;

    /* BENDING MOMENT
    */
    e=4;
    M=F*((l/2)+e);
    arr[7]=M;


    z=(3.14*d1*d1*d1)/32;

    arr[8]=z;
    qb=M/z;
    arr[9]=qb;
    /* PRINCIPAL STRESS IN PIN*/

    c=(qb*qb)+4*(tp*tp);
    qp=.5*(qb+sqrt(c));


    /* KEY DIMENSIONS*/

    w=d/4;
    w=abs(w)+1;
    t=d/6;
    t=abs(t)+1;
    l1=1.5*d;
    l1=abs(l1)+1;
    printf("\n\n\t principle stress in pin =\t%fN/mm2",qp);
    arr[10]=qp;
    printf("\n\n\t n=%f",n);
    printf("\n\n\t d1=\%fmm",d1);
    printf("\n\n\t D1=\%fmm",D1);
    printf("\n\n\t ti=\t%fN/mm2",ti);
    printf("\n\n\t Hub is safe");
    printf("\n\n\t d2=%dmm",d2);
    printf("\n\n\t d3=\t%dmm",d3);
    printf("\n\n\t D2=\t%f",D2);
    printf("\n\n\t Force per pin =\%fN",F);
    printf("\n\n\t l=\%fmm",l);
    printf("\n\n\t shear stress in pin =\t%fN/mm2",tp);
    printf("\n\n\t bending moment =\t%fN-mm",M);
    printf("\n\n\t section modulus =\t%fmm3",z);
    printf("\n\n\t STRESS =\t%fN/mm2",qb);
    printf("\n\n\t width of key =%fmm",w);
    printf("\n\n\t thickness of key =\t%fmm",t);
    printf("\n\n\t length of key =\t%fmm",l1);
    printf("\n\n\n");
    return arr;

    }
    main()
    {
    clrscr();
    float farr[20];
    int d,p,N,b,d2,t1,t2,d3,e,i;
    float T,n,d1,a,d0,pb,ta,q,D1,k,F,l,ti,D2,D3,tp,z,M,c,qp,qb;
    printf("\n\n\t\t DESIGN OF PIN BUSHED FLEXIBLE COUPLING");
    printf("\n\n\n\t enter the dia of pipe to be joined in mm=\t");
    scanf("%d",&d);
    printf("\n\n\t enter the power to be transmitted in kw=\t");
    scanf("%d",&p);
    printf("\n\n\t enter the rpm of the shaft =\t");
    scanf("%d",&N);
    printf("\n\n\t enter the bearing pressure in N/mm2=\t");
    scanf("%f",&pb);
    printf("\n\n\t enter the allowable shear stress in shaft,keys ,flange =\t");
    scanf("%f",&ta);
    printf("\n\n\t enter the allowable stress in pin =\t");
    scanf("%f",&q);

    /* To find the torque*/
    T=(p*60000)/(2*3.14*N);
    T=(T*1000);
    printf("\n\n\t torque produced =\t%fN-mm",T);

    /* Suitability of shaft dia*/
    a=(16*T)/(3.14*ta);
    d0=pow(a,.33333);

    d0=fabs(d0)+1;
    if (d0<d)
    {
    d0=d;
    printf("\n\n\t d0=%fmm",d0);
    }
    else
    printf("\n\n\t Dia is not secure");

    /* No. of pins */
    n=(0.02*d)+5;
    if(abs(n)-n==0)
    i=abs(n);
    else
    {
    n=abs(n)+1;
    i=abs(n)+1;
    }
    if(i%2==0)
    n=n;
    else
    n=n+1;
    printf("\n\n\t no. of pins =\t%f",n);

    /* Pin dia*/
    d1=(0.5*d)/sqrt(n);
    b=abs(d1)+1;
    d1=abs(d1)+1;
    if(b<10)
    printf("\n\n\t The value of d1 is =\t%fmm",d1);
    else {
    if(b%2==0)
    printf("\n\n\t The value of d1 is =\t%fmm",d1);
    else
    {
    d1=d1+1;
    printf("\n\n\t The value of d1 is =\t%dmm",d1);

    }
    }
    qp=0;

    //farr[20] = am(d1,d,T,pb,n,ta);
    memcpy(farr,am(d1,d,T,pb,n,ta),sizeof(am(d1,d,T,pb,n,ta)));
    if (arr[10] > q)
    {
    for(int i=0;arr[10]>q;i++)
    {
    printf("\n\n*********************************************************");
    printf("\n\n*********************************************************");
    printf("\n\n\t ITERATION NO.%d",i+1);
    d1=d1+2;
    memcpy(farr,am(d1,d,T,pb,n,ta),sizeof(am(d1,d,T,pb,n,ta)));

    }
    }
    getch();
    return 0;
    }



    you can enter the values and it will give you the dimensions of the pin bushed coupling...