%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Name: inst.m
% Author: J. Kristoffer Hultgren
%
% Description:
%
% Sets up all plasma and instrument properties and constants and calculates
% the probe currents
%
% Input:  dist        - Heliocentric distance
%         ni          - Solar wind ion number density
%         nhi         - Heavy ion number density
%         Te          - Electron temperature
%         Ti          - Ion temperature
%         vi          - Solar wind ion velocity
%         vhi         - Heavy ion velocity
%         Vb          - Bias voltage
%
% Output: [ip,ii,iph] - ip  - Total probe current
%                       ii  - Ion current
%                       iph - Photoelectron current
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function curr = inst(dist,ni,nhi,Te,Ti,vi,vhi,Vb)

LP_Constants;                   %Defining physical constants
LP_SetupInstrument;             %Defining instrument design constants

P = LP_SetupPlasma(dist,ni,nhi,Te,Ti,vi,vhi);   %Setup plasma parameters P

vs0 = 1;                        %Seed value

Vsc = LP_Vsc(P,vs0);            %Calculating s/c potential

Vp = Vb + Vsc;                  %Probe potential by bias

curr = LP_IProbe(Vp,P);         %Calculates currents