wt-demo-1.lisp 15.3 KB
Newer Older
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
1
2
3
4
5
6
7
(in-package :wind)

(define-object demo-1 (base-ajax-sheet)
  ;;base-ajax-sheet)
 
  :input-slots 
  
8
  ((css-style  "/css-demo-1/style-wind-1.css"))
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
9
10
  
  :computed-slots 
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  ((use-raphael? t)

   (iges-url (let ((url (format nil "~a/model.iges" (the url))))
	       (publish :path url
			:function #'(lambda(req ent)
				      (with-http-response (req ent)
					(with-http-body (req ent)
					  (with-format (iges (request-reply-stream req))
					    (write-the graphics rotor cad-output-tree))))))
	       url))

   (step-url (let ((url (format nil "~a/model.step" (the url))))
	       (publish :path url
			:function #'(lambda(req ent)
				      (with-http-response (req ent)
					(with-http-body (req ent)
					  (with-format (step (request-reply-stream req))
					    (write-the graphics rotor cad-output-tree))))))
	       url))

   (stl-url (let ((url (format nil "~a/model.stl" (the url))))
	      (publish :path url
		       :function #'(lambda(req ent)
				     (with-http-response (req ent)
				       (with-http-body (req ent)
					 (with-format (stl (request-reply-stream req))
					   (write-the graphics rotor cad-output-tree))))))
	       url))

   (x3d-url (let ((url (format nil "~a/model.x3d" (the url))))
	      (publish :path url
		       :function #'(lambda(req ent)
				     (with-http-response (req ent)
				       (with-http-body (req ent)
					 (with-format (x3d (request-reply-stream req))
					   (write-the graphics rotor cad-output-tree))))))
	       url))



   (additional-header-content 
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
52
53
54
55
56
57
58
59
60
    (with-cl-who-string ()
      (:p (when *developing?* (str (the development-links))))
      (:style :type "text/css" :media "all"
              (str (format nil " @import url(~a);" (the css-style))))))
   
   (title "WT Demo 1")
   (main-sheet-body
    (with-cl-who-string ()
      (:div :id "wrapper"
61
62
63
64
65
66
            ((:div :id "header")
	     (:center (:h1 "Wind Turbine Geometry Demo")
		      ((:a :href "https://github.com/genworks/Genworks-GDL/tree/master/demos/wind-demo-1/source" :target "_sources")
		       (:i "source code"))))

		  
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
            (:div :id "left"
                  (:div :id "logo"
                        (:h1 "KE-Works S.R.L. & Genworks International")
                        (:p "It's all possible"))
                  (:div :id "news"
                        (:h2 "General inputs")
                        (:div :id "end-input-head")
                        (str (the general-inputs main-div)))
                  (:div :id "end-input")
                  (:div :id "disp-comp"   
                        (:h2 "Displayed component")        
                        (:div :id "end-input-head")     
                        (:p)
                        (str (the displayed-component main-div))))
            (:div :id "data-export"
                  (:div :id "left-export"
                        (:div :id "data-export-t"
                              (:h2 "Data Export")
                              (:div :id "end-input-head")
                              (str (the export-section main-div))))
                  (:div :id "left-export"
                        (:div :id "data-export-t"
                              (:h2 "Turbine characteristics")
                              (:div :id "end-input-head")
                              (str (the turbine-characteristics-1 main-div))))
                  (:div :id "left-export"
                        (:div :id "data-export-t"
                              (:h2 "Turbine characteristics")
                              (:div :id "end-input-head")
                              (str (the turbine-characteristics-2  main-div))))
                  (:div :id "right"
                        (:h2 
                         (:form " WT reference input data file"
                                (:input  :size "25" :type "file" :name "ref-input" :accept="data/")))
Dave Cooper's avatar
Dave Cooper committed
101
                        (str (the  graphics main-div))
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
                        (:h2 "Description")
                        (:div :class "scroll"
                              (:p "This quantification was made based on the next assumption: price of the wind turbine 1 mill/MW and 451/t price of raw steel plates. In the case of transport and installation, an equal value was allocated arbitrary to serve as input for the model implementation. Even though the assumptions reflects the reality with a ± 10% error, the assumed cost structure serves as a reference to develop a parametric model in which the identified manufacturing transport and installation processes are deeply investigated. The presented cost structure is valid just for the existing tower concepts. To account for the new concept, the identified cost structure has to be breaked in its constituent sub-parts (human resources, machining time, machining energy consumption, etc.). The model should be able to substitute processes like longitudinal welding with drilling and bolt-assembly."))))
            (:div :class"clear")
            (:div :id "footer"
                  (:div :id "copyright"
                        "Copyright © 2011 Copyright KE-Works S.R.L Romania and Genworks International All right reserved.")
                  (:div :id "footerline")
                  )))))     
  
  
  :objects
  
  ((general-inputs :type 'general-inputs)
   (displayed-component :type 'displayed-component)
117
118
   (export-section :type  'export-section
		   :pass-down (iges-url step-url stl-url x3d-url))
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
119
120
121
122
123
124
125
126
127
128
   (turbine-characteristics-1 :type  'turbine-characteristics-1)
   (turbine-characteristics-2 :type  'turbine-characteristics-2)
   (graphics :type 'graphics
             :blade-concepts (the displayed-component blade-concepts value)
             :number-of-blades (the general-inputs number-of-blades value)
             :geometry (the displayed-component component-display-control value)
             )))

(define-object general-inputs (sheet-section)
  :computed-slots
129
130
131
  ((max-blades 12)

   (main-view (with-cl-who-string ()
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
                ((:table :class "input_area")
                 ((:col  :width "90%")
                  (:tr (:td) (:td))
                  (:tr
                   ((:td) "Number of blades")
                   ((:td :align "right") (str (the number-of-blades html-string))))
                  (:tr 
                   (:td "Pitch angle")
                   ((:td :align "right") (str (the hub-hight html-string))))
                  (:tr 
                   (:td "Tilt angle")
                   ((:td :align "right") (str (the tilt-angle html-string))))
                  (:tr 
                   (:td "Precone angle")
                   ((:td :align "right") (str (the precone-angle html-string)))))))))
     
  :objects
  ((number-of-blades :type 'text-form-control
                     :default 3
                     :prompt nil
                     :size 1
153
154
155
156
157
		     :validation-function #'(lambda(value) (if (and (integerp value)
								    (<= 1 value (the max-blades)))
							       t
							       (list :validated-value (the-child default) :error "The value must be an integer between 1 and 12, inclusive.")))
		     :allow-invalid? nil
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
                     :ajax-submit-on-change? t)
   
   (hub-hight :type 'text-form-control
              :default 0
              :prompt nil
              :size 1
              :ajax-submit-on-change? t)               
   
   (tilt-angle :type 'text-form-control
               :prompt nil
               :default 13
               :size 1
               :ajax-submit-on-change? t)                          
   
   (precone-angle :type 'text-form-control
                  :prompt nil
                  :default 13
                  :size 1
                  :ajax-submit-on-change? t)))
   
(define-object export-section (sheet-section)
  
180
181
  :input-slots (iges-url step-url stl-url x3d-url)

Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
182
183
184
185
186
187
188
189
  :computed-slots
  
  ((main-view (with-cl-who-string ()
                ((:table :class "input_area")
                 ((:col  :width "80%")
                  (:tr (:td) (:td))
                  (:tr
                   ((:td) "IGES file")
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
                   ((:td :align "right") 
		    ((:a :href (the iges-url) :target "cad-data") "Flat"))
		   ((:td :align "right")
		    ((:span :title "coming soon...") "Assembly")))
		  (:tr
                   ((:td) "STEP file")
                   ((:td :align "right") 
		    ((:a :href (the step-url) :target "cad-data") "Flat"))
		   ((:td :align "right")
		    ((:span :title "coming soon...") "Assembly")))
		  (:tr
                   ((:td) "STL file")
                   ((:td :align "right") 
		    ((:a :href (the stl-url) :target "cad-data") "Flat"))
		   ((:td :align "right")
		    ((:span :title "coming soon...") "Assembly")))
		  
		  (:tr
                   ((:td) "X3D file")
                   ((:td :align "right") 
		    ((:span :title "not available...") "Flat"))
		   ((:td :align "right")
		    ((:a :href (the x3d-url) :target "cad-data") "Assembly")))

		  #+nil
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
                  (:tr 
                   (:td "PNG")
                   ((:td :align "right") (:button  :onClick "www.ke-works.ro" (:i "Download"))))))))))

(define-object turbine-characteristics-1 (sheet-section)
  
  :computed-slots
    
  ((main-view (with-cl-who-string ()
                ((:table :class "input_area")
                 ((:col  :width "80%")
                  (:tr (:td) (:td))
                  (:tr
                   ((:td) "Total mass")
                   ((:td :align "right") (:a (str (format nil "~at"(the total-mass))))))
                  (:tr 
                   (:td "Rotor mass")
                   ((:td :align "right")  (:a (str (format nil "~at"(the rotor-mass))))))
                  (:tr 
                   (:td "Blade mass")
                   ((:td :align "right") (:a (str (format nil "~at"(the blade-mass))))))
                  (:tr 
                   (:td "Nacelle mass")
                   ((:td :align "right") (:a (str (format nil "~at"(the nacelle-mass))))))
                  (:tr 
                   (:td "Power output")
                   ((:td :align "right") (:a (str (format nil "~aMW"(the power-output))))))))))

 
    (total-mass 1200)
    (rotor-mass 300)
    (blade-mass 100)
    (nacelle-mass 400)
    (power-output 5)
   ))
 
(define-object turbine-characteristics-2 (sheet-section)
  
  :computed-slots
  
  ((main-view (with-cl-who-string ()
                ((:table :class "input_area")
                 ((:col  :width "80%")
                  (:tr (:td) (:td))
                  (:tr
                   ((:td) "Data 1 ...etc")
                   ((:td :align "right") (:a (str (format nil "~a"(the total-mass))))))
                  (:tr 
                   (:td "Data 2 ...etc")
                   ((:td :align "right")  (:a (str (format nil "~a"(the rotor-mass))))))
                  (:tr 
                   (:td "Data 3 ...etc")
                   ((:td :align "right") (:a (str (format nil "~a"(the blade-mass))))))
                  (:tr 
                   (:td "Data 4 ...etc")
                   ((:td :align "right") (:a (str (format nil "~a"(the nacelle-mass))))))
                  (:tr 
                   (:td "Data 5 ...etc")
                   ((:td :align "right") (:a (str (format nil "~a"(the power-output))))))))))
                 
   
   (total-mass 88888)
   (rotor-mass 88888)
   (blade-mass 88888)
   (nacelle-mass 88888)
   (power-output 88888)
   ))

Dave Cooper's avatar
Dave Cooper committed
283
(define-object graphics (sheet-section base-object)
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
  
  :input-slots (geometry number-of-blades blade-concepts)
  :computed-slots ((displayed-geometry 
                    (list 
                     :wt-assembly
                     (flatten (list (list-elements (the-object (the rotor rotor-assembly) hub))
                                    (mapcar #'(lambda(leaves) (list-elements leaves))
                                            (list-elements (the-object (the rotor rotor-assembly) blade)))
                                    (the rotor tower)
                                    (list-elements (the-object (the rotor rotor-assembly) turbine-nacelle))))
                                   
                     :rotor-assembly
                     (flatten (list 
                               (list-elements (the-object (the rotor rotor-assembly) hub))
                               (mapcar #'(lambda(leaves) (list-elements leaves))
                                       (list-elements (the-object (the rotor rotor-assembly) blade)))))
                     
                     :hub-assembly (list-elements (the-object (the rotor rotor-assembly) hub))
                     :nacell-assembly (list-elements (the-object (the rotor rotor-assembly) turbine-nacelle ))
                     :blade (list-elements (the-object (the rotor rotor-assembly) rotor-hidded))
Dave Cooper's avatar
Dave Cooper committed
304
305
306
307
                     :tower (list (the rotor tower))))
		   
		   (inner-html (the graphics inner-html))

308
309
		   (js-to-eval (the graphics js-to-eval))

Dave Cooper's avatar
Dave Cooper committed
310
311
		   )

Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
312
313
314
315
316
317
  
  :objects               
  ((rotor :type 'assembly
          :blade-concepts (the blade-concepts)
          :nr-blades-data (the number-of-blades))
   
318
   #+nil
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
319
320
321
   (box :type 'surf::test-b-spline-surface
        :sequence (:size 30))
   
Dave Cooper's avatar
Dave Cooper committed
322
   (graphics :type 'base-ajax-graphics-sheet
323
324
	     :hidden? t
	     :respondent (the respondent)
Dave Cooper's avatar
Dave Cooper committed
325
326
327
328
329
330
	     :image-format-default :png
	     :view-direction-default :trimetric
	     :viewport-border-default 0
	     :display-list-objects (getf (the displayed-geometry) (the geometry ))
	     :length 702
	     :width 690)))
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
331
332
333
334
335
336
    
  
 (define-object displayed-component (sheet-section)
  :computed-slots
  ((main-view (with-cl-who-string ()
                (str (the component-display-control html-string))
337
		#+nil
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
338
339
340
                (:h3 (str (if (eql (the component-display-control value) :rotor-assembly)
                             "Blade concepts"       
                            "" )))
341
		#+nil
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
                (str (if (eql (the component-display-control value) :rotor-assembly)
                         (the blade-concepts html-string) ""))
                )))
               
   :objects               
   ((component-display-control :type 'menu-form-control
                              :choice-plist (list  :wt-assembly "Turbine assembly all comp."
                                                   :rotor-assembly "Rotor assembly"
                                                   :hub-assembly "Hub assembly"
                                                   :nacell-assembly "Nacell assembly"
                                                   :blade "Blade"
                                                   :tower "Tower") 
                                                   :default :wt-assembly
                                                   :size 1
                                                   :prompt nil
                                                   :ajax-submit-on-change? t)
    
    
    (blade-concepts :type 'menu-form-control
361
362
363
364
365
366
367
368
		    :choice-plist (list  :classic-blade "Classic blade"
					 :blade-with-flaps "Blade with flaps"
					 :blade-with-morfin-tip "Blade with morfin tip"
					 :blade-with-m-tip-flaps "Blade with M-tip-flaps")
		    :default  :classic-blade
		    :size 1
		    :prompt nil
		    :ajax-submit-on-change? t)
Teodor Gelu Chiciudean's avatar
Teodor Gelu Chiciudean committed
369
370
371
372
373
374
375
376
377
378
    
    
    
    ))



(publish-gwl-app "/demo-1"
                 "wind::demo-1")

379
380
(publish-directory :prefix "/css-demo-1"
                   :destination (format nil "~a" (merge-pathnames "css-demo-1" *data-pathname*)))
381
382
383
384
385

(defun init ()
  (setq *data-pathname* "~dcooper8/genworks-gdl/demos/wind-demo-1/data/")
  (publish-directory :prefix "/css-demo-1"
		     :destination (format nil "~a" (merge-pathnames "css-demo-1" *data-pathname*))))