110 likes | 214 Views
Tutorial „Modelling in the language XL“ University of Göttingen (Germany), September 21/22, 2009 Winfried Kurth Steps towards modelling poplar trees related material: XL code files sm09_e??.rgg URL http://www.uni-forst.gwdg.de/~wkurth/ and drive T:gg on CIP pool stations.
E N D
Tutorial „Modelling in the language XL“ University of Göttingen (Germany), September 21/22, 2009 Winfried Kurth Steps towards modelling poplar trees related material: XL code files sm09_e??.rgg URL http://www.uni-forst.gwdg.de/~wkurth/ and drive T:\rgg on CIP pool stations
increasingly elaborated versions of a (preliminary) model of 1-year-old, unbranched poplar trees versions: sm09_e37.gsz modules with user-defined methods; use of transformation matrices sm09_e38.gsz internode elongation, counting the days sm09_e39.gsz collection of all constants at the head of the programme sm09_e40.gsz introduction of three leaf maturity classes, arrays with growth parameters
necessary for the distribution of assimilates: modelling of transport processes approach: substrate flows from elements with high concentration to neighbour elements with low concentration (principle of diffusion) example: sm09_e41.rgg (concentration of substrates is here visualized by diameter)
module Internode(super.diameter) extends F(100, diameter); protected void init() [ Axiom ==> P(14) Internode(1) P(2) Internode(1) P(4) Internode(1) P(15) Internode(60); ] public void transport() [ i_top:Internode < < i_bottom:Internode ::> { float r = 0.1 * (i_bottom[diameter] - i_top[diameter]); i_bottom[diameter] :-= r; i_top[diameter] :+= r; } ] (two reverse successor edges, one after the other)
for light interception / photosynthesis: a simple model of overshadowing model approach (strongly simplifying): overshadowing of an object occurs when there are further objects in an imagined cone with its apex in the object, opened into z direction (to the sky). example: sm09_e42.rgg competition of three 2-dimensional model plants for light
module Segment(int t, int ord) extends F0; module TBud(int t) extends F(1, 1, 1); module LBud extends F(0.5, 0.5, 1); Vector3d z = new Vector3d(0, 0, 1); protected void init() [ Axiom ==> P(2) D(5) V(-0.15) [ TBud(-4) ] RU(90) M(600) RU(-90) [ TBud(0) ] RU(-90) M(1200) RU(90) [ TBud(-8) ]; ] public void run() [ TBud(t), (t < 0) ==> TBud(t+1); x:TBud(t), (t >= 0 && empty( (* s:Segment, (s in cone(x, z, 45)) *) ) ) ==> L(random(80, 120)) Segment(0, 0) [ MRel(random(0.5, 0.9)) RU(60) LBud ] [ MRel(random(0.5, 0.9)) RU(-60) LBud ] TBud(t+1); y:LBud, (empty( (* s:Segment, (s in cone(y, z, 45)) *) ) ) ==> L(random(60, 90) Segment(0, 1) RV0 LBud; Segment(t, o), (t < 8) ==> Segment(t+1, o); Segment(t, o), (t >= 8 && o == 1) ==>> ; /* removal of the whole branch */ ]
a further rule type in XL: • instantiation rules • purpose: replacement of single modules by more complicated structures, only for visual representation • (similar as for interpretive rules) • but: less data are stored (less usage of memory) • in contrast to interpretive rules, no turtle commands • with effect on other nodes can be used • further, arising possibility: „replicator nodes“ for copying and relocation of whole structures
instantiation rules: syntax no new sort of rule arrow specification of the instantiation rule directly in the declaration of the module which is to be replaced module A ==> B C D; replaces (instantializes) everywhere A by B C D example sm09_e43.rgg
const int multiply = EDGE_0; /* user-defined edge type */ module Tree ==> F(20, 1) [ M(-8) RU(45) F(6, 0.8) Sphere(1) ] [ M(-5) RU(-45) F(4, 0.6) Sphere(1) ] Sphere(2); module Replicator ==> [ getFirst(multiply) ] Translate(10, 0, 0) [ getFirst(multiply) ]; public void run1() [ Axiom ==> F(2, 6) P(10) Tree; ] public void run2() [ Axiom ==> F(2, 6) P(10) Replicator -multiply-> Tree; ] Tree is instantiated with the red structure inserts all what comes after the „multiply“ edge
further steps towards the poplar model • sm09_b44.gsz • sm09_b45.gsz • in poplar.gsz we have additionally: • insertion of a rule block for the angles, change of angles • during growth • insertion of an object „Sun“ which changes its position • relative to the plant during the day