tutorial and workshop „modelling with groimp and xl“ / tutorial for beginners
DESCRIPTION
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Winfried Kurth Introduction to rule-based programming, L-systems and XL. Motivation Functional-structural plant models (FSPM) „model triangle“: - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/1.jpg)
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginnersUniversity of Göttingen, 27 February, 2012
Winfried Kurth
Introduction to rule-based programming, L-systems and XL
![Page 2: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/2.jpg)
MotivationFunctional-structural plant models (FSPM)
„model triangle“:
• Linking of botanical structures and functions (e.g., light interception, water flow) in a coherent, single model
• processes linked to morphological objects
statistics
aggregated models
structural models
morphology
process models
physiology
functional-structural
models
![Page 3: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/3.jpg)
Structural models
3 levels:
1. static description of structure
plant at a fixed date (e.g., at 27 September 2011)
2. dynamic description of structure, non-sensitive
description of development (ontogenesis) of a plant: time series of 3-dimensional structures
3. dynamics, taking causal impacts / conditions into account (sensitive models)
different paths of development logical conditions for the decision between them (simplest case: stochastic)
![Page 4: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/4.jpg)
concerning 1.: static description of structure
two approaches:
(a) tables
each morphological unit of a plant = one row
dtd code = „descriptive tree data“, or mtg code
(b) imperative (command-driven):
„Turtle geometry“
virtual turtle „constructs“ the structure,
the description are the commands which control it
turtle geometry command language
![Page 5: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/5.jpg)
The second level of description:
Dynamic description of plant structures
• how do plants change during ontogenesis?
![Page 6: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/6.jpg)
The approach of AMAP
Atelier de Modélisation de l‘Architecture des Plantes
Montpellier, Paris, Beijing (LIAMA)
Ph. de Reffye, R. Lecoustre, M. Jaeger, E. Costes,P. Dinouard, F. Blaise, P.-H. Cournède et al.(agronomists, computer scientists, botanists, mathematicians)
Modelling the activity of meristems
shape of tree = trajectory of its meristems
![Page 7: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/7.jpg)
approach for modelling:
shape of tree = trajectory of meristems
• primary meristem
• branching
• secondary meristem
(to be added:mechanic deformations, deformations with physiological causes, damages, processes of senescence and mortality)
![Page 8: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/8.jpg)
meristem-based modelling approach
Adrian D. Bell 1979:
3 basic processes- formation of a shoot (growth)- transition to resting state (and new activation)- death
similarly de Reffye 1981:
3 meristem states
- dormance (sleeping)- croissance (growth)- mortalité (death)
state transitions with probabilities binomial distribution, Markov chains
![Page 9: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/9.jpg)
The software GroIMP„Growth-grammar related Interactive Modelling Platform“
• download from Sourceforge (free & open source)
• rgg files, projects (gsz files)
• editor, environment for development
• window for 3-d view
• 2-d (graph) window (usually hidden!)
• attribute view for each object
• camera position
• navigation
• interactive modelling
• compiler for the programming language XL
• framework for solving ODEs in the context of plant models
![Page 10: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/10.jpg)
XL: a multi-paradigm language
Robert Floyd 1978:
Turing Award Lecture
"The Paradigmsof Programming"
Robert W. Floyd (1936-2001)
![Page 11: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/11.jpg)
Ecosystem:
organisms
behaviour(under certainconditions)
processes
describe structure
determine laws (rules)controlling behaviourcalculate effects
![Page 12: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/12.jpg)
Some important paradigms of programming
- for numerical simulation of processes:
imperative paradigm(also: von-Neumann paradigm,control flow paradigm)
John von Neumann (1903-1957)
![Page 13: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/13.jpg)
imperative programming:
computer = machine for the manipulation of values of variables
(these manipulations can have side effects).
![Page 14: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/14.jpg)
programme = plan for the calculation process with specification of the commands and of the control flow (e.g. loops).
example:
x = 0;while (x < 100) x = x + 1;
![Page 15: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/15.jpg)
programming languages which support imperative programming:
Fortran, Pascal, C, ..., parts of Java, ..., command language of turtle geometry
![Page 16: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/16.jpg)
Turtle:
goes according to commands
![Page 17: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/17.jpg)
F0
![Page 18: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/18.jpg)
F0
![Page 19: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/19.jpg)
F0 RU(90)
![Page 20: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/20.jpg)
F0 RU(90)
![Page 21: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/21.jpg)
F0 RU(90) F0
![Page 22: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/22.jpg)
F0 RU(90) F0
![Page 23: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/23.jpg)
F0 RU(90) F0 RU(90) LMul(0.5) F0
![Page 24: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/24.jpg)
F0 RU(90) F0 RU(90) LMul(0.5) F0
![Page 25: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/25.jpg)
object-oriented paradigm
computer = environment for virtual objects
programme = list of (object) classes, i.e. general specifications of objects, which can be created and destroyed at runtime.
programming languages: Smalltalk, Simula, C++, Java, ...
![Page 26: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/26.jpg)
Inheritance of attributes and methods from superclasses to subclasses
example:
public class Car extends Vehicle { public String name; public int places; public void show()
{System.out.println("The car is a " + name);System.out.println("It has " + places + "places.");}
}
typical:
classes (Car) with data (name, places) and methods (show)
![Page 27: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/27.jpg)
usefulness of object hierarchies in biology
for example:
organ
leaf flower internode root segment
broadleaf
needle coarser.s.
finer.s.
![Page 28: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/28.jpg)
rule-based paradigm
computer = machine transforming structures
There is a current structure (in XL: a graph) which is transformed as long as it is possible.Work process: search and application.matching: search for a suitable rule,rewriting: application of the rule, thereby transformation of the structure.
programme = set of transformation rules
to find a programme: specification of rules.
programming languages: L-system languages, AI languages, Prolog, ...
![Page 29: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/29.jpg)
Example:
a graph grammar
rule:
![Page 30: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/30.jpg)
Example:
a graph grammar
rule:
application:
![Page 31: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/31.jpg)
rule systems for the replacement of character strings
in each derivation step parallel replacement of all characters for which there is one applicable rule
by A. Lindenmayer (botanist) introduced in 1968 to model growth of filamentous algae
L-systems (Lindenmayer systems)
Aristid Lindenmayer (1925-1989)
Dynamical description of structures
![Page 32: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/32.jpg)
L-systems mathematically:
a triple (, , R) with:
a set of characters, the alphabet,
a string with characters from , the start word (also "Axiom"),
R a set of rules of the form
character string of characters;
with the characters taken from .
![Page 33: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/33.jpg)
A derivation step (rewriting) of a string consists of the replacement of all of its characters which occur in left-hand sides of rules by the corresponding right-hand sides.
Convention: characters for which no rule is applicable stay as they are.
Result:
Derivation chain of strings, developed from the start word by iterated rewriting.
1 2 3 ....
![Page 34: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/34.jpg)
Example:
alphabet {A, B}, start word A
set of rules:
A BB AB
A
![Page 35: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/35.jpg)
Example:
alphabet {A, B}, start word A
set of rules:
A BB AB
B
![Page 36: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/36.jpg)
Example:
alphabet {A, B}, start word A
set of rules:
A BB AB
AB
parallel replacement
![Page 37: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/37.jpg)
Example:
alphabet {A, B}, start word A
set of rules:
A BB AB
BAB
![Page 38: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/38.jpg)
Example:
alphabet {A, B}, start word A
set of rules:
A BB AB
BAB
![Page 39: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/39.jpg)
Example:
alphabet {A, B}, start word A
set of rules:
A BB AB
ABBAB
![Page 40: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/40.jpg)
Example:
alphabet {A, B}, start word A
set of rules:
A BB AB
derivation chain:A B AB BAB ABBAB BABABBAB ABBABBABABBAB BABABBABABBABBABABBAB ...
![Page 41: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/41.jpg)
still missing for modelling biological structures in space: a geometrical interpretation
Thus we add:
a function which assigns to each string a subset of 3-D space
„interpreted“ L-system processing
1 2 3 ....
S1 S2 S3 ....
S1, S2, S3, ... can be seen as developmental steps of an
object, a scene or an organism.
![Page 42: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/42.jpg)
For the interpretation:
turtle geometry
the turtle command set becomes a subset of the character set of the L-system.
Symbols which are not turtle commands are ignored by the turtle.
connection with imperative paradigm
![Page 43: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/43.jpg)
imperative object oriented rule based
Java
XL
XL: a synthesis of three paradigms
„eXtended L-system language“
programming language which makes parallel graph-grammars (RGG) accessible in a simple way
![Page 44: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/44.jpg)
F0 RU(90) F0 RU(90) LMul(0.5) F0
turtle geometry
![Page 45: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/45.jpg)
Turtle geometry
„turtle": virtual device for drawing or construction in 2-D or 3-D space
- able to store information (graphical and non-graphical)
- equipped with a memory containing state information (important for branch construction)
- current turtle state contains e.g. current line thickness, step length, colour, further properties of the object which is constructed next
![Page 46: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/46.jpg)
Turtle commands in XL (selection):
F0 "Forward", with construction of an element (line segment, shoot, internode...), uses as length the current step size
(the zero stands for „no explicit specification of length")
M0 forward without construction (Move)
L(x) change current step size (length) to x
LAdd(x) increment the current step size to x
LMul(x) multiply the current step size by x
D(x), DAdd(x), DMul(x) analogously for current thickness
![Page 47: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/47.jpg)
Repetition of substrings possible with "for"
e.g., for ((1:3)) ( A B C )
yields A B C A B C A B C
what is the result of the interpretation of
L(10) for ((1:6)) ( F0 RU(90) LMul(0.8) ) ?
![Page 48: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/48.jpg)
L(10) for ((1:6)) ( F0 RU(90) LMul(0.8) )
![Page 49: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/49.jpg)
further example:
for ((1:20)) ( for ((1:36))
( F0 RU(165) F0 RU(165) ) RU(270) )
![Page 50: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/50.jpg)
further example:
for ((1:20)) ( for ((1:36))
( F0 RU(165) F0 RU(165) ) RU(270) )
![Page 51: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/51.jpg)
Extension to 3-D graphics:
turtle rotations by 3 axes in space
![Page 52: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/52.jpg)
head
left
up
Extension to 3-D graphics:
turtle rotations by 3 axes in space
![Page 53: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/53.jpg)
RHRL
RU
Extension to 3-D graphics:
turtle rotations by 3 axes in space
![Page 54: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/54.jpg)
3-D commands:
RU(45) rotation of the turtle around the "up" axis by 45°
RL(...), RH(...) analogously by "left" and "head" axis
up-, left- and head axis form an orthogonal spatial coordinate system which is carried by the turtle
RV(x) rotation "to the ground" with strength given by x
RG rotation absolutely to the ground (direction (0, 0, -1))
![Page 55: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/55.jpg)
Example:
L(100) D(3) RU(-90) F(50) RU(90) M0 RU(90) D(10) F0 F0
D(3) RU(90) F0 F0 RU(90) F(150) RU(90) F(140) RU(90)
M(30) F(30) M(30) F(30) RU(120) M0 Sphere(15) generates
![Page 56: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/56.jpg)
Branches: realization with memory commands
[ put current state on stack ("Ablage", Stack)
] take current state from stack and let it become the current state (thus: end of branch!)
F0 [ RU(-20) F0 ] RU(20) DMul(2) F0
![Page 57: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/57.jpg)
How to execute a turtle command sequence with GroIMP
write into a GroIMP project file (or into a file with filename extension .rgg):
protected void init()
[
Axiom ==> turtle command sequence ;
]
![Page 58: Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners](https://reader035.vdocuments.mx/reader035/viewer/2022081421/56813c30550346895da5af0a/html5/thumbnails/58.jpg)
Example: Drawing a triangle
protected void init() [ Axiom ==> RU(30) F(10) RU(120) F(10) RU(120) F(10) ]
see file sm09_e01.rgg