Crest Factor (CF)

Crest factor: the peak amplitude of the waveform divided by the RMS value of the waveform.

1.414 for sine wave.

Advertisements

Fuses vs Circuit Breakers

Fuses must be thrown out and replaced completely when blown.

Circuit Breakers are easily reset if tripped, are the most common form of overload protection found in homes.

Circuit Breakers trip. Fuses blow.

Types:

  • Diazed Fuses
  • NH Fuses
  • Circuit Breakers

Import Type Library in Delphi

Component->Install Component
Import a Type Library
Add unit to Project

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, MyTypeLibrary_TLB;

Note the info:

  SomeInterface = interface(IDispatch)
    procedure SomeProcedure(...); safecall;

Button Event:

procedure TForm1.Button1Click(Sender: TObject);
var
  MyInterface: SomeInterface;
begin
  MyInterface.SomeProcedure(...);
end;

For some class, note the info:

  SomeClass = class
    class function Create: SomeInterface;
    class function SomeFunction(...): SomeInterface;
  end;

Button event:

procedure TForm1.Button1Click(Sender: TObject);
var
  MyInterface: SomeInterface;
begin
  MyInterface:= SomeClass.Create;
end;

Thread in Delphi

Don’t freeze the GUI using a thread.

type
  TMyThread=class(TThread)
  protected
    procedure Execute; override;
  end;

procedure TMyThread.Execute;
var
  ...
begin
  ...
  Form1.Label1.Caption:='Test';
  ...
end;

procedure Form1.Button1Click(Sender: TObject);
begin
  with TMyThread.Create do
    FreeOnTerminate:=True;
end;