-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
## Developer's Guide | ||
|
||
### Content | ||
|
||
- [General Organization](#general-organization) | ||
- [Developing New Models](#developing-new-models) | ||
|
||
### General Organization | ||
|
||
The main parts of this repository are listed below. | ||
|
||
Item | Type | Description | ||
------------------ | -------------------- | ----------- | ||
`pml.py` | File (Python module) | Top level module (`pml` tool) | ||
`gml.py` | File (Python module) | Top level module (`gml` tool) | ||
`graph.py` | File (Python module) | Graph class | ||
`generator.py` | File (Python module) | XML generation functions | ||
`doc` | Directory | Documentation | ||
`templates` | Directory | Model template files | ||
`ro` | Directory | Ring oscillator application | ||
`traverse1` | Directory | Asynchronous network traversal application | ||
|
||
### Developing New Models | ||
|
||
Models can be added by creating new Jinja template files and saving them as | ||
`templates/MODEL_NAME/template.xml`. Templates should create a compliant POETS | ||
XML file using the configuration and graph objects passed by `pml` through | ||
Jinja's context. | ||
|
||
For example, to create the `<MessageTypes>` section, the template can include | ||
|
||
```xml | ||
<MessageTypes> | ||
{% for id, content in messages.items() %} | ||
<MessageType id="{{ id }}"> | ||
<Documentation>{{ content['doc'] }}</Documentation> | ||
</MessageType> | ||
{% endfor %} | ||
</MessageTypes> | ||
``` | ||
|
||
In the above, `messages` is the dictionary in the application's configuration | ||
file. Other fields from the configuration are made available in Jinja's | ||
context in a similar manner. | ||
|
||
Templates are free in how they use configuration fields. For example, | ||
replacing `messages` above with `msgs` in both the template and configuration | ||
files will result in the same output. However, it is strongly recommended that | ||
you have a look at existing templates and adopt the same structure and | ||
terminology whenever possible. Minimizing differences in model configuration | ||
file structures will reduce the amount of effort required to (1) learn newer | ||
models (2) understand model differences and (3) migrate applications to | ||
different models. | ||
|
0
old-doc.md → doc/old.md
100755 → 100644
File renamed without changes.