Download presentation

Presentation is loading. Please wait.

Published bySara Bullock Modified over 3 years ago

1
FLYWHEEL CALCULATIONS The flywheel design is based on calculating the EXCESS ENERGY. This is achieved when then the CYCLE IS COMPLETE and when you click on the FORCES in the VIEW MENU. Each time you click on the FORCES item the procedure is activated. procedure TMainForm.MenuItem_ForcesClick(Sender: TObject); begin if ThecycleIsComplete(MenuItem_DesignEngineComponents) then CalculateForces(MeanForce,CutAng); end;

2
CalculateForces(MeanForce,CutAng) As you can see, this procedure returns the Mean Tangential Force and the cutting angles CutAng[1] to CutAng[5] or less (more than 5 cuts is not anticipated). These variables are local to the MAIN UNIT so if you want to use them in another unit you should carry their declarations to the INTERFACE section of this unit and your local unit should include “MAIN” in its uses clause. As a bonus the procedure also calculates the Global variable as well. So that’s it ! I’ve done it for you. Now if you are wondering how I did it then here is the algorithm :

3
procedure CalculateForces(var AverageTangentialForce:real; var cutpoint: CutArray); var i,j,cutnumber : Integer; MrW2,Theta,x,y,Sum,x1,x2,y1,y2,y0 : Real; n,k,m : integer; Cross,EndOfCurve,descending : Boolean; c,cb : carray; MinimumValue,mD2,mx,FlywheelMass,D : real; s : string; Volume,Dx : real; begin for i := 1 to 5 do begin c[i] := 0; cb[i] := 0; CutPoint[i] := ''; end; The local arrays are initialized

4
InputReciprocatingMass; i := 1; n := Trunc(NCyl); j := 72 div n; MrW2 := -ReciprocatingMass * sqr(EngineSpeed * PI / 30) * (Stroke/2)/1000; Theta := 0; while Theta <= 720 do begin x := Radian(Theta); y := Arcsin((1/CRRatio)*Sin(x)); GasForce[i] := Fg(Theta); InertiaForce[i] := MrW2 * (Cos(x) + (1/CRRatio) * Cos(2*x)); ResultantForce[i] := GasForce[i]+InertiaForce[i]; TangentialForce[i] := ResultantForce[i]*Sin(x+y)/Cos(y); Theta := Theta + 10; Inc(i); end; The reciprocating mass is calculated The forces are calculated. The Tangengial Forces will be used in our calculations

5
MinimumValue := 0; for i := 1 to j+1 do begin Sum := 0; for k := 1 to n do Sum := Sum + TangentialForce[i+(k-1)*j]; CrankTangentialForce[i] := Sum; if CrankTangentialForce[i]<MinimumValue then MinimumValue := CrankTangentialForce[i]; end; for i := 1 to j+1 do CrankTangentialForce[i] := CrankTangentialForce[i] + 2*MinimumValue; i := 1; Sum := CrankTangentialForce[i]; repeat inc(i); Sum := Sum + 2*CrankTangentialForce[i]; until i=j; Sum := Sum + CrankTangentialForce[j+1]; AverageTangentialForce := Sum/(2*j) - 2*MinimumValue; for i := 1 to j+1 do CrankTangentialForce[i] := CrankTangentialForce[i] - 2*MinimumValue; EndOfCurve := false; The average tangential forces is calculated (This is exported)

6
i := 1; m := 1; if CrankTangentialForce[i]<AverageTangentialForce then descending := false else descending := true; if descending then while i<j+1 do begin Cross := false; repeat inc(i); if CrankTangentialForce[i]<AverageTangentialForce then Cross := true; if i=j+1 then EndOfCurve := true; until Cross or EndOfCurve; The cutting angles of the average tangential force and the varying tangential force are calculated

7
if Cross then begin x1 := (i-2)*10; x2 := (i-1)*10; y1 := CrankTangentialForce[i-1]; y2 := CrankTangentialForce[i]; y0 := AverageTangentialForce; c[m] := x2 - ((y2-y0)/(y2-y1))*(x2-x1); str(c[m]:5:2,s); CutPoint[m] := s; inc(m); end; if i<j+1 then begin Cross := false; repeat inc(i); if CrankTangentialForce[i]>AverageTangentialForce then Cross := true; if i=j+1 then EndOfCurve := true; until Cross or EndOfCurve; The cutting angles of the average tangential force and the varying tangential force are calculated (continued)

8
if Cross then begin x1 := (i-2)*10; x2 := (i-1)*10; y1 := CrankTangentialForce[i-1]; y2 := CrankTangentialForce[i]; y0 := AverageTangentialForce; c[m] := x2 - ((y2-y0)/(y2-y1))*(x2-x1); str(c[m]:5:2,s); CutPoint[m] := s; inc(m); end; end else while i<j+1 do begin Cross := false; repeat inc(i); if CrankTangentialForce[i]>AverageTangentialForce then Cross := true; if i=j+1 then EndOfCurve := true; until Cross or EndOfCurve; The cutting angles of the average tangential force and the varying tangential force are calculated (continued)

9
if Cross then begin x1 := (i-2)*10; x2 := (i-1)*10; y1 := CrankTangentialForce[i-1]; y2 := CrankTangentialForce[i]; y0 := AverageTangentialForce; c[m] := x2 - ((y2-y0)/(y2-y1))*(x2-x1); str(c[m]:5:2,s); CutPoint[m] := s; inc(m); end; if i<j+1 then begin Cross := false; repeat inc(i); if CrankTangentialForce[i]<AverageTangentialForce then Cross := true; if i=j+1 then EndOfCurve := true; until Cross or EndOfCurve; The cutting angles of the average tangential force and the varying tangential force are calculated (continued)

10
if Cross then begin x1 := (i-2)*10; x2 := (i-1)*10; y1 := CrankTangentialForce[i-1]; y2 := CrankTangentialForce[i]; y0 := AverageTangentialForce; c[m] := x2 - ((y2-y0)/(y2-y1))*(x2-x1); str(c[m]:5:2,s); CutPoint[m] := s; inc(m); end; cutnumber := 0; for i := 1 to 5 do if c[i]>0 then begin cb[i] := Int(c[i]/10); inc(cutnumber); end; ExcessEnergy := Integrals(CrankTangentialForce,AverageTangentialForce,c,cb,j,cutnumber); end; The cutting angles of the average tangential force and the varying tangential force are calculated (continued) Each partial tangengial force and their starting and ending angles are transferred to the procedure INTEGRALS, which calculates each integral, compares them and returns the highest value

11
function Integrals(CTF:Forces;AVTF:real;c,cb:carray;numberofpoints,numberofcuts:integer):real; var ri :real; i,j,k,np,np1,np2 : integer; Integral : carray; Sum,LastTri : real; begin c[numberofcuts+1] := numberofpoints*10; cb[numberofcuts+1] := numberofpoints; np := numberofpoints; np2 := np-2; np1 := np-1; for i := 1 to numberofpoints+1 do CTF[i] := CTF[i]-AVTF; i := 1; ri := cb[i]; j := Trunc(ri); if j=0 then begin k := 1; Integral[k] := Abs(CTF[k]*c[k]/2); i := 2;

12
repeat inc(k); Integral[k] := Abs(CTF[i]*((i-1)*10-c[k-1])/2); Sum := CTF[i]; repeat inc(i); Sum := Sum + 2*CTF[i]; until i>=cb[k]; inc(i); Sum := Sum + CTF[i]; LastTri := CTF[i]*(c[k]-(i-1)*10)/2; Sum := Sum*5 + LastTri; Integral[k] := Integral[k] + Abs(Sum); inc(i); until k=numberofcuts+1; end;

13
if ((j>0) and (j<np1)) then begin i := 1; k := 0; repeat inc(k); if k>1 then Integral[k] := Abs(CTF[i]*((i-1)*10-c[k-1])/2) else Integral[k] := 0; Sum := CTF[i]; repeat inc(i); Sum := Sum + 2*CTF[i]; until i>=cb[k]; inc(i); Sum := Sum + CTF[i]; LastTri := CTF[i]*(c[k]-(i-1)*10)/2; Sum := Sum*5 + LastTri; Integral[k] := Integral[k] + Abs(Sum); inc(i); until k=numberofcuts+1; end;

14
if j=np1 then begin end; Sum := 0; for i := 1 to numberofcuts+1 do if Integral[i]>Sum then Sum :=Integral[i]; Integrals := Sum; end;

Similar presentations

OK

A Level Computing#BristolMet Session ObjectivesU2#S10 MUST describe the difference between constants, local and global variables SHOULD explain why constants.

A Level Computing#BristolMet Session ObjectivesU2#S10 MUST describe the difference between constants, local and global variables SHOULD explain why constants.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google