Skip to content
Snippets Groups Projects
Verified Commit 66b1a6e0 authored by Christine Lemmer-Webber's avatar Christine Lemmer-Webber
Browse files

Enter the first part of the building measurement stuff!

parent b58b4930
No related branches found
No related tags found
No related merge requests found
......@@ -112,4 +112,60 @@
;; (test-equal (interval-high f2c-interval)
;; 290/9))
;; This is straight from Radul's dissertation
(define (fall-duration t h)
;; gravity
(define g (make-interval 9.789 9.832))
;; time, squared
(define t^2 (e:square t))
;; gravity times time squared
(define gt^2 (e:* g t^2))
;; height: one half of gravity squared
;; (height was already passed in,
;; so we use wiring diagram style)
(c:* 1/2 gt^2 h))
(define (similar-triangles s-ba h-ba s h)
(let ((ratio (spawn-pcell)))
(c:* s-ba ratio h-ba)
(c:* s ratio h)))
(define barometer-height (prun (spawn-pcell)))
(define barometer-shadow (prun (spawn-pcell)))
(define building-height (prun (spawn-pcell)))
(define building-shadow (prun (spawn-pcell)))
(prun
(similar-triangles barometer-shadow barometer-height
building-shadow building-height))
;; Add shadows information first
(prun (add-content building-shadow (make-interval 54.9 55.1)))
(prun (add-content barometer-height (make-interval 0.3 0.32)))
(prun (add-content barometer-shadow (make-interval 0.36 0.37)))
(test-eqv (prun (interval-low (content building-height)))
44.51351351351351)
(test-eqv (prun (interval-high (content building-height)))
48.977777777777774)
;; now let's add the fall time
(define fall-time (prun (spawn-pcell)))
(prun (fall-duration fall-time building-height))
(prun (add-content fall-time (make-interval 2.9 3.1)))
;; the lower bound should be the same...
(test-eqv (prun (interval-low (content building-height)))
44.51351351351351)
;; but the upper bound should be more precise
(test-eqv (prun (interval-high (content building-height)))
47.24276000000001)
;; but now the network has even refined *our* measurements!
(test-eqv (prun (interval-low (content barometer-height)))
0.3) ; stayed the same
(test-eqv (prun (interval-high (content barometer-height)))
0.3183938287795994) ; used to be 0.32!
(test-end "test-brainy")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment