unit unit1_solarzelle;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Borland.Vcl.Grids, System.ComponentModel, Borland.Vcl.StdCtrls,
Borland.Vcl.ExtCtrls;
type
TForm1 =
class(TForm)
StringGrid1: TStringGrid;
Panel1_Ueberschrift: TPanel;
Panel2_Beleuchtungsstaerke: TPanel;
Edit1_Eingabe_lx: TEdit;
Button1_Speichern: TButton;
Button2_Laden: TButton;
Button3_Leeren: TButton;
Button4_Berechne_P: TButton;
Button5_Beende: TButton;
Label1_Optimum: TLabel;
Edit2_Optimum: TEdit;
StringGrid2: TStringGrid;
Edit3_Eingabe_n: TEdit;
Label2_Anzahl_Messwerte: TLabel;
procedure Button4_Berechne_PClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button5_BeendeClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.nfm}
procedure TForm1.Button5_BeendeClick(Sender: TObject);
begin
close
end;
procedure TForm1.FormCreate (Sender: TObject);
var i,n: smallInt;
begin
StringGrid1.Cells[0,0]:='
Nr.';
StringGrid1.Cells[1,0]:='
Spannung U';
StringGrid1.Cells[2,0]:='
Stromstärke I';
StringGrid2.Cells[0,0]:='
Leistung P';
{StringGrid1.RowCount:=n+1; }
for i:=1
to 9
do
StringGrid1.Cells[0,i]:=IntToStr(i)+'
.';
with StringGrid1
do
begin
ColWidths[0]:= 28;
ColWidths[1]:= 110;
ColWidths[2]:= 110;
end;
end;
procedure TForm1.Button4_Berechne_PClick(Sender: TObject);
var
j: integer;
{Lauf-Variablen zum Berechnen}
leistung: double;
u,i:
array [1..9]
of double;
begin
for j:=1
to 9
do
begin
u[j]:=StrToFloat(StringGrid1.Cells[1,j]);
i[j]:=StrToFloat(StringGrid1.Cells[2,j]);
end;
for j:=1
to 9
do
with StringGrid2
do {Ausgabe der berechneten Leistung}
begin
leistung:= u[j]* i[j];
Cells[0,j]:= FloatToStr(leistung);
end;
end;
end.