! ******************* engine ******************************* ! +++ ! ! Definition of the engine 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 engine for the aircraft !sdescs Definition av motor GLOBAL GEOMETRY MODULE engine ( REF air_id >"@t16384 Select aircraft"; FLOAT r_m := 400.00 >"Radius for the motor"; FLOAT r_o := 325.00 >"Radius for the outlet"; INT graphic:= 1 >"=0: Show nothing =1: Engine =2: All"); ! Internal variables VECTOR p_ms; ! Start position motor VECTOR p_me; ! End position motor VECTOR p_oe; ! End position outlet REF pla_id; ! Reference to pla_id ! 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(9000,0,0))); EXIT("engine graphic is not 0, 1 or 2"); 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); 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 radii ! --- ! Check relative to size of aircraft IF r_m < 0.05*(x_7-x_6) THEN PART(#52, inp_err (VEC(9000,0,0))); EXIT("engine Motor radius < "+STR(0.05*(x_7-x_6),-10,2)); ENDIF; IF r_m < 0.1*(x_7-x_6) THEN PART(#53, inp_err (VEC(9000,0,0))); EXIT("engine Outlet radius < Motor radius= "+STR(r_m,-10,2)); ENDIF; ! +++ ! 2. Calculate start and end position for engine and outlet ! --- p_ms := VEC(x_3+0.8*(x_4-x_3), 0.0, z_c-r_m); p_me := VEC(x_7+0.1*(x_7-x_6), 0.0, z_c-r_m); p_oe := p_me + VEC( 0.2*(x_7-x_6), 0.0, 0.0); POI_FREE(#20,p_ms:BLANK=b_val_a,PEN=2); POI_FREE(#21,p_me:BLANK=b_val_a,PEN=4); POI_FREE(#22,p_oe:BLANK=b_val_a,PEN=2); ! +++ ! 3. Definition of motor and outlet ! --- ! +++ ! Create rotation curve ! --- LIN_FREE(#30, p_ms-VEC(0,0,r_m), p_me-VEC(0,0,r_m) :BLANK=b_val_a,PEN=4); LIN_FREE(#31, p_me-VEC(0,0,r_m), p_oe-VEC(0,0,r_o) :BLANK=b_val_a,PEN=4); LIN_FREE(#32, p_oe-VEC(0,0,r_o), p_oe-VEC(0,0,0.1) :BLANK=b_val_a,PEN=4); CUR_COMP(#33, GLOBAL_REF(#30), GLOBAL_REF(#31), GLOBAL_REF(#32) :BLANK=b_val_a,PEN=2); ! +++ ! Create rotation surface (function SUR_ROT) ! --- SUR_ROT(#1, GLOBAL_REF(#33), p_ms, p_me, 0.0, 360.0 :BLANK=b_val_s); ! +++ ! 4. Registrate the motor and the motor start position ! --- GROUP(#11,"Motor",GLOBAL_REF(#1)); POI_FREE(#9,p_ms:BLANK=1); GROUP(#10,"Mstart",GLOBAL_REF(#9)); ENDMODULE