152
Apêndice E
Listagens dos programas
E.1. Programa para Análise de Amplificadores de RF
//Codigo da Unit UMain
unit Main;
interface
uses
Windows, Messages, SysUtils, math,
Variants, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls,
TeeProcs, TeEngine, Chart, Series,
TeeFunci, Buttons, JvEdit, JvTypedEdit,
JvLabel, ToolWin, JvScrollPanel,
Menus, JvxAnimate, JvGIFCtrl, ufun-
cao, ComCtrls, ImgList, JvTool-
Bar,USinal, JvSpeedButton, shellApi,
JvSpecialLabel, Mask, ARWordReport;
type
TFrmApl = class(TForm)
MainMenu1: TMainMenu;
Main1: TMenuItem;
Config1: TMenuItem;
PnlF1: TPanel;
Panel4: TPanel;
PnlF2: TPanel;
Panel2: TPanel;
BitBtn1: TBitBtn;
BtnReset: TBitBtn;
BitBtn3: TBitBtn;
BitBtn2: TBitBtn;
Button1: TBitBtn;
EdtYh: TEdit;
EdtYi: TEdit;
EdtX: TEdit;
JvScrollingWindow2: TJvScrolling-
Window;
GroupBox1: TGroupBox;
Sinal6: TJvLabel;
Label1: TLabel;
Sinal5: TJvLabel;
Label2: TLabel;
Sinal4: TJvLabel;
Label3: TLabel;
Sinal3: TJvLabel;
Label4: TLabel;
Sinal2: TJvLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Chart1: TChart;
Series11: TLineSeries;
Series12: TLineSeries;
Series1: TLineSeries;
TeeFunction1: TAddTeeFunction;
Series2: TLineSeries;
Series3: TLineSeries;
Series4: TLineSeries;
Label13: TLabel;
Label16: TLabel;
BackGround1: TMenuItem;
Panel1: TPanel;
Panel3: TPanel;
JvToolBar1: TJvToolBar;
ToolButton2: TToolButton;
JvSpeedButton1: TJvSpeedButton;
JvSpeedButton2: TJvSpeedButton;
ToolButton1: TToolButton;
Panel5: TPanel;
ProgressBar1: TProgressBar;
Panel6: TPanel;
ARWordReport1: TARWordReport;
procedure Button1Click(Sender: TOb-
ject);
procedure Sinal1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure PlotaEixo();
procedure k1KeyDown(Sender: Tobject;
var Key: Word;
Shift: TShiftState);
procedure BtnResetClick(Sender: Tob-
ject);
procedure k4Change(Sender: TObject);
procedure JvScrollingWin-
dow2Scrolled(Sender: TObject;
Kind: TJvScrollKind);
procedure FormCreate(Sender: Tobject);
procedure Button2Click(Sender: TOb-
ject);
procedure BitBtn1Click(Sender: Tob-
ject);
procedure JvSpeedButton2Click(Sender:
TObject);
procedure BackGround1Click(Sender:
TObject);
procedure BitBtn3Click(Sender: TOb-
ject);
procedure Main1Click(Sender: Tobject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmApl: TFrmApl;
K : array[1..7] of TJvFloatEdit2;
implementation
uses UConfig, UAbout, UBackGround,
UFreq;
{$R *.dfm}
procedure
TFrmApl.Button1Click(Sender: Tob-
ject);
var
Achou : Boolean;
po5 := po4*x/400;
po6 := po5*x/400;
po7 := po6*x/400;
R := k[1].Value*po1 +
K[2].Value*po2 + K[3].Value*po3 +
K[4].Value*po4 + K[5].Value*po5 +
K[6].Value*po6 + k[7].Value*po7;
Chart1.Series[2].AddXY(x/400,r,'',clteec
olor);
Chart1.Series[3].AddXY(x/400,k[1].Val
Value*po1,'',clteecolor);
ProgressBar1.Position := Pro-
gressBar1.Position + 1;
RealPoint := Se-
ries1.GetMarkValue(x+6000);
LinearPoint := Se-
ries2.GetMarkValue(x+6000);
if (RealPoint<>0) then
Begin
RealValue :=
20*Log10(Abs(RealPoint));
end;
if ((LinearPoint<>0) and
(LinearPoint<> -0)) then
Begin
LinearValue :=
20*Log10(Abs(LinearPoint));
if (LinearValue-1 > RealValue)
and (Achou = false) and (X>=0) then
Begin
Ya := LinearPoint;
Yb := LinearPointAux;
Xa := (x/400);
Xb := (x-1)/400;
if(Abs(xa-xb)>abs(ya-
yb))then
Begin
Xx := (Xa-Xb)/2 + Xb;
Yx := ((Ya-Yb)*(Xx-
Xb)/(Xa-Xb))+Yb
end
else
Begin
Yx := (Ya-Yb)/2 + Yb;
Xx := ((Yx-Yb)*(Xa-
Xb)/(Ya-Yb))+Xb;
end;
LinearPointInter := Yx;
EdtYh.Text := 'Yh
'+FloattoStr(LinearPointInter);
//Interpolaçao para A curva
RealRealPoinInteger
Ya := RealPoint;
Yb := RealPointAux;