var nclength : string
var nctype : string
var nclength_real : real
var finnumber : string
var distanceNC : real
var span : string
var span_real : real
var sweep : string
var sweep_real : real
var diameter : string
var diameter_real : real
var radius_real : real
var root : string
var tip : string
var root_real : real
var tip_real : real
var distance_fin : string
var distance_fin_real : real
var midchord_length : real
var force_fins : real
var CPdistance_fins : real
var force_total : real
var CP:real
loop
loop
locate (1, 1)
put "Is the nosecone a cone <1> or an ogive <2>?: " ..
get nctype
exit when strintok (nctype) = true
end loop
exit when strint (nctype) > 0 and strint (nctype) < 3
end loop
put "\n"
loop
loop
locate (3, 1)
put "What is the length of the nosecone?: " ..
get nclength
exit when strrealok (nclength) = true
end loop
exit when strreal (nclength) > 0
end loop
put "\n"
loop
loop
locate (5, 1)
put "What is the diameter of the nosecone?: " ..
get diameter
exit when strrealok (diameter) = true
end loop
exit when strreal (diameter) > 0
end loop
put "\n"
loop
loop
locate (7, 1)
put "How many fins are there? <3-6>: " ..
get finnumber
exit when strintok (finnumber) = true
end loop
exit when strint (finnumber) > 2 and strint (finnumber) < 7
end loop
put "\n"
loop
loop
locate (9, 1)
put "What is the semispan of the fins?: " ..
get span
exit when strrealok (span) = true
end loop
exit when strreal (span) > 0
end loop
put "\n"
loop
locate (11, 1)
put "What is the sweep length?: " ..
get sweep
exit when strrealok (sweep) = true
end loop
put "\n"
loop
locate (13, 1)
put "What is the tip length of the fins?: " ..
get tip
exit when strrealok (tip) = true
end loop
put "\n"
loop
loop
locate (15, 1)
put "What is the root length of the fins?: " ..
get root
exit when strrealok (root) = true
end loop
exit when strreal (root) > 0
end loop
put "\n"
loop
locate (16, 1)
put "What is distance from the nosecone tip to the leading edge of the fins?: " ..
get distance_fin
exit when strrealok (distance_fin) = true
end loop
% Convert Formats
distance_fin_real := strreal (distance_fin)
root_real := strreal (root)
tip_real := strreal (tip)
diameter_real := strreal (diameter)
radius_real := diameter_real / 2
sweep_real := strreal (sweep)
span_real := strreal (span)
nclength_real := strreal (nclength)
midchord_length := ((sweep_real + (tip_real / 2) - (root_real / 2)) ** 2 + span_real ** 2) ** 0.5
% Calculate CP Distance of the NC
if strint (nctype) = 1 then
distanceNC := 0.666 * nclength_real
else
distanceNC := 0.466 * nclength_real
end if
% Calculate Force Coefficient of the Fins
force_fins := 1 + (radius_real / (span_real + radius_real)) * ((4 * strint (finnumber) * (span_real / diameter_real) ** 2)) / 1 + (1 + (2 * midchord_length / (root_real + tip_real)) ** 0.5)
% Calculate CP Distance of the Fins
CPdistance_fins := distance_fin + (sweep_real / 3) * ((root_real + tip_real * 2) / (tip_real+root_real)) + (0.167) * ((root_real + tip_real) - ((root_real * tip_real) / (root_real + tip_real)))
% Total Force Coefficient
force_total := 2 + force_fins
% Calculate CP Distance from the nosecone tip
CP:= (2*distanceNC+CPdistance_fins*force_fins)/force_total
put CP
|