m.guidanceLaw = getprop(m.nodeString~"navigation"); # guidance-law: direct/OPN/PN/APN/PNxxyy/APNxxyy (use direct for pure pursuit, use PN for A/A missiles, use APN for modern SAM missiles PN for older, use PNxxyy/APNxxyy for surface to air where xx is degrees to aim above target, yy is seconds it will do that). GPN is APN for winged glidebombs.
m.guidanceLaw = getprop(m.nodeString~"navigation"); # guidance-law: direct/OPN/PN/APN/PNxxyy/APNxxyy/LOS (use direct for pure pursuit, use PN for A/A missiles, use APN for modern SAM missiles PN for older, use PNxxyy/APNxxyy for surface to air where xx is degrees to aim above target, yy is seconds it will do that). GPN is APN for winged glidebombs.
m.guidanceLawHorizInit = getprop(m.nodeString~"navigation-init-pure-15"); # Bool. Guide in horizontal plane using pure pursuit until target with 15 deg of nose, before switching to <navigation>
m.pro_constant = getprop(m.nodeString~"proportionality-constant"); # Constant for how sensitive proportional navigation is to target speed/acc. Normally between 3-6. [optional]
m.all_aspect = getprop(m.nodeString~"all-aspect"); # bool. set to false if missile only locks on reliably to rear of target aircraft
m.weight_fuel_lbm = getprop(m.nodeString~"weight-fuel-lbm"); # fuel weight [optional]. If this property is not present, it won't lose weight as the fuel is used.
m.vector_thrust = getprop(m.nodeString~"vector-thrust"); # Boolean. This will make less drag due to high G turns while engine is running. [optional]
m.engineEnabled = getprop(m.nodeString~"engine-enabled"); # Boolean. If engine will start at all. [optional]
@ -531,6 +535,9 @@ var AIM = {
if (m.force_lbf_2 == nil) {
m.force_lbf_2 = 0;
}
if (m.force_lbf_3 == nil) {
m.force_lbf_3 = 0;
}
if(m.stage_gap_duration == nil) {
m.stage_gap_duration = 0;
}
@ -540,6 +547,9 @@ var AIM = {
if(m.stage_2_duration == nil) {
m.stage_2_duration = 0;
}
if(m.stage_3_duration == nil) {
m.stage_3_duration = 0;
}
if (m.destruct_when_free == nil) {
m.destruct_when_free = FALSE;
}
@ -783,6 +793,8 @@ var AIM = {
m.vert_closing_rate_fps = -1;
m.usingTGPPoint = 0;
m.rotate_token = 0;
m.CREv = 0;
m.CREh = 0;
#
# Terrain following
@ -810,7 +822,8 @@ var AIM = {
m.maxMach = 0;
m.maxMach1 = 0;#stage 1
m.maxMach2 = 0;#stage 2
m.maxMach3 = 0;#stage 2 end
m.maxMach3 = 0;#stage 3
m.maxMach4 = 0;#stage 3 end
m.energyBleedKt = 0;
#
@ -1422,6 +1435,8 @@ var AIM = {
me.force_lbf_1 = 0;
me.stage_2_duration = 0;
me.force_lbf_2 = 0;
me.stage_3_duration = 0;
me.force_lbf_3 = 0;
me.stage_gap_duration = 0;
me.drop_time = 10000;
me.inert = TRUE;
@ -1649,10 +1664,12 @@ var AIM = {
# find the fuel consumption - lbm/sec
var impulse1 = me.force_lbf_1 * me.stage_1_duration; # lbf*s
var impulse2 = me.force_lbf_2 * me.stage_2_duration; # lbf*s
me.impulseT = impulse1 + impulse2; # lbf*s
var impulse3 = me.force_lbf_3 * me.stage_3_duration; # lbf*s
nav = "Original Proportional navigation. Proportionality constant is "~me.pro_constant;
@ -1744,7 +1763,9 @@ var AIM = {
nav2 = sprintf("Before APN it will aim %d degrees above target for %d seconds.",xx,yy);
}
var stages = 0;
if (me.force_lbf_1 > 0 and me.stage_1_duration > 0 and me.force_lbf_2 > 0 and me.stage_2_duration > 0) {
if (me.force_lbf_1 > 0 and me.stage_1_duration > 0 and me.force_lbf_2 > 0 and me.stage_2_duration > 0 and me.force_lbf_3 > 0 and me.stage_3_duration > 0) {
stages = 3;
} elsif (me.force_lbf_1 > 0 and me.stage_1_duration > 0 and me.force_lbf_2 > 0 and me.stage_2_duration > 0) {
stages = 2;
} elsif (me.force_lbf_1 > 0 and me.stage_1_duration > 0) {
stages = 1;
@ -1866,6 +1887,9 @@ var AIM = {
if (me.stage_gap_duration > 0) {
me.printStats("Stage 1 to 2 time gap: %.1f seconds.", me.stage_gap_duration);
}
if (stages > 2) {
me.printStats("Stage 3: %d lbf for %.1f seconds.", me.force_lbf_3, me.stage_3_duration);
}
}
me.printStats("%s",vector);
if (!me.weight_fuel_lbm) {
@ -2137,9 +2161,12 @@ var AIM = {
if (me.speed_m > me.maxMach2 and me.life_time > (me.drop_time + me.stage_1_duration) and me.life_time <= (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration)) {
me.maxMach2 = me.speed_m;
}
if (me.maxMach3 == 0 and me.life_time > (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration)) {
if (me.speed_m > me.maxMach3 and me.life_time > (me.drop_time + me.stage_1_duration + me.stage_gap_duration + me.stage_2_duration) and me.life_time <= (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration+me.stage_3_duration)) {
me.maxMach3 = me.speed_m;
}
if (me.maxMach4 == 0 and me.life_time > (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration+me.stage_3_duration)) {
me.maxMach4 = me.speed_m;
}
me.Cd = me.drag(me.speed_m,me.myG);
@ -2448,7 +2475,10 @@ var AIM = {
if (me.exploded == TRUE) {
me.printStats("%s max absolute %.2f Mach. Max relative %.2f Mach. Max alt %6d ft. Terminal %.2f mach.", me.type, me.maxMach, me.maxMach-me.startMach, me.maxAlt, me.speed_m);
me.printStats("%s max relative %d ft/s.", me.type, me.maxFPS-me.startFPS);
m.guidanceLaw = getprop(m.nodeString~"navigation"); # guidance-law: direct/OPN/PN/APN/PNxxyy/APNxxyy (use direct for pure pursuit, use PN for A/A missiles, use APN for modern SAM missiles PN for older, use PNxxyy/APNxxyy for surface to air where xx is degrees to aim above target, yy is seconds it will do that). GPN is APN for winged glidebombs.
m.guidanceLaw = getprop(m.nodeString~"navigation"); # guidance-law: direct/OPN/PN/APN/PNxxyy/APNxxyy/LOS (use direct for pure pursuit, use PN for A/A missiles, use APN for modern SAM missiles PN for older, use PNxxyy/APNxxyy for surface to air where xx is degrees to aim above target, yy is seconds it will do that). GPN is APN for winged glidebombs.
m.guidanceLawHorizInit = getprop(m.nodeString~"navigation-init-pure-15"); # Bool. Guide in horizontal plane using pure pursuit until target with 15 deg of nose, before switching to <navigation>
m.pro_constant = getprop(m.nodeString~"proportionality-constant"); # Constant for how sensitive proportional navigation is to target speed/acc. Normally between 3-6. [optional]
m.all_aspect = getprop(m.nodeString~"all-aspect"); # bool. set to false if missile only locks on reliably to rear of target aircraft
m.weight_fuel_lbm = getprop(m.nodeString~"weight-fuel-lbm"); # fuel weight [optional]. If this property is not present, it won't lose weight as the fuel is used.
m.vector_thrust = getprop(m.nodeString~"vector-thrust"); # Boolean. This will make less drag due to high G turns while engine is running. [optional]
m.engineEnabled = getprop(m.nodeString~"engine-enabled"); # Boolean. If engine will start at all. [optional]
@ -531,6 +535,9 @@ var AIM = {
if (m.force_lbf_2 == nil) {
m.force_lbf_2 = 0;
}
if (m.force_lbf_3 == nil) {
m.force_lbf_3 = 0;
}
if(m.stage_gap_duration == nil) {
m.stage_gap_duration = 0;
}
@ -540,6 +547,9 @@ var AIM = {
if(m.stage_2_duration == nil) {
m.stage_2_duration = 0;
}
if(m.stage_3_duration == nil) {
m.stage_3_duration = 0;
}
if (m.destruct_when_free == nil) {
m.destruct_when_free = FALSE;
}
@ -783,6 +793,8 @@ var AIM = {
m.vert_closing_rate_fps = -1;
m.usingTGPPoint = 0;
m.rotate_token = 0;
m.CREv = 0;
m.CREh = 0;
#
# Terrain following
@ -810,7 +822,8 @@ var AIM = {
m.maxMach = 0;
m.maxMach1 = 0;#stage 1
m.maxMach2 = 0;#stage 2
m.maxMach3 = 0;#stage 2 end
m.maxMach3 = 0;#stage 3
m.maxMach4 = 0;#stage 3 end
m.energyBleedKt = 0;
#
@ -1422,6 +1435,8 @@ var AIM = {
me.force_lbf_1 = 0;
me.stage_2_duration = 0;
me.force_lbf_2 = 0;
me.stage_3_duration = 0;
me.force_lbf_3 = 0;
me.stage_gap_duration = 0;
me.drop_time = 10000;
me.inert = TRUE;
@ -1649,10 +1664,12 @@ var AIM = {
# find the fuel consumption - lbm/sec
var impulse1 = me.force_lbf_1 * me.stage_1_duration; # lbf*s
var impulse2 = me.force_lbf_2 * me.stage_2_duration; # lbf*s
me.impulseT = impulse1 + impulse2; # lbf*s
var impulse3 = me.force_lbf_3 * me.stage_3_duration; # lbf*s
nav = "Original Proportional navigation. Proportionality constant is "~me.pro_constant;
@ -1744,7 +1763,9 @@ var AIM = {
nav2 = sprintf("Before APN it will aim %d degrees above target for %d seconds.",xx,yy);
}
var stages = 0;
if (me.force_lbf_1 > 0 and me.stage_1_duration > 0 and me.force_lbf_2 > 0 and me.stage_2_duration > 0) {
if (me.force_lbf_1 > 0 and me.stage_1_duration > 0 and me.force_lbf_2 > 0 and me.stage_2_duration > 0 and me.force_lbf_3 > 0 and me.stage_3_duration > 0) {
stages = 3;
} elsif (me.force_lbf_1 > 0 and me.stage_1_duration > 0 and me.force_lbf_2 > 0 and me.stage_2_duration > 0) {
stages = 2;
} elsif (me.force_lbf_1 > 0 and me.stage_1_duration > 0) {
stages = 1;
@ -1866,6 +1887,9 @@ var AIM = {
if (me.stage_gap_duration > 0) {
me.printStats("Stage 1 to 2 time gap: %.1f seconds.", me.stage_gap_duration);
}
if (stages > 2) {
me.printStats("Stage 3: %d lbf for %.1f seconds.", me.force_lbf_3, me.stage_3_duration);
}
}
me.printStats("%s",vector);
if (!me.weight_fuel_lbm) {
@ -2137,9 +2161,12 @@ var AIM = {
if (me.speed_m > me.maxMach2 and me.life_time > (me.drop_time + me.stage_1_duration) and me.life_time <= (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration)) {
me.maxMach2 = me.speed_m;
}
if (me.maxMach3 == 0 and me.life_time > (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration)) {
if (me.speed_m > me.maxMach3 and me.life_time > (me.drop_time + me.stage_1_duration + me.stage_gap_duration + me.stage_2_duration) and me.life_time <= (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration+me.stage_3_duration)) {
me.maxMach3 = me.speed_m;
}
if (me.maxMach4 == 0 and me.life_time > (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration+me.stage_3_duration)) {
me.maxMach4 = me.speed_m;
}
me.Cd = me.drag(me.speed_m,me.myG);
@ -2448,7 +2475,10 @@ var AIM = {
if (me.exploded == TRUE) {
me.printStats("%s max absolute %.2f Mach. Max relative %.2f Mach. Max alt %6d ft. Terminal %.2f mach.", me.type, me.maxMach, me.maxMach-me.startMach, me.maxAlt, me.speed_m);
me.printStats("%s max relative %d ft/s.", me.type, me.maxFPS-me.startFPS);
m.guidanceLaw = getprop(m.nodeString~"navigation"); # guidance-law: direct/OPN/PN/APN/PNxxyy/APNxxyy (use direct for pure pursuit, use PN for A/A missiles, use APN for modern SAM missiles PN for older, use PNxxyy/APNxxyy for surface to air where xx is degrees to aim above target, yy is seconds it will do that). GPN is APN for winged glidebombs.
m.guidanceLaw = getprop(m.nodeString~"navigation"); # guidance-law: direct/OPN/PN/APN/PNxxyy/APNxxyy/LOS (use direct for pure pursuit, use PN for A/A missiles, use APN for modern SAM missiles PN for older, use PNxxyy/APNxxyy for surface to air where xx is degrees to aim above target, yy is seconds it will do that). GPN is APN for winged glidebombs.
m.guidanceLawHorizInit = getprop(m.nodeString~"navigation-init-pure-15"); # Bool. Guide in horizontal plane using pure pursuit until target with 15 deg of nose, before switching to <navigation>
m.pro_constant = getprop(m.nodeString~"proportionality-constant"); # Constant for how sensitive proportional navigation is to target speed/acc. Normally between 3-6. [optional]
m.all_aspect = getprop(m.nodeString~"all-aspect"); # bool. set to false if missile only locks on reliably to rear of target aircraft
m.weight_fuel_lbm = getprop(m.nodeString~"weight-fuel-lbm"); # fuel weight [optional]. If this property is not present, it won't lose weight as the fuel is used.
m.vector_thrust = getprop(m.nodeString~"vector-thrust"); # Boolean. This will make less drag due to high G turns while engine is running. [optional]
m.engineEnabled = getprop(m.nodeString~"engine-enabled"); # Boolean. If engine will start at all. [optional]
@ -531,6 +535,9 @@ var AIM = {
if (m.force_lbf_2 == nil) {
m.force_lbf_2 = 0;
}
if (m.force_lbf_3 == nil) {
m.force_lbf_3 = 0;
}
if(m.stage_gap_duration == nil) {
m.stage_gap_duration = 0;
}
@ -540,6 +547,9 @@ var AIM = {
if(m.stage_2_duration == nil) {
m.stage_2_duration = 0;
}
if(m.stage_3_duration == nil) {
m.stage_3_duration = 0;
}
if (m.destruct_when_free == nil) {
m.destruct_when_free = FALSE;
}
@ -783,6 +793,8 @@ var AIM = {
m.vert_closing_rate_fps = -1;
m.usingTGPPoint = 0;
m.rotate_token = 0;
m.CREv = 0;
m.CREh = 0;
#
# Terrain following
@ -810,7 +822,8 @@ var AIM = {
m.maxMach = 0;
m.maxMach1 = 0;#stage 1
m.maxMach2 = 0;#stage 2
m.maxMach3 = 0;#stage 2 end
m.maxMach3 = 0;#stage 3
m.maxMach4 = 0;#stage 3 end
m.energyBleedKt = 0;
#
@ -1422,6 +1435,8 @@ var AIM = {
me.force_lbf_1 = 0;
me.stage_2_duration = 0;
me.force_lbf_2 = 0;
me.stage_3_duration = 0;
me.force_lbf_3 = 0;
me.stage_gap_duration = 0;
me.drop_time = 10000;
me.inert = TRUE;
@ -1649,10 +1664,12 @@ var AIM = {
# find the fuel consumption - lbm/sec
var impulse1 = me.force_lbf_1 * me.stage_1_duration; # lbf*s
var impulse2 = me.force_lbf_2 * me.stage_2_duration; # lbf*s
me.impulseT = impulse1 + impulse2; # lbf*s
var impulse3 = me.force_lbf_3 * me.stage_3_duration; # lbf*s
nav = "Original Proportional navigation. Proportionality constant is "~me.pro_constant;
@ -1744,7 +1763,9 @@ var AIM = {
nav2 = sprintf("Before APN it will aim %d degrees above target for %d seconds.",xx,yy);
}
var stages = 0;
if (me.force_lbf_1 > 0 and me.stage_1_duration > 0 and me.force_lbf_2 > 0 and me.stage_2_duration > 0) {
if (me.force_lbf_1 > 0 and me.stage_1_duration > 0 and me.force_lbf_2 > 0 and me.stage_2_duration > 0 and me.force_lbf_3 > 0 and me.stage_3_duration > 0) {
stages = 3;
} elsif (me.force_lbf_1 > 0 and me.stage_1_duration > 0 and me.force_lbf_2 > 0 and me.stage_2_duration > 0) {
stages = 2;
} elsif (me.force_lbf_1 > 0 and me.stage_1_duration > 0) {
stages = 1;
@ -1866,6 +1887,9 @@ var AIM = {
if (me.stage_gap_duration > 0) {
me.printStats("Stage 1 to 2 time gap: %.1f seconds.", me.stage_gap_duration);
}
if (stages > 2) {
me.printStats("Stage 3: %d lbf for %.1f seconds.", me.force_lbf_3, me.stage_3_duration);
}
}
me.printStats("%s",vector);
if (!me.weight_fuel_lbm) {
@ -2137,9 +2161,12 @@ var AIM = {
if (me.speed_m > me.maxMach2 and me.life_time > (me.drop_time + me.stage_1_duration) and me.life_time <= (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration)) {
me.maxMach2 = me.speed_m;
}
if (me.maxMach3 == 0 and me.life_time > (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration)) {
if (me.speed_m > me.maxMach3 and me.life_time > (me.drop_time + me.stage_1_duration + me.stage_gap_duration + me.stage_2_duration) and me.life_time <= (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration+me.stage_3_duration)) {
me.maxMach3 = me.speed_m;
}
if (me.maxMach4 == 0 and me.life_time > (me.drop_time + me.stage_1_duration + me.stage_gap_duration+me.stage_2_duration+me.stage_3_duration)) {
me.maxMach4 = me.speed_m;
}
me.Cd = me.drag(me.speed_m,me.myG);
@ -2448,7 +2475,10 @@ var AIM = {
if (me.exploded == TRUE) {
me.printStats("%s max absolute %.2f Mach. Max relative %.2f Mach. Max alt %6d ft. Terminal %.2f mach.", me.type, me.maxMach, me.maxMach-me.startMach, me.maxAlt, me.speed_m);
me.printStats("%s max relative %d ft/s.", me.type, me.maxFPS-me.startFPS);