! ******************* fins ******************************* ! +++ ! ! Definition of the fins for the aircraft ! ! --- ! ! ! Revision history ! _______________ ! ! Copyright 1997-05-06 Gunnar Liden, All Rights Reserved ! ! Released under the MIT License: ! ! Permission is hereby granted, free of charge, to any person ! obtaining a copy of this software and associated documentation ! files (the "Software"), to deal in the Software without ! restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell ! copies of the Software, and to permit persons to whom the ! Software is furnished to do so, subject to the following ! conditions: ! ! The above copyright notice and this permission notice shall be ! included in all copies or substantial portions of the Software. ! ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ! OTHER DEALINGS IN THE SOFTWARE. ! ! ************************************************************ !sdesce Definition of the fins for the aircraft !sdescs Definition av fenor GLOBAL GEOMETRY MODULE fins ( REF air_id >"@t16384 Select aircraft"; FLOAT s_r := 0.5 >"Relative start position for fins (0-1)"; FLOAT y_f := 600.0 >"Station Y value for the fin"; FLOAT l_r := 2600.00 >"Chord length root"; FLOAT l_t := 600.00 >"Chord length tip"; FLOAT h_f := 2500.00 >"Height of fin"; FLOAT a_f := 30.0 >"Rotation angle for the fin"; INT graphic:= 1 >"=0: Show nothing =1: Fins =2: All"); ! Internal variables VECTOR p_fs; ! Start position for fin REF pla_id; ! Reference to pla_id ! Points defining the root section VECTOR p_r1; ! VECTOR p_r2; ! VECTOR p_r3; ! VECTOR p_r4; ! VECTOR p_r5; ! VECTOR t_r1; ! VECTOR t_r2; ! VECTOR t_r3; ! VECTOR t_r4; ! VECTOR t_r5; ! ! Attributes for plashape: FLOAT x_1; ! 1 Forward fuselage nose point X FLOAT pv1; ! 2 P-value forward fuselage FLOAT x_2; ! 3 Forward fuselage end point X FLOAT y_2; ! 4 Forward fuselage end point Y FLOAT x_3; ! 5 Wing leading edge start point X FLOAT y_3; ! 6 Wing Start station value Y FLOAT x_4; ! 7 Wing leading edge outer point X FLOAT y_4; ! 8 Wing end station value Y FLOAT x_5; ! 9 Wing trailing edge outer point X FLOAT x_6; ! 10 Wing trailing edge inner point X FLOAT x_7; ! 11 Rear fuselage end point X FLOAT y_7; ! 12 Rear fuselage end point Y FLOAT z_c; ! 13 Z value for the plane shape INT b_val_s; ! Blank value for output surfaces INT b_val_a; ! Blank value all other entities BEGINMODULE ! +++ ! Algorithm ! _________ ! --- ! +++ ! 1. Checks and initializations ! --- ! +++ ! Check graphic variable ! --- IF graphic = 0 THEN b_val_s := 1; b_val_a := 1; ELIF graphic = 1 THEN b_val_s := 0; b_val_a := 1; ELIF graphic = 2 THEN b_val_s := 0; b_val_a := 0; ELSE PART(#51, inp_err (VEC(8000,0,0))); EXIT("fins graphic is not 0, 1 or 2"); ENDIF; ! +++ ! Check relative X start position ! --- IF s_r < 0.0 + 0.01 OR s_r > 1.0 - 0.01 THEN PART(#52, inp_err (VEC(8000,0,0))); EXIT("fins Relative X position not between 0 and 1 "); ENDIF; ! +++ ! Retrieve data from the projected shape ! --- pla_id := GETREF(air_id, 1); x_1 := GETFLT(pla_id, 1); x_2 := GETFLT(pla_id, 3); y_2 := GETFLT(pla_id, 4); x_3 := GETFLT(pla_id, 5); x_4 := GETFLT(pla_id, 7); x_5 := GETFLT(pla_id, 9); x_6 := GETFLT(pla_id,10); x_7 := GETFLT(pla_id,11); z_c := GETFLT(pla_id,13); ! +++ ! Check fin position ! --- ! Check relative to size of aircraft IF y_f < 0.1*y_2 THEN PART(#53, inp_err (VEC(8000,0,0))); EXIT("fins Station Y < "+STR(0.1*y_2,-10,2)); ENDIF; IF y_f > y_2 THEN PART(#54, inp_err (VEC(8000,0,0))); EXIT("fins Station Y > "+STR(y_2,-10,2)); ENDIF; ! +++ ! Check fin dimensions ! --- IF l_r < 0.5*y_2 THEN PART(#55, inp_err (VEC(8000,0,0))); EXIT("fins Root chord length < "+STR(0.5*y_2,-10,2)); ENDIF; IF l_r > x_7-x_4 THEN PART(#56, inp_err (VEC(8000,0,0))); EXIT("fins Root chord length > "+STR(x_7-x_4,-10,2)); ENDIF; IF l_t > 0.95*l_r THEN PART(#57, inp_err (VEC(8000,0,0))); EXIT("fins Tip chord length > 0.95*root= "+STR(0.95*l_r,-10,2)); ENDIF; IF l_t < 0.1*l_t THEN PART(#58, inp_err (VEC(8000,0,0))); EXIT("fins Tip chord length < 0.1*root= "+STR(0.1*l_r,-10,2)); ENDIF; ! +++ ! Check rotation angle ! --- IF a_f < 0 THEN PART(#59, inp_err (VEC(8000,0,0))); EXIT("fins Rotation angle < 0 "); ENDIF; IF a_f > 90 THEN PART(#60, inp_err (VEC(8000,0,0))); EXIT("fins Rotation angle > 90"); ENDIF; ! +++ ! 2. Calculate start position for the fin ! --- p_fs := VEC(x_3+s_r*(x_7-x_3), y_f, z_c); POI_FREE(#20,p_fs:BLANK=b_val_a,PEN=2); ! +++ ! 3. Create rotated coordinate system for the fin ! --- CSYS_1P(#3, "Fin", p_fs, -90.0+a_f, 0.0, 0.0:BLANK=b_val_a); ! +++ ! Activate the local system (function MODE_LOCAL) ! --- MODE_LOCAL(GLOBAL_REF(#3)); ! +++ ! 4. Create root and tip sections ! --- p_r1 := VEC( l_r, 0.0, 0.0 ); p_r2 := VEC( 0.10*l_r, 0.0, 0.07*l_r ); p_r3 := VEC( 0.0, 0.0, 0.0 ); p_r4 := VEC( 0.10*l_r, 0.0, -0.07*l_r ); p_r5 := p_r1; t_r1 := p_r2 + VEC( 0.0 , 0.0, 0.02*l_r ); t_r2 := p_r2 + VEC( 0.3*l_r , 0.0, 0.0 ); t_r3 := p_r3 + VEC( 0.0 , 0.0, 0.3*l_r ); t_r4 := p_r4 + VEC( 0.3*l_r , 0.0, 0.0 ); t_r5 := p_r4 + VEC( 0.0 , 0.0, -0.02*l_r ); POI_FREE(#31,p_r1:BLANK=b_val_a,PEN=2); POI_FREE(#32,p_r2:BLANK=b_val_a,PEN=2); POI_FREE(#33,p_r3:BLANK=b_val_a,PEN=2); POI_FREE(#34,p_r4:BLANK=b_val_a,PEN=2); POI_FREE(#35,p_r5:BLANK=b_val_a,PEN=2); POI_FREE(#41,t_r1:BLANK=b_val_a,PEN=4); POI_FREE(#42,t_r2:BLANK=b_val_a,PEN=4); POI_FREE(#43,t_r3:BLANK=b_val_a,PEN=4); POI_FREE(#44,t_r4:BLANK=b_val_a,PEN=4); POI_FREE(#45,t_r5:BLANK=b_val_a,PEN=4); CUR_CONIC(#4, "FREE", p_r1, t_r1, 0.5, p_r2, t_r2, 0.5, p_r3, t_r3, 0.5, p_r4, t_r4, 0.5, p_r5, t_r5 :BLANK=b_val_a,PEN=1); ! +++ ! Move and scale root section (TFORM_MOVE and TCOPY) ! --- TFORM_MOVE(#5, VEC(0,0,0), VEC( 0.9*(l_r-l_t), h_f, 0.0), l_t/l_r, l_t/l_r, 1.0 ); TCOPY(#6, GLOBAL_REF(#4), GLOBAL_REF(#5), 1 :BLANK=b_val_a,PEN=1); ! +++ ! Activate global system (MODE_GLOBAL) ! --- MODE_GLOBAL(); ! +++ ! 5. Create left fin surface (function SUR_RULED) ! --- SUR_RULED(#1, GLOBAL_REF(#4), GLOBAL_REF(#6) :BLANK=b_val_s); ! +++ ! 6. Create right fin surface (function TFORM_MIRR and TCOPY) ! --- TFORM_MIRR(#8, VEC(0,0,0), VEC(1,0,1), VEC(2,0,0)); TCOPY(#9, GLOBAL_REF(#1), GLOBAL_REF(#8), 1 :BLANK=b_val_a,PEN=1); SUR_TRIM(#2, GLOBAL_REF(#9), 6.0, 0.0, 0.0, 1.0 :BLANK=b_val_s); ENDMODULE