function burnwire(save_plots)
% burnwire  Voltage and current model of burn wire for antenna release

if nargin<1, save_plots=true;  end

% -- Properties of nichrome
rhoe = 1.0e-6;   %  resistivity (Ohm*m)  range = [1.0,1.5]*1e-6
rhom = 8400;     %  density (kg/m^3)
c = 450;         %  specific heat (J/kg/K)

L = (2:5)*1e-2;                              %  wire length (m)
H = [10, 50, 150, 300, 500];                 %  Heating rate (C/s)
dawg = [24, 26, 28, 30, 32, 36, 40];         %  AWG wire sizes
dw = [5.11, 4.05, 3.21, 2.54, 2.019, 1.27, 0.7874]*1e-4;  %  dia in m

% --- Define a set of lineStyles
lineSymb = char('b-','m--','k:','r-.','b-.','k--');
nsymb = size(lineSymb,1);   %  number of rows = number of lineStyles

% -- Current as a function of wire diameter
figI = figure('Name','Current vs. wire diameter');
for i=1:length(H)
  I = 0.25*pi*dw.^2 * sqrt(H(i)*c*rhom/rhoe);
  Hstring = sprintf('H = %d C/s',H(i));
  if i==1
    hold('on');
    legstr = Hstring;
  else
    legstr = char(legstr, Hstring);
  end
  isymb = 1 + rem(i-1,nsymb);
  plot(dawg,I,lineSymb(isymb,:))
end
grid('on')
hold('off')
xlabel('Wire diameter (AWG)');
ylabel('Current (A)')
legend(legstr);

% -- Voltage as a function of wire length
figV = figure('Name','Voltage vs. wire length');
for i=1:length(H)
  V = L * sqrt(H(i)*c*rhom*rhoe);
  Hstring = sprintf('H = %d C/s',H(i));
  if i==1
    hold('on');
    legstr = Hstring;
  else
    legstr = char(legstr, Hstring);
  end
  isymb = 1 + rem(i-1,nsymb);
  plot(L*100,V,lineSymb(isymb,:))
end
grid('on')
hold('off')
xlabel('Wire length (cm)');
ylabel('Voltage (V)')
legend(legstr,'Location','Northwest');

% -- Power as a function of wire diameter and length
figP = figure('Name','Power vs. wire diameter and length');
LP = (2:2:8)*1e-2;
Hcon = 50;    %  Hold heating rate at this value
for i=1:length(LP)
  P = 0.25*pi*dw.^2 * LP(i)*Hcon*c*rhom;
  LPstring = sprintf('L = %d cm',LP(i)*100);
  if i==1
    hold('on');
    legstr = LPstring;
  else
    legstr = char(legstr, LPstring);
  end
  isymb = 1 + rem(i-1,nsymb);
  plot(dawg,P,lineSymb(isymb,:))
end
grid('on');
hold('off')
xlabel('Wire diameter (AWG)');
ylabel('Power (W)')
legend(legstr,'Location','Northeast');

if save_plots
  figure(figI);  print('-depsc', 'current_vs_diameter.eps');
  figure(figV);  print('-depsc', 'voltage_vs_length.eps');
  figure(figP);  print('-depsc', 'power_vs_diameter_and_length.eps');
end

end