function [prdData, info] = predict_Linepithema_humile(par, data, auxData)
% file generated by prt_predict

% unpack par, data, auxData
cPar = parscomp_st(par); vars_pull(par);
v2struct(par); v2struct(cPar); v2struct(data); v2struct(auxData);

% compute temperature correction factors
pars_T = T_A;
TC_ab = tempcorr(temp.ab, T_ref, pars_T);
TC_tj = tempcorr(temp.tj, T_ref, pars_T);
TC_te = tempcorr(temp.te, T_ref, pars_T);
TC_am = tempcorr(temp.am, T_ref, pars_T);
%TC_Ri = tempcorr(temp.Ri, T_ref, pars_T);
TC_WwR = tempcorr(temp.WwR, T_ref, pars_T);
%TC_Tab = tempcorr(C2K(Tab(:,1)), T_ref, pars_T);
%TC_Ttj = tempcorr(C2K(Ttj(:,1)), T_ref, pars_T);
%TC_Tte = tempcorr(C2K(Tte(:,1)), T_ref, pars_T);

% life cycle
pars_tj = [g k v_Hb v_He s_j kap kap_V];
[tau_j, tau_e, tau_b, l_j, l_e, l_b, rho_j, v_Rj, u_Ee, info] = get_tj_hex(pars_tj, f);

if info == 0
  prdData = []; return;
end

% initial
pars_UE0 = [V_Hb; g; k_J; k_M; v]; % compose parameter vector
U_E0 = initial_scaled_reserve(f, pars_UE0); % d.cm^2, initial scaled reserve
Ww_0 = U_E0 * p_Am * w_E/ mu_E/ d_V; % g, initial wet weight

% birth
L_b = L_m * l_b;                  % cm, structural length at birth
a_b = t_0 + tau_b/ k_M/ TC_ab;    % d, age at birth
Lw_b = L_b/ del_M;                % cm, physical length at birth

% pupation
L_j = L_m * l_j; % cm, structural length at pupation
t_j = (tau_j - tau_b)/ k_M/ TC_tj; % d, time since birth at pupation
Lw_j = L_j/ del_M;                % cm, physical length at pupation

% emergence
L_e = L_m * l_e; % cm, structural length at emergence
t_e = (tau_e - tau_j)/ k_M/ TC_te; % d, time since pupation at emergence
Lw_e = L_e/ del_M; % cm, physical length at emergence
E_Rj = v_Rj * (1 - kap) * g * E_m * L_j^3; % J, reproduction buffer at pupation
E_e = E_Rj + u_Ee * g * E_m * L_m^3;  % J, reserve at emergence
Ww_e = L_e^3 + w_E * E_e/ mu_E/ d_E; % g, wet weight at emergence
E_Rj = v_Rj * (1 - kap) * g * E_m * L_j^3; % J, reproduction buffer at pupation
E_e = E_Rj + u_Ee * g * E_m * L_m^3;  % J, reserve at emergence
Wd_e = L_e^3 * d_V + w_E * E_e/ mu_E; % g, dry weight at emergence

% ultimate
pars_tm = [g; l_T; h_a/ k_M^2; s_G]; % compose parameter vector
tau_m = get_tm_s(pars_tm, f, l_b); % -, scaled mean life span
a_m = tau_m/ k_M/ TC_am; % d, mean life span

% reproduction
L_e = L_m * l_e; % cm, structural length at emergence
E_0 = p_Am * U_E0; % J, initial reserve
s_M = l_j/ l_b; % -, acceleration factor
%R_i = kap_R * TC_Ri * (p_Am * s_M * L_e^2 - p_M * L_e^3 - k_J * E_He)/ E_0; % #/d, ultimate reproduction rate

% pack to output
prdData.ab = a_b;
prdData.tj = t_j;
prdData.te = t_e;
prdData.am = a_m;
prdData.Ww0 = Ww_0;
prdData.Wwe = Ww_e;
prdData.Wde = Wd_e;
prdData.Lb = Lw_b;
prdData.Lj = Lw_j;
prdData.Le = Lw_e;
%prdData.Ri = R_i;

% wet weight - reproduction rate
pars_R = [kap; kap_R; g; k_J; k_M; L_T; v; U_Hb; U_He]; % compose parameter vector
WwR = TC_WwR * reprod_rate((WwR(:,1)/(1 + f_WwR * ome)).^(1/3), f_WwR, pars_R); % #/d, reproduction rate

% temperature - age at birth
%EaT_b = a_b./ TC_Tab;
%EtT_j = t_j./ TC_Ttj; % is the synthax of EtT_j correct?
%EtT_e = t_e./ TC_Tte; % is the synthax of EtT_e correct?

% pack to output
prdData.WwR = WwR;
%prdData.Tab = EaT_b;
%prdData.Ttj = EtT_j;
%prdData.Tte = EtT_e;
