function [Pdc,map]=propulsion_power(M,V,Vz,thrustFactor,prop,p) % Manufacturer static ELECTRICAL map; only forward/climb increments modelled. b=prop.bench_points;t=[b.thrust_g]';pw=[b.electrical_power_W]';rpm=[b.rpm]'; requested=M*1000/4*thrustFactor; in=requested>=min(t)&&requested<=max(t); if ~in,Pdc=NaN;map=struct('in_domain',false,'thrust_each_g',requested,'rpm',NaN,'CT',NaN,'advance_ratio',NaN,'tip_speed_m_s',NaN);return;end pe=interp1(t,pw,requested,'linear');omega=interp1(t,rpm,requested,'linear')*2*pi/60; pp=p;pp.aux_power=0;pp.eta_motor=1;pp.eta_esc=1;pp.tip_speed=omega*prop.propeller_diameter_m/2; base=r23.power(M*thrustFactor,0,prop.propeller_diameter_m,pp,0); flight=r23.power(M*thrustFactor,V,prop.propeller_diameter_m,pp,max(Vz,0)); Pdc=4*pe*flight/base; nrev=omega/(2*pi);CT=(requested/1000*p.g)/(p.rho*nrev^2*prop.propeller_diameter_m^4); map=struct('in_domain',in,'thrust_each_g',requested,'rpm',omega*60/(2*pi),'CT',CT, ... 'advance_ratio',V/pp.tip_speed,'tip_speed_m_s',pp.tip_speed, ... 'forward_model_identity','He disk power + Zeng straight-level inflow correction, static-map electrical anchoring; not forward-flight validation'); end