Commit 7e22f03a authored by Dave Cooper's avatar Dave Cooper
Browse files

started adding incremental primi-plane example files

parent e65444d4
......@@ -45,10 +45,10 @@
;;
;; Rudder data
;;
:rudder-span 10
:rudder-c-root 5
:rudder-c-tip 2
:rudder-thickness 0.8
:fin-span 10
:fin-c-root 5
:fin-c-tip 2
:fin-thickness 0.8
)
(:wing-span
30
:wing-c-root 6
:wing-c-tip 3
:wing-thickness 1
:wing-dihedral 10
:Tmax 800
:rho 0.73
:C-of-F 0.005
;;
;; Fuselage data
;;
:fuselage-diameter 5
:fuselage-length 42
;;
;; Fuselage cross section percentages - plist with keys percent of
;; length, values percent of full cylinder diameter
;;
:fuselage-cross-section-percents (0 10
10 90
20 100
30 100
40 100
50 100
60 100
70 100
80 100
90 90
100 10)
;;
;; Tail data
;;
:tail-span 15
:tail-c-root 5
:tail-c-tip 2
:tail-thickness 0.8
:tail-dihedral 8
;;
;; Rudder data
;;
:fin-span 10
:fin-c-root 5
:fin-c-tip 2
:fin-thickness 0.8
)
\ No newline at end of file
(:wing-span
30
:wing-c-root 6
:wing-c-tip 3
:wing-thickness 1
:wing-dihedral 10
:Tmax 800
:rho 0.73
:C-of-F 0.005
;;
;; Fuselage data
;;
:fuselage-diameter 5
:fuselage-length 42
;;
;; Fuselage cross section percentages - plist with keys percent of
;; length, values percent of full cylinder diameter
;;
:fuselage-cross-section-percents (0 10
10 90
20 100
30 100
40 100
50 100
60 100
70 100
80 100
90 90
100 10)
;;
;; Tail data
;;
:tail-span 15
:tail-c-root 5
:tail-c-tip 2
:tail-thickness 0.8
:tail-dihedral 8
;;
;; Rudder data
;;
:fin-span 10
:fin-c-root 5
:fin-c-tip 2
:fin-thickness 0.8
)
\ No newline at end of file
;;
;; Copyright 2012 Genworks International and the Delft University of
;; Technology
;;
;; This source file contains free software: you can redistribute it
;; and/or modify it under the terms of the GNU Affero General Public
;; License as published by the Free Software Foundation, either
;; version 3 of the License, or (at your option) any later version.
;;
;; This source file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public
;; License along with this source file. If not, see
;; <http://www.gnu.org/licenses/>.
;;
(in-package :gdl-user)
(define-object primi-plane (base-object)
:computed-slots ((dihedral 10 :settable))
:objects
((wing-assy :type 'box-wings
:c-root 6
:c-tip 3
:span 30
:root-center (translate (the center)
:down (- (the fuselage radius) (half (the-child thickness)))
:front (* 1/6 (the fuselage length)))
:thickness 1
:dihedral (the dihedral)
:display-controls (list :color :green))
(fuselage :type 'cylinder-fuselage
:d 5
:l 42
:display-controls (list :color :red))))
(define-object cylinder-fuselage (cylinder)
:input-slots (d l)
:computed-slots ((radius (half (the d)))
(length (the l))))
(define-object box-wings (base-object)
:input-slots (root-center span c-root c-tip thickness dihedral)
:objects
((wings :type 'box-wing
:sequence (:size 2)
:root-point (the root-center)
:side (ecase (the-child index) (0 :right) (1 :left))
:span (the span)
:c-root (the c-root)
:c-tip (the c-tip)
:thickness (the thickness)
;;
;; Left wing will get a left-handed coordinate system and be a mirror of the right.
;;
:orientation (let* ((hinge (the (face-normal-vector (ecase (the-child side)
(:right :front)
(:left :rear)))))
(right (rotate-vector-d (the (face-normal-vector (the-child side)))
(the dihedral)
hinge)))
(alignment :right right
:top (cross-vectors hinge right)
:front (the (face-normal-vector :front)))))))
(define-object box-wing (box)
:input-slots (root-point side span c-root c-tip thickness)
:computed-slots ((width (the span))
(length (the c-root))
(height (the thickness))
(center (translate-along-vector (the root-point)
(the (face-normal-vector :right))
(half (the width))
)))
:objects ((box :type 'box
:hidden? t
:display-controls (list :color :orange :transparency 0.7))))
;;
;; Copyright 2012 Genworks International and the Delft University of
;; Technology
;;
;; This source file contains free software: you can redistribute it
;; and/or modify it under the terms of the GNU Affero General Public
;; License as published by the Free Software Foundation, either
;; version 3 of the License, or (at your option) any later version.
;;
;; This source file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public
;; License along with this source file. If not, see
;; <http://www.gnu.org/licenses/>.
;;
(in-package :gdl-user)
(defparameter *data-folder* (merge-pathnames "../../data/"
(make-pathname :name nil
:type nil
:defaults excl:*source-pathname*
;; in future: (glisp:source-pathname)
)))
(define-object primi-plane (base-object)
:input-slots ((data-folder *data-folder*)
(data-file-name "aircraft-2.dat"))
:computed-slots ((data-file-path (merge-pathnames (the data-file-name)
(the data-folder)))
(data-list (with-open-file (in (the data-file-path))
(read in)))
(dihedral (the data wing-dihedral) :settable))
:objects
((data :type 'aircraft-data
:parameters (the data-list))
(wing-assy :type 'box-wings
:c-root (the data wing-c-root)
:c-tip (the data wing-c-tip)
:span (the data wing-span)
:root-center (translate (the center)
:down (- (the fuselage radius) (half (the-child thickness)))
:front (* 1/6 (the fuselage length)))
:thickness (the data wing-thickness)
:dihedral (the dihedral)
:display-controls (list :color :green))
(fuselage :type 'cylinder-fuselage
:d (the data fuselage-diameter)
:l (the data fuselage-length)
:display-controls (list :color :red))))
(define-object aircraft-data ()
:input-slots (wing-span
wing-c-root
wing-c-tip
wing-thickness
wing-dihedral
Tmax
rho
C-of-F
fuselage-diameter
fuselage-length
fuselage-cross-section-percents
tail-span
tail-c-root
tail-c-tip
tail-thickness
tail-dihedral
fin-span
fin-c-root
fin-c-tip
fin-thickness))
(define-object cylinder-fuselage (cylinder)
:input-slots (d l)
:computed-slots ((radius (half (the d)))
(length (the l))))
(define-object box-wings (base-object)
:input-slots (root-center span c-root c-tip thickness dihedral)
:objects
((wings :type 'box-wing
:sequence (:size 2)
:root-point (the root-center)
:side (ecase (the-child index) (0 :right) (1 :left))
:span (the span)
:c-root (the c-root)
:c-tip (the c-tip)
:thickness (the thickness)
;;
;; Left wing will get a left-handed coordinate system and be a mirror of the right.
;;
:orientation (let* ((hinge (the (face-normal-vector (ecase (the-child side)
(:right :front)
(:left :rear)))))
(right (rotate-vector-d (the (face-normal-vector (the-child side)))
(the dihedral)
hinge)))
(alignment :right right
:top (cross-vectors hinge right)
:front (the (face-normal-vector :front)))))))
(define-object box-wing (box)
:input-slots (root-point side span c-root c-tip thickness)
:computed-slots ((width (the span))
(length (the c-root))
(height (the thickness))
(center (translate-along-vector (the root-point)
(the (face-normal-vector :right))
(half (the width))
)))
:objects ((box :type 'box
:hidden? t
:display-controls (list :color :orange :transparency 0.7))))
;;
;; Copyright 2012 Genworks International and the Delft University of
;; Technology
;;
;; This source file contains free software: you can redistribute it
;; and/or modify it under the terms of the GNU Affero General Public
;; License as published by the Free Software Foundation, either
;; version 3 of the License, or (at your option) any later version.
;;
;; This source file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public
;; License along with this source file. If not, see
;; <http://www.gnu.org/licenses/>.
;;
(in-package :gdl-user)
(defparameter *data-folder* (merge-pathnames "../../data/"
(make-pathname :name nil
:type nil
:defaults excl:*source-pathname*
;; in future: (glisp:source-pathname)
)))
(define-object primi-plane (base-object)
:input-slots ((data-folder *data-folder*)
(data-file-name "aircraft-3.dat")
(points-file-name "NACA_0012.dat"))
:computed-slots ((data-file-path (merge-pathnames (the data-file-name)
(the data-folder)))
(points-file-path (merge-pathnames (the points-file-name)
(the data-folder)))
(dihedral (the data wing-dihedral) :settable))
:objects
((data :type 'aircraft-data
:parameters (with-open-file (in (the data-file-path))
(read in))
:points-data (with-open-file (in (the points-file-path))
(read in)))
(canonical-profile :type 'profile-curve
:points-data (the data points-data))
(wing-assy :type 'box-wings
:c-root (the data wing-c-root)
:c-tip (the data wing-c-tip)
:span (the data wing-span)
:root-center (translate (the center)
:down (- (the fuselage radius) (half (the-child thickness)))
:front (* 1/6 (the fuselage length)))
:thickness (the data wing-thickness)
:dihedral (the dihedral)
:display-controls (list :color :green))
(fuselage :type 'cylinder-fuselage
:d (the data fuselage-diameter)
:l (the data fuselage-length)
:display-controls (list :color :red))))
(define-object profile-curve (fitted-curve)
:input-slots (points-data)
:computed-slots ((point-coordinates (rest (rest (the points-data))))
(x-coords (plist-keys (the point-coordinates)))
(y-coords (plist-values (the point-coordinates)))
(points (mapcar #'(lambda (x y) (make-point x y 0))
(the x-coords)
(the y-coords)))))
(define-object aircraft-data ()
:input-slots (wing-span
wing-c-root
wing-c-tip
wing-thickness
wing-dihedral
Tmax
rho
C-of-F
fuselage-diameter
fuselage-length
fuselage-cross-section-percents
tail-span
tail-c-root
tail-c-tip
tail-thickness
tail-dihedral
fin-span
fin-c-root
fin-c-tip
fin-thickness
points-data
))
(define-object cylinder-fuselage (cylinder)
:input-slots (d l)
:computed-slots ((radius (half (the d)))
(length (the l))))
(define-object box-wings (base-object)
:input-slots (root-center span c-root c-tip thickness dihedral)
:objects
((wings :type 'box-wing
:sequence (:size 2)
:root-point (the root-center)
:side (ecase (the-child index) (0 :right) (1 :left))
:span (the span)
:c-root (the c-root)
:c-tip (the c-tip)
:thickness (the thickness)
;;
;; Left wing will get a left-handed coordinate system and be a mirror of the right.
;;
:orientation (let* ((hinge (the (face-normal-vector (ecase (the-child side)
(:right :front)
(:left :rear)))))
(right (rotate-vector-d (the (face-normal-vector (the-child side)))
(the dihedral)
hinge)))
(alignment :right right
:top (cross-vectors hinge right)
:front (the (face-normal-vector :front)))))))
(define-object box-wing (box)
:input-slots (root-point side span c-root c-tip thickness)
:computed-slots ((width (the span))
(length (the c-root))
(height (the thickness))
(center (translate-along-vector (the root-point)
(the (face-normal-vector :right))
(half (the width))
)))
:objects ((box :type 'box
:hidden? t
:display-controls (list :color :orange :transparency 0.7))))
......@@ -59,7 +59,7 @@
(when (getf (the display-controls) :linetype)
(write-the line-properties))))
(:IndexedFaceSet :creaseAngle "1.571"
:solid "true"
:solid "false"
:coordIndex formatted-vertices
(:Coordinate :point (format nil "~{~a~^, ~}"
(let ((*read-default-float-format* 'single-float))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment