unit uBiophysics;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, AbNumEdit, PropSaveMain, uNeuronTypes;

type
  TfrmBiophysics = class(TForm)
    gbSpecificUnits: TGroupBox;
    nsMembraneCapSpecific_uFcM2: TAbNumSpin;
    nsMembraneAxialSpecific_OhmcM: TAbNumSpin;
    nsMembraneSpecific_OhmcM2: TAbNumSpin;
    lblRA: TLabel;
    lblCM: TLabel;
    lblRM: TLabel;
    btnDefault: TButton;
    PropSaveMain1: TPropSaveMain;
    lblAppply: TLabel;

    procedure btnDefaultClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure nsMembraneSpecific_OhmcM2ValueChanged(Sender: TObject);
    procedure nsMembraneCapSpecific_uFcM2ValueChanged(Sender: TObject);
    procedure nsMembraneAxialSpecific_OhmcMValueChanged(Sender: TObject);
  private
    { Private declarations }

  public
    { Public declarations }
    MembraneAxialSpecific_OhmcM, MembraneCapSpecific_uFcM2, MembraneSpecific_OhmcM2: Single;
  end;

var
  frmBiophysics: TfrmBiophysics;

implementation

uses Math;

{$R *.dfm}

procedure TfrmBiophysics.FormCreate(Sender: TObject);
begin
  MembraneAxialSpecific_OhmcM := nsMembraneAxialSpecific_OhmcM.Value;
  MembraneCapSpecific_uFcM2 := nsMembraneCapSpecific_uFcM2.Value;
  MembraneSpecific_OhmcM2 := nsMembraneSpecific_OhmcM2.Value;
end;

procedure TfrmBiophysics.nsMembraneAxialSpecific_OhmcMValueChanged(Sender: TObject);
begin
  MembraneAxialSpecific_OhmcM := nsMembraneAxialSpecific_OhmcM.ValueAsSingle;
end;

procedure TfrmBiophysics.nsMembraneCapSpecific_uFcM2ValueChanged(Sender: TObject);
begin
  MembraneCapSpecific_uFcM2 := nsMembraneCapSpecific_uFcM2.ValueAsSingle;
end;

procedure TfrmBiophysics.nsMembraneSpecific_OhmcM2ValueChanged(Sender: TObject);
begin
  MembraneSpecific_OhmcM2 := nsMembraneSpecific_OhmcM2.ValueAsSingle;
end;

procedure TfrmBiophysics.btnDefaultClick(Sender: TObject);
begin
  nsMembraneSpecific_OhmcM2.Value := 10000; // RMSpecific = 10000; //  ohm / cm^2
  nsMembraneCapSpecific_uFcM2.Value := 1; // CMSpecific = 1E-6; // Frad / cm^2
  nsMembraneAxialSpecific_OhmcM.Value := 100; // RASpecific = 100; // ohm * cm
end;

end.
