function out=discrete_analysis(integration,p,paths) data=jsondecode(fileread(fullfile(paths.inputs,'r2-candidates-current.json'))); base=integration.branches(end);tanks=data.ambient_compressed_cylinder_candidates;rows=struct([]); % Freeze IE2.4kW / P80G30 /12S electrical topology; vary actual listed tank SKU. for i=1:numel(tanks) t=tanks(i);if isempty(t.empty_mass_kg)||isempty(t.listed_H2_mass_kg),continue;end M=base.M0_kg-base.empty_tank_kg-base.loaded_H2_kg+t.empty_mass_kg+t.listed_H2_mass_kg; [Ppr,mp]=r23.propulsion_power(M,5,0,1,base.prop,p); [Ph,~]=r23.propulsion_power(M,0,0,1,base.prop,p); bus=Ppr+base.bus_fixed_load_W+(Ppr/50)^2*.013; hoverBus=Ph+base.bus_fixed_load_W+(Ph/50)^2*.013; feasible=mp.in_domain&&Ph<=4*base.motor_continuous_each_budget_W&&bus<=2280&&hoverBus<=2280; s=struct('tank_id',t.component_id,'manufacturer',t.manufacturer,'M0_kg',M,'empty_tank_kg',t.empty_mass_kg, ... 'gross_H2_kg',t.listed_H2_mass_kg,'listed_water_volume_L',t.water_volume_L,'work_5mps_bus_W',bus,'hover_bus_W',hoverBus, ... 'steady_5mps_h',t.listed_H2_mass_kg*.95*p.LHV*.50/bus/3600,'power_screen_pass',feasible, ... 'layout_supply_and_stock_qualified',false,'domain','actual nominal tank SKU with unchangedBOMaccessory allowance; geometry/valve compatibility needsreview'); if isempty(rows),rows=s;else,rows(end+1)=s;end end writetable(struct2table(rows),fullfile(paths.run,'discrete-tank-shortlist.csv'),'Encoding','UTF-8'); valid=find([rows.power_screen_pass]);[~,j]=max([rows(valid).steady_5mps_h]);best=rows(valid(j)); out=struct('fixed_Electrical_propulsion','IE-SOAR2.4kW / P80III KV100 G30 /12S buffer', ... 'nominal_catalogue_power_screen_best',best,'integrated_R2_reference_design',base.design_id, ... 'global_discrete_optimum_certified',false,'reason','Bothwork5m/sandcontinuoushoverpowerscreenapplied;fulltakeoff/thermal/geometryandsupplyqualificationstillneeded. H3 nativevoltagesarenot12Sdrop-in.9Lreferenceisnotclaimedwholecatalogueoptimum.'); r23.write_json(fullfile(paths.report,'discrete-shortlist-summary.json'),out); fprintf('DISCRETE_TANK_BEST %s M=%.8gkg steady=%.8gh (conditional)\n',best.tank_id,best.M0_kg,best.steady_5mps_h); end