diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..960bca73a01cbf4a170fcc7f0755676f3ef3ee57 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/model/ +/odd/ diff --git a/README.md b/README.md index b6aba2bb93691bfb6c1f8fc9f73cd15055307f7f..20157be27e95ebebfb41554029ddcdeeb8fc275d 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,49 @@ This is an example project to demonstrate Literate Programming to create [NetLogo](https://ccl.northwestern.edu/netlogo/) models from ODD+C protocols. +## Rabies model - ODD protocol +### Purpose + + + +### Entities, state variables, and scales + +### Process overview and scheduling + +```netlogo +;- file:Code.nls +; ==> Setup. +; ==> Go. +``` + +```netlogo +;- Go +to go + tick +end +``` + +### Design concepts + +### Initialization + +```netlogo +;- Setup +to setup + reset-ticks +end +``` + +### Input data + +### Submodels + +## Appendix + +### NetLogo file + +In the main `nlogo` file, we only "include" an `nls` file to allow for the reverse mode. +The file `Model.nlogo` is simply copied from the `nlogo` directory via option `code_files` in the `[paths]` section of the `Yarner.toml`. + +This separation of model code and user interface also allows to edit the model's UI elements in NetLogo's GUI builder tool, while using Literate Programming for the code. diff --git a/Yarner.toml b/Yarner.toml index 1a0bd520ec895d720c8c847a7e750ac4ea6de0f2..b52e84ef867b9c86ef7350e3f72da9a35448dd69 100644 --- a/Yarner.toml +++ b/Yarner.toml @@ -2,9 +2,9 @@ fence_sequence = "```" fence_sequence_alt = "~~~" -block_name_prefix = "//-" +block_name_prefix = ";-" -macro_start = "// ==>" +macro_start = "; ==>" macro_end = "." transclusion_start = "@{{" @@ -15,29 +15,25 @@ link_prefix = "@" file_prefix = "file:" hidden_prefix = "hidden:" -# default_language = "rust" - [paths] -root = "lp/" -code = "../model/" -docs = "../odd/" - -files = ["ODD.md"] -# entrypoint = "Main" - -# code_files = ["**/*.rs"] -# code_paths = ["_"] - -# doc_files = ["**/*.png", "**/*.jpg"] -# doc_paths = ["_"] - -# [language.rs] -# clear_blank_lines = true -# eof_newline = true - - # [language.rs.block_labels] - # comment_start = "//" - ## comment_end = "*/" - # block_start = "<@" - # block_next = "<@>" - # block_end = "@>" +root = "." +code = "model/" +docs = "odd/" + +files = ["README.md"] +entrypoint = "Main" # Avoids writing unnamed code blocks + +# NetLogo is not suited to generate the UI from code. +# We therefore use the copy files feature for the base .nlogo file, and for UI. +code_files = ["nlogo/Model.nlogo"] +code_paths = ["-"] + +[language.nls] +clear_blank_lines = true +eof_newline = true + + [language.nls.block_labels] + comment_start = ";" + block_start = "<@" + block_next = "<@>" + block_end = "@>" diff --git a/lp/ODD.md b/lp/ODD.md deleted file mode 100644 index d6221cdfdac3d41e989db0e8a2088df5fdedc0dd..0000000000000000000000000000000000000000 --- a/lp/ODD.md +++ /dev/null @@ -1 +0,0 @@ -# Rabies model - ODD protocol diff --git a/nlogo/Model.nlogo b/nlogo/Model.nlogo new file mode 100644 index 0000000000000000000000000000000000000000..9437b79e9e9fae528c8e37d7be911ce7aab46025 --- /dev/null +++ b/nlogo/Model.nlogo @@ -0,0 +1,94 @@ +__includes["Code.nls"] +@#$#@#$#@ +GRAPHICS-WINDOW +220 +10 +733 +524 +-1 +-1 +5.0 +1 +10 +1 +1 +1 +0 +1 +1 +1 +0 +100 +0 +100 +1 +1 +1 +ticks +30.0 + +BUTTON +10 +10 +80 +50 +NIL +setup +NIL +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +BUTTON +90 +10 +160 +50 +NIL +go +T +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +@#$#@#$#@ +## WHAT IS IT? + +## HOW IT WORKS + +## HOW TO USE IT +@#$#@#$#@ +default +true +0 +Polygon -7500403 true true 150 5 40 250 150 205 260 250 +@#$#@#$#@ +NetLogo 6.1.0 +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +default +0.0 +-0.2 0 0.0 1.0 +0.0 1 1.0 0.0 +0.2 0 0.0 1.0 +link direction +true +0 +Line -7500403 true 150 150 90 180 +Line -7500403 true 150 150 210 180 +@#$#@#$#@ +0 +@#$#@#$#@