1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
|
interface
uses
Classes, SysUtils, FileUtil, TAGraph, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, Buttons, Grids;
type
{ TForm1 }
TForm1 = class(TForm)
BitBtn1: TBitBtn;
BU_EVA: TButton;
Chart1: TChart;
ED_L: TEdit;
GroupBox1: TGroupBox;
Image1: TImage;
Label1: TLabel;
Panel1: TPanel;
SG_Erg: TStringGrid;
procedure BU_EVAClick(Sender: TObject);
procedure ED_LExit(Sender: TObject);
procedure FormClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses GUI_Unit_xyChart; // !!!!!!!!!!!!!!! WICHTIG !!!!!!!!!!!!!!!!!!
{ TForm1 }
//Deklarationsteil (global)
//Konstanten
const
n_d = 5; //Berechnung für 5 Durchmesser;
var
x, y : SingleArray1_5x1_400; // Durchmesser = x (mm) und Knickkräfte = y (N)
Leg : StringArray1_5; // Legende zum Chart
//Initialisierte Variablen
E : Integer = 210000; //Elastizitätsmodul für Stahl in N/mm²
//Prozedur zum Löschen des Ausgabeobjekte
Procedure Ausgabeobjekte_leeren;
begin
//StringGrid SG_Erg leeren
Form1.SG_Erg.Clear;
//Diagramm leeren
xyChart(Form1.Chart1,x,y,0,0,'','','', Leg, False);
end; //Ende der Prozedur "Ausgabeobjekte_leeren"
//Prozedur für Aussehen des Formulares aus Bedienersicht
procedure TForm1.FormCreate(Sender: TObject);
begin
//Überschrift für Formular
Form1.Caption := 'Berechnung von Knickkräften';
//Testdaten festlegen
ED_L.Text := '1000';
//Name für Button BU_EVA
BU_EVA.Caption := 'Berechnen';
//Ausgabeobjekte löschen
Ausgabeobjekte_leeren; //Aufruf der Prozedur "Ausgabeobjekte_leeren"
end; //Ende der Prozedur FormCreate
//Prozdur zur Plausibiltätsprüfung
procedure TForm1.ED_LExit(Sender: TObject);
var
L : Single; //Variable für Trägerlänge L in mm
begin
try
L := StrToFloat(ED_L.Text); //Eingabe in Edit-Feld ED_L
Except
ED_L.SetFocus; //Cursor in ED_L setzen
Raise; //Automatische Fehlermeldung veranlassen
end; //Ende try..except
if (L < 1) or (L > 8000)
Then Begin
ShowMessage(ED_L.Text + ' liegt nicht im erlaubten Wertebereich!');
ED_L.Text := '';
ED_L.SetFocus;
end; //Ende if
end; //Ende der Prozedur ED_LExit
//Berechnet die Knickkräfte und gibt sie aus
procedure TForm1.BU_EVAClick(Sender: TObject);
//Variablen deklarieren
var
L, //Trägerlänge in mm
I_a, //axiales Flächenträgheitsmoment in mm^4
d, //Stabdurchmesser
l_k : Single; //freie Knicklänge
F_k : Array [1..n_d, 1..4] of Single; //Eulersche Knickkraft für die
//5 Durchmesser und 4 Lastfälle
dd : Array [1..n_d] of Single; //Zwischenspeicher für die Durchmesser
Lastfall : Byte; //Lastfall 1, 2, 3 oder 4
i_d, i : Integer; //Zählvariable für for-Schleife
begin
//Eingabe
L := StrToFloat(ED_L.Text);
//---------------------------------------------------------------------
//Verarbeitung
d := 0;
//Zählschleife 1 für Durchmesser
for i_d := 1 to n_d do
begin
d := d + 12;
dd[i_d] := d; //Durchmesser zwischenspeichern
I_a := (pi / 64)*(d*d*d*d);
//Zählschleife 2 für Lastfälle
for Lastfall := 1 to 4 do
begin
case Lastfall of
1: l_k := 2*L;
2: l_k := L;
3: l_k := 0.7*L;
4: l_k := 0.5*L;
end; //Ende case
F_k[i_d, Lastfall] := ((pi*pi)*E*I_a)/(l_k * l_k);
end; //Ende for-Schleife 2
end; //Ende for-Schleife 1
//----------------------------------------------------------------------
//Ausgabe
//Ausgabe in StringGrid SG_Erg
//StringGrid initialisieren
SG_Erg.ColCount := 5; // Spaltenanzahl (Durchmesser und 4 Lastfälle)
SG_Erg.FixedRows := 1; // 1 Fixierte Kopfzeilen
SG_Erg.RowCount := n_d + 1;// Zeilenanzahl (Kopf + n_d)
SG_Erg.DefaultColWidth := 80; // Spaltenbreite in Pixel
SG_Erg.Color := clYellow; // Hauptfalbe: Gelb
SG_Erg.AlternateColor := clLime; // Zweitfarbe: Limone
//Spaltenköpfe
SG_Erg.Cells[0,0] := Format('%10s',['d in mm']); //1. Spalte, 0. Zeile
SG_Erg.Cells[1,0] := Format('%10s',['Lastfall 1']); //2. Spalte, 0. Zeile
SG_Erg.Cells[2,0] := Format('%10s',['Lastfall 2']); //3. Spalte, 0. Zeile
SG_Erg.Cells[3,0] := Format('%10s',['Lastfall 3']); //4. Spalte, 0. Zeile
SG_Erg.Cells[4,0] := Format('%10s',['Lastfall 4']); //5. Spalte, 0. Zeile
//errechnete Werte ausgeben
for i_d := 1 to n_d do
begin
SG_Erg.Cells[0, i] := Format('%10.2f', [dd[i_d]] ); //1. Spalte, schreibt alle Durchmesser rein
end; //Ende for-Schleife
end; //Ende Prozedur BU_EVAClick
// Löscht nach einem Klick in Objekte zur Dateneingabe alle Ausgabedaten
procedure TForm1.FormClick(Sender: TObject);
begin
Ausgabeobjekte_leeren; //Aufruf der Prozedur "Ausgabeobjekte leeren"
end; //Ende Prozedur FormClick
end. //Ende Programm
|