function out=website_packet(paths,p) v=load(fullfile(paths.run,'integration-results.mat'),'out');integ=v.out; valid=find([integ.branches.power_screen_pass]);assert(~isempty(valid)); [~,j]=max([integ.branches(valid).nominal_constant_mass_endurance_h]);ix=valid(j);b=integ.branches(ix); T=readtable(fullfile(paths.run,b.row_file),'TextType','string','Encoding','UTF-8'); accessIds=["B09","B19","B21","B22","B23","B24","B25","B26","B27","B28","B51"]; access=sum(T.mass_used_kg(ismember(T.bom_id,accessIds))); base=b.M0_kg-b.payload_kg-b.buffer_mass_kg-b.FC_module_kg-b.empty_tank_kg-b.loaded_H2_kg-access; speeds=[5,11];out=struct; for V=speeds [PP,mp]=r23.propulsion_power(b.M0_kg,V,0,1,b.prop,p); aux=b.bus_fixed_load_W+(PP/50)^2*0.013; P=PP+aux; input=struct('airframeMassKg',base,'payloadMassKg',b.payload_kg,'bufferMassKg',b.buffer_mass_kg, ... 'fuelCellId','ie-soar2400','tankId',sprintf('alsafe-%gl',b.cylinder_water_volume_L),'storageAccessoriesMassKg',access, ... 'hydrogenMassKg',b.loaded_H2_kg,'airspeedMps',V,'windMps',0,'targetMode','endurance', ... 'targetEnduranceMin',120,'targetRangeKm',10,'diskAreaM2',4*pi*(b.propeller_diameter_m/2)^2, ... 'motorEfficiency',p.eta_motor,'fuelCellEfficiency',p.eta_fc,'busEfficiency',p.eta_esc, ... 'usableHydrogenFraction',0.95,'airDensityKgM3',p.rho,'auxiliaryPowerW',aux,'reservePowerW',0,'dragAreaM2',p.flat_plate); packet=struct('design_id',b.design_id,'design_version',integ.design_version,'model_version','R23-HE2.0.0', ... 'input',input,'MATLAB_static_map_anchored_steady',struct('M_kg',b.M0_kg,'V_m_s',V,'propulsion_DC_W',PP,'bus_power_W',P, ... 'steady_endurance_min',b.loaded_H2_kg*0.95*p.LHV*p.eta_fc/P/60,'rpm',mp.rpm), ... 'mass_mapping','airframe includes all other propulsion,structure,avionics and power parts;storage accessory IDs listed separately', ... 'accessory_BOM_ids',accessIds,'comparison_limits','this evaluated website M1 core uses a different steady forward model, without this matched motor map/full task; other website modules are not assessed here;5m/s is outside thiscore admitted domain', ... 'reserve_mapping','5% hydrogen reserve in usable fraction; no added continuous power reserve;120min is declared evaluation target,10km unused in endurance mode'); fname=sprintf('website-input-%gmps.json',V);r23.write_json(fullfile(paths.report,fname),packet);out.(sprintf('V%d',V))=packet; named=sprintf('website-input-%s-%gmps.json',strrep(integ.design_version,'.','p'),V);r23.write_json(fullfile(paths.report,named),packet); end r23.write_json(fullfile(paths.report,'selected-configuration-bridge.json'),struct('design_id',b.design_id,'design_version',integ.design_version, ... 'core_mass_kg',b.core_mass_kg,'complete_mass_kg',b.M0_kg,'integration_additions_kg',b.integration_additions_kg, ... 'core_without_integration_warning','core is a mass bridge, not flyable without excluded parts', ... 'website_packet_11mps','reports/06_reports/03_endurance_simulation/SIM-R3-001/website-input-11mps.json', ... 'website_packet_requested_work_5mps','reports/06_reports/03_endurance_simulation/SIM-R3-001/website-input-5mps.json')); % He-stage budget is replaced by full BOM, not added a second time. energyCore=b.FC_module_kg+b.empty_tank_kg+b.loaded_H2_kg+b.buffer_mass_kg+b.payload_kg; stage2M=energyCore/(1-p.nonenergy_fraction);neBudget=p.nonenergy_fraction*stage2M; P2=r23.propulsion_power(stage2M,5,0,1,b.prop,p);P2=P2+b.bus_fixed_load_W+(P2/50)^2*.013; actualNE=b.M0_kg-energyCore; bridge=struct('design_id',b.design_id,'design_version',integ.design_version,'continuous_summary','upper-bound-summary.json', ... 'stage2_energy_core_kg',energyCore,'stage2_He_nonenergy_budget_kg',neBudget,'stage2_He_discrete_MTOW_kg',stage2M, ... 'stage2_actual_map_steady_5mps_bus_W',P2,'stage2_actual_map_steady_5mps_h',b.loaded_H2_kg*.95*p.LHV*.5/P2/3600, ... 'stage3_actual_nonenergy_kg',actualNE,'stage3_complete_MTOW_kg',b.M0_kg,'nonenergy_budget_remaining_kg',neBudget-actualNE, ... 'reference_full_core_mass_kg',b.core_mass_kg,'reference_remaining_BOM_kg',b.integration_additions_kg, ... 'rule','ReplacewholefractionalnonenergybudgetwithactualnonenergyBOM;propulsionnotcountedtwice'); r23.write_json(fullfile(paths.report,'three-stage-bridge.json'),bridge); fprintf('WEBSITE_PACKET_READY design=%s version=%s M=%.9gkg\n',b.design_id,integ.design_version,b.M0_kg); end