Inputs (table below display portion of the spreadsheet):

lambda    wavelength, nm (controlled by on-screen slider)
Phi	  radiant flux, watts (controlled by on-screen slider)
flicfac	  flicker factor (0-1) (controlled by on-screen slider)
Kmax	  Max. Klam
LamMax	  Max. wavelength
block	  1=on    0=off
k	  number of stages
V	  total applied voltage, volts (controlled by 
           on-screen slider)
Klam	  quantum efficiency at lambda
Ec	  cathode work function, Joule
eta	  collection efficiency
excess	  excess noise current, amps
RL	  Load resistance, ohms (controlled by on-screen 
            pop-up menu)
t	  integration time, sec (controlled by on-screen 
            pop-up menu)
Tr	  Temperature (K) of load resistor
Tc        Temperature (K) of photocathode (controlled by 
           on-screen slider)
Ac	  Area of photocathode, cm2
C	  thermionic constant


Calculated quantities:

freq	=(2.998E+17)/lambda	Hz
E	=(6.6261E-34)*freq	Joule
Flux	=Phi/E	electrons/sec
Klam	=Kmax*exp(-((lambda-LamMax)/thresh*3.5)^2)  quantum efficiency at lambda
Vd	=V/k	 voltage per dynode, volts
m	=g^k	 multiplication factor
rcp	=Klam*Flux*block	 photoelectron emission rate
rt	=ict/1.602E-19	 cathode thermionic emission rate
Rlam	=(Klam*1.602E-19)/E	 radiant cathode responsivity (amps/watt)
g	=0.17*Vd^0.7	 gain per stage
ic	=rcp*1.602E-19*block	 cathode photocurrent
ia	=eta*m*Rlam*Phi*block	 anode photocurrent
ict	=C*Ac*Tc*Tc*exp(-Ec/(Tc*1.3805E-23))	 cathode thermionic current
iat	=ict*m*eta	 anode thermionic (dark) current
Es	=RL*(ia+iat)	 signal voltage
alpha	=1/(g-1)~	 secondary emission factor
deltaf	=1/(2*t)~	 noise bandwidth, Hz
sigmai	=sqrt(2*1.602E-19*(1+alpha)*m*ia*deltaf)	 photosignal shot noise current
sigmat	=sqrt(2*1.602E-19*(1+alpha)*m*iat*deltaf)	 thermionic shot noise current
sigmad	=sqrt(sigmat^2+excess^2)	 total dark noise current
sigma	=sqrt(sigmad^2+sigmai^2)	 total shot noise current
sigmaJ	=sqrt(4*1.38E-23*Tr*RL*deltaf)	 Johnson noise voltage
sigman	=sqrt((RL*sigma)^2+sigmaJ^2+sigmaf^2)	 total noise voltage
sigmav	=RL*sigma	 total shot noise voltage
sigmaf	=flicfac*(Es-iat*RL)	 flicker noise voltage  (displayed)
SNR	=ia*RL/sigman	 signal-to-noise ratio (displayed)
sigmadt	=sqrt((RL*sigmad)^2+sigmaJ^2)	total dark noise voltage  (displayed)
thresh	=6.626E-34*29980000000*10000000/Ec	long wavelength threshold, nm

Display script (DC System):

Signal Voltage=Es+sigman*2*(rand()-rand()+rand()-rand()+rand()-rand())
Noise Voltage = sigman
SNR = SNR
flicker noise = sigmaf	 
photon noise = sigmai*RL	 
dark noise = sigmadt

Sheet script:
on recalc
 if ia > .001 
    put "Anode current exceeds 1 mA maximum;
 phototube may be damaged by excessive current." into B1
  else put " " into B1
  end if
  if ic > .000001 
    put "Cathode current exceeds 1 �A maximum;
 phototube may exhibit fatigue." into B2
  else put " " into B2
  end if
  if lambda > thresh 
     put 0 into block
     else put 1 into block
  end if
end recalc
on idle
     put count+2 into count
     if count = 10
     recalc range H2
       if signal > 10 
          put 10 into H4
          else put signal into H4
       end if
     put 0 into count
     end if
end idle