function out=run_he_reproduction() % Published He et al. route first, before quad migration or new catalogue fits. here=fileparts(mfilename('fullpath'));root=fileparts(fileparts(fileparts(fileparts(here)))); assert(strcmp(version('-release'),'2025a')); run=fullfile(root,'reports','05_simulation','R23-001','runs','he-reproduction'); figdir=fullfile(root,'reports','05_simulation','R23-001','figures'); report=fullfile(root,'reports','06_reports','03_endurance_simulation','SIM-R3-001'); for q={run,figdir},if ~isfolder(q{1}),mkdir(q{1});end,end addpath(fullfile(root,'reports','04_models','R23-001','matlab')); diary(fullfile(run,'matlab.log'));finish=onCleanup(@()diary('off')); set(groot,'defaultFigureVisible','off','defaultFigureColor','w','defaultAxesFontName','Arial'); params=readtable(fullfile(root,'reports','04_models','R23-001','inputs','he-parameters.csv'),'TextType','string','Encoding','UTF-8'); writetable(params(startsWith(params.parameter_id,'HE-T2'),:),fullfile(here,'published-table2.csv'),'Encoding','UTF-8'); eq=readtable(fullfile(root,'reports','04_models','R23-001','inputs','he-equations.csv'),'TextType','string','Encoding','UTF-8'); writetable(eq(startsWith(eq.equation_id,'HE-'),:),fullfile(here,'published-equations-and-audit.csv'),'Encoding','UTF-8'); g=9.81;n=6;R=0.533;rho0=1.225;T0=288.15;Lb=-0.0065;h=150;Mair=0.029;Ru=8.314; rho=rho0*(T0/(T0+Lb*h))^(1+g*Mair/(Ru*Lb)); ki=1.12;Om=150;Cd0=0.008;sigma=0.1;A=pi*R^2; etaH=0.5*0.8*0.95*0.95;etaB=0.95*0.8*0.95*0.95; M=(5:0.025:65)';PL=0; Poneprofile=Cd0*sigma*rho*A*(Om*R)^3/8; W=M*g; Pproper=ki*W.*sqrt(W/(2*rho*n*A))+n*Poneprofile; Pliteral=ki*(W/n).*sqrt(W/(2*rho*A))+Poneprofile; Psumliteral=n*Pliteral; labels={'six_rotor_consistent_total','literal_Eq3_as_total','sum_n_literal_Eq3'}; powers=[Pproper,Pliteral,Psumliteral]; H=nan(size(powers));Hclosed=H;B=H;empty=H;hydrogen=H;fcMass=H; summary=struct([]); for k=1:3 P=powers(:,k);pd=1000*(0.52-0.46*exp(-P/700));pd(P>=2500)=520; mf=P./pd;avail=0.5*M-PL-mf; % A strict published mass budget treats Tank as empty in Eq11 (H2 omitted). E=(1.67*avail-0.44)*1000; tt=E*etaH./P;tt(avail<=0.26 | E<=0 | P>5500)=NaN; % B bookkeeping-resolved comparison includes H2 explicitly, unchanged fit. alpha=1.67*1000/(120e6/3600);beta=-0.44*1000/(120e6/3600); me=(avail-beta)/(1+alpha);mh=alpha*me+beta; tc=mh*(120e6/3600)*etaH./P;tc(me<=0.26|mh<=0|P>5500)=NaN; tb=(0.5*M-PL)*250*etaB./P;tb(0.5*M<=PL)=NaN; H(:,k)=tt;Hclosed(:,k)=tc;B(:,k)=tb;empty(:,k)=avail;hydrogen(:,k)=E/(120e6/3600);fcMass(:,k)=mf; [th,ih]=max(tt,[],'omitnan');[tbmax,ib]=max(tb,[],'omitnan');[thc,ic]=max(tc,[],'omitnan'); s=struct('branch',labels{k},'max_H2_h',th,'mass_at_max_H2_kg',M(ih), ... 'max_Li250_h',tbmax,'mass_at_max_Li_kg',M(ib),'mass_closed_H2_max_h',thc,'mass_closed_opt_kg',M(ic), ... 'relative_difference_from_paper_H2_3p57',th/3.57-1,'relative_difference_from_paper_Li_1p44',tbmax/1.44-1); if isempty(summary),summary=s;else,summary(end+1)=s;end end T=table(M,Pproper,Pliteral,Psumliteral,H(:,1),Hclosed(:,1),B(:,1),fcMass(:,1),empty(:,1),hydrogen(:,1), ... 'VariableNames',{'mass_kg','P_total_consistent_W','P_literal_as_total_W','P_sum_literal_W','H2_published_budget_h','H2_explicit_mass_h','Li250_h','FC_mass_kg','tank_as_empty_kg','H2_omitted_by_raw_budget_kg'}); writetable(T,fullfile(run,'original-route.csv')); Mt=(5:5:65)';Pt=ki*(Mt*g).*sqrt((Mt*g)/(2*rho*n*A))+n*Poneprofile; writetable(table(Mt,Pt,'VariableNames',{'MTOW_kg','total_power_W'}),fullfile(run,'figure2-comparable-values.csv')); payload=0:0.25:20;[MM,PP]=meshgrid(M,payload); Pow=ki*(MM*g).*sqrt((MM*g)/(2*rho*n*A))+n*Poneprofile; PD=1000*(0.52-0.46*exp(-Pow/700));PD(Pow>=2500)=520; mt=0.5*MM-PP-Pow./PD; EH=(1.67*mt-0.44)*1000*etaH./Pow;EH(mt<=0.26|Pow>5500)=NaN; EB=(0.5*MM-PP)*250*etaB./Pow;EB(0.5*MM<=PP)=NaN; save(fullfile(run,'he-original-results.mat'),'M','powers','H','Hclosed','B','MM','PP','EH','EB','summary'); fig=figure('Position',[100 100 1040 440]);tiledlayout(1,2,'Padding','compact'); nexttile;plot(M,powers/1000);grid on;xlabel('MTOW (kg)');ylabel('Power (kW)');title('He p3 ambiguity: three literal/consistent branches');legend(labels,'Interpreter','none','Location','northwest'); nexttile;plot(M,H(:,1),M,Hclosed(:,1),'--',M,B(:,1));hold on;yline(3.57,':');yline(1.44,':');grid on; xlabel('MTOW (kg)');ylabel('Endurance (h)');title('Original route, no payload; published vs mass-closed');legend('Published budget','H2 included in MTOW','Li250','Paper H2 3.57h','Paper Li 1.44h'); paths=struct('figures',figdir);r23.save_figure(fig,paths,'he-original-route');close(fig); fig=figure('Position',[100 100 1040 440]);tiledlayout(1,2,'Padding','compact'); nexttile;contourf(MM,PP,EH,20,'LineColor','none');colorbar;clim([0 4]);xlabel('MTOW (kg)');ylabel('Payload (kg)');title('He-route hydrogen hexacopter (h)'); nexttile;contourf(MM,PP,EB,20,'LineColor','none');colorbar;clim([0 1.5]);xlabel('MTOW (kg)');ylabel('Payload (kg)');title('He-route Li250 hexacopter (h)'); r23.save_figure(fig,paths,'he-original-mass-payload-contours');close(fig); out=struct('task_id','SIM-R3-001','priority','published He model route before migration', ... 'matlab_release',version('-release'),'source','R23-L17 DOI10.1016/j.est.2026.121813', ... 'source_pages','p3 Eqs1-5;p4 Table2 Eqs8-9;p5 Eqs10-15;p7 published maxima3.57/1.44h', ... 'rho_at150m_kg_m3',rho,'rotor_count',n,'radius_m',R,'profile_power_total_W',n*Poneprofile, ... 'published_fc_equation_W_per_kg','1000*(0.52-0.46*exp(-P_W/700)), P_W<2500;520 above', ... 'published_storage_equation_Wh','1000*(1.67*m_empty_kg-0.44)', ... 'eta_H2_total',etaH,'eta_battery_total',etaB,'branches',summary, ... 'paper_original_95CI_reconstructed',false,'paper_original_95PI_reconstructed',false, ... 'paper_raw_fit_samples_available',false,'full_contract_completed',false); out.reproduction_limitations={ ... 'The six-rotor consistent-total interpretation is tested against published Fig2 and3.57/1.44h, without tuning Table2 values.', ... 'Literal Eq3 and summing six copies with Eq4 total-W velocity are retained and are not silently called original author code.', ... 'Published Eq2 Tank boundary is ambiguous; raw-budget branch and H2-explicit branch are separately preserved.', ... 'Original published coefficient branch cannot regenerate original covariance or original95% bands without raw samples.', ... 'This route intentionally retains original propeller-efficiency product; migrated shaft/bus model must remove duplicate losses explicitly.', ... '5-65kg and positive-energy threshold reproduce paper scope; tank regression extrapolation beyond plotted sample domain is identified, not certified.', ... 'The source code and raw commercial validation data of the paper were not supplied; close maxima agreement is a numerical reconstruction, not proof of code identity or flight validation.'}; r23.write_json(fullfile(run,'he-reproduction-summary.json'),out); r23.write_json(fullfile(report,'he-reproduction-summary.json'),out); fprintf('HE_REPRODUCTION_COMPLETE rho=%.9g H2=%.9gh Li=%.9gh\n',rho,summary(1).max_H2_h,summary(1).max_Li250_h); end