Skip to content

Commit 6ede5fd

Browse files
authored
Merge pull request #733 from mimiframework/readme
Docs updates
2 parents 5bd2744 + 1f00a2a commit 6ede5fd

File tree

11 files changed

+70
-73
lines changed

11 files changed

+70
-73
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77

88
Mimi is a [Julia](http://julialang.org) package that provides a component model for [integrated assessment models](https://en.wikipedia.org/wiki/Integrated_assessment_modelling), as described in detail on the [Mimi Framework Homepage](https://www.mimiframework.org). The [Documentation](https://www.mimiframework.org/Mimi.jl/stable/) includes information on the installation and use of this package, step-by-step tutorials, how-to guides, and techincal reference. The development team closely monitors the [Mimi Framework forum](https://forum.mimiframework.org) and we suggest this as a starting place for any questions users may have.
99

10+
## NEWS
11+
12+
On 7/15/2020 we officially tagged and released Mimi v1.0.0, which has some new features, documentation, and quite a bit of internals work as well. Since this is a major version change, there are some breaking changes that may require you to update your code. We have done the updates for the existing models in the Mimi registry (FUND, DICE, etc.), and will release new major versions of those today as well, so if you are using the latest version of Mimi and the latest version of the packages, all should run smoothly.
13+
14+
**Please view the how to guide here: https://www.mimiframework.org/Mimi.jl/stable/howto/howto_6/ for a run-down of how you should update your own code.**
15+
16+
In addition please do not hesitate to ask any questions on the forum, we are working hard to keep this transition smooth.
17+
1018
## Contributions and Questions
1119

1220
You can interact with the Mimi development team via issues and pull requests here on github, and in the [Mimi Framework forum](https://forum.mimiframework.org). Contributions to Mimi are also most welcome, and

docs/make.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ makedocs(
3131
"Reference Guides" => Any[
3232
"Reference Guides Intro" => "ref/ref_main.md",
3333
"Mimi API" => "ref/ref_API.md",
34-
"Structures: Overview" => "ref/ref_structures_1_overview.md",
35-
"Structures: Definitions" => "ref/ref_structures_2_definitions.md",
36-
"Structures: Instances" => "ref/ref_structures_3_instances.md"
34+
"Structures" => "ref/ref_structures.md",
35+
"Structures: Definitions" => "ref/ref_structures_definitions.md",
36+
"Structures: Instances" => "ref/ref_structures_instances.md"
3737
],
3838
"FAQ" => "faq.md",
3939
],

docs/src/howto/howto_6.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ The release of Mimi v1.0.0 is a breaking release, necessitating the adaptation o
44

55
This guide provides an overview of the steps required to get most models using the v0.9.5 API working with v1.0.0. It is **not** a comprehensive review of all changes and new functionalities, but a guide to the minimum steps required to port old models between versions. For complete information on the new version and its additional functionalities, see the full documentation.
66

7-
To port your model, we recommend you update to **Mimi v0.10.0**, which is identical to Mimi v1.0.0 **except** that it includes deprecation warnings for most breaking changes, instead of errors. This means that models written using Mimi v0.9.5 will, in most cases, run successfully under Mimi v0.10.0 and things that will cause errors in v1.0.0 will throw deprecation warnings. your changes. These can guide Thus a good workflow would be:
7+
## Workflow Advice
8+
9+
To port your model, we recommend you update to **Mimi v0.10.0**, which is identical to Mimi v1.0.0 **except** that it includes deprecation warnings for most breaking changes, instead of errors. This means that models written using Mimi v0.9.5 will, in most cases, run successfully under Mimi v0.10.0 and things that will cause errors in v1.0.0 will throw deprecation warnings. These can guide your changes, and thus a good workflow would be:
810

911
1) Update your environment to use Mimi v0.10.0 with
10-
```julia
11-
pkg> add Mimi#v0.10.0
12-
```
12+
```julia
13+
pkg> add Mimi#v0.10.0
14+
```
1315
2) Read through this guide to get a sense for what has changed
1416
3) Run your code and incrementally update it, using the deprecation warnings as guides for what to change and the instructions in this guide as explanations, until no warnings are thrown and you have changed anything relevant to your code that is explained in this gude.
15-
5) Update to Mimi v1.0.0 with the following code, which will update Mimi to it's latest version, v1.0.0
16-
```julia
17-
pkg> free Mimi
18-
```
19-
6) Run your model! Things should run smoothly now. If not double check the guide, and feel free to reach out on the forum with any questions. Also, if you are curious about the reasons behind a change, just ask!
17+
4) Update to Mimi v1.0.0 with the following code, which will update Mimi to it's latest version, v1.0.0
18+
```julia
19+
pkg> free Mimi
20+
```
21+
5) Run your model! Things should run smoothly now. If not double check the guide, and feel free to reach out on the forum with any questions. Also, if you are curious about the reasons behind a change, just ask!
2022

2123
This guide is organized into a few main sections, each descripting an independent set of changes that can be undertaken in any order desired.
2224

@@ -33,9 +35,11 @@ This guide is organized into a few main sections, each descripting an independen
3335
#### Type-parameterization for Parameters
3436

3537
*The Mimi Change:*
38+
3639
To be consistent with julia syntax, Mimi now uses bracketing syntax to type-parameterize `Parameter`s inside the `@defcomp` macro instead of double-colon syntax. h
3740

3841
*The User Change:*
42+
3943
Where you previously indicated that the parameter `a` should be an `Int` with
4044
```julia
4145
@defcomp my_comp begin
@@ -56,9 +60,11 @@ end
5660
#### Integer Indexing
5761

5862
*The Mimi Change:*
63+
5964
For safety, Mimi no longer allows indexing into `Parameter`s or `Varaible`s with the `run_timestep` function of the `@defcomp` macro with integers. Instead, this functionality is supported with two new types: `TimestepIndex` and `TimestepValue`. Complete details on indexing options can be found in How-to Guide 4: Work with Timesteps, Parameters, and Variables, but below we will describe the minimum steps to get your models working.
6065

6166
*The User Change:*
67+
6268
Where you previously used integers to index into a `Parameter` or `Variable`, you should now use the `TimestepIndex` type. For example, the code
6369
```julia
6470
function run_timestep(p, v, d, t)
@@ -84,19 +90,22 @@ function run_timestep(p, v, d, t)
8490
end
8591
```
8692

87-
#### is_timestep and is_time
93+
#### `is_timestep` and `is_time`
8894

8995
*The Mimi Change:*
96+
9097
For simplicity and consistency with the change above, Mimi no longer supports the `is_timestep` or `is_time` functions and has replaced this functionality with comparison operators combined with the afformentioned `TimestepValue` and `TimestepIndex` types.
9198

9299
*The User Change:*
100+
93101
Any instance of the `is_timestep` function should be replaced with simple comparison with a `TimestepIndex` object ie. replace the logic `if is_timestep(t, 10) ...` with `if t == TimestepIndex(10) ...`.
94102

95103
Any instance of the `is_time` function should be repalced with simple comparison with a `TimestepValue` object ie. replace the logic `if is_time(t, 2010) ...` with `if t == TimestepValue(2010) ...`.
96104

97105
## The set_param! Function
98106

99107
*The Mimi Change:*
108+
100109
The `set_param!` method for setting a parameter value in a component now has the following signature:
101110
```
102111
set_param!(m::Model, comp_name::Symbol, param_name::Symbol, ext_param_name::Symbol, val::Any)
@@ -117,6 +126,7 @@ set_param!(m::Model, comp_name::Symbol, param_name::Symbol, val::Any)
117126
This method creates a new external parameter called `param_name` in the model `m` (if that already exists, it errors), sets its value to `val`, and then connects the parameter `param_name` in component `comp_name` to this newly created external parameter.
118127
119128
*The User Change:*
129+
120130
Any old code that uses the `set_param!` method with only 4 arguments (shortcut #2 shown above) will still work for setting parameters **if they are found in only one component** ... but if you have multiple components that have parameters with the same name, using the old 4-argument version of `set_param!` multiple times will cause an error. Instead, you need to determine what behavior you want across multiple components with parameters of the same name:
121131
- If you want parameters with the same name that are found in multiple components to have the _same_ value, use the 3-argument method: `set_param!(m, :param_name, val)`. You only have to call this once and it will set the same value for all components with an unconnected parameter called `param_name`.
122132
- If you want different components that have parameters with the same name to have _different_ values, then you need to call the 5-argument version of `set_param!` individually for each parameter value, such as:
@@ -134,9 +144,11 @@ This updates the value of the external parameter called `ext_param_name` in the
134144
## The replace_comp! Function
135145
136146
*The Mimi Change:*
147+
137148
For simplicity, the `replace_comp!` function has been replaced with a method augmenting the julia Base `replace!` function.
138149
139-
*The User Change:*
150+
*The User Change:*
151+
140152
Where you previously used
141153
```julia
142154
replace_comp!(m, new, old)
@@ -149,17 +161,21 @@ replace!(m, old => new)
149161
## Different-length Components
150162

151163
*The Mimi Change:*
164+
152165
Through Mimi v0.9.4, the optional keyword arguments `first` and `last` could be used to specify times for components that do not run for the full length of the model, like this: `add_comp!(mymodel, ComponentC; first=2010, last=2100)`. This functionality is still disabled, as it was starting in v0.9.5, and all components must run for the full length of the model's time dimension. This functionality may be re-implemented in a later version of Mimi.
153166

154167
*The User Change:*
168+
155169
Refactor your model so that all components are the same length. You may use the `run_timestep` function within each component to dictate it's behavior in different timesteps, including doing no calculations for a portion of the full model runtime.
156170

157171
## Marginal Models
158172

159173
*The Mimi Change:*
174+
160175
For clarity, the previously named `marginal` attribute of a Mimi `MarginalModel` has been renamed to `modified`. Hence a `MarginalModel` is now described as a Mimi `Model` whose results are obtained by subtracting results of one `base` Model from those of another `marginal` Model that has a difference of `delta` with the signature:
161176

162177
*The User Change:*
178+
163179
Any previous access to the `marginal` attribute of a `MarginalModel`, `mm` below, should be changed from
164180
```julia
165181
model = mm.marginal
@@ -173,9 +189,11 @@ model = mm.modified
173189
#### Results Access
174190

175191
*The Mimi Change:*
192+
176193
For clarity of return types, Mimi no longer supports use of square brackets (a shortcut for julia Base `getindex`) to access the results of a Monte Carlo analysis, which are stored in the `SimulationInstance`. Instead, access to resulst is supported with the `getdataframe` function, which will return the results in the same type and format as the square bracket method used to return.
177194

178195
*The User Change:*
196+
179197
Results previously obtained with
180198
```julia
181199
results = si[:grosseconomy, :K]
@@ -187,9 +205,11 @@ results = getdataframe(si, :grosseconomy, :K)
187205
#### Simulation Definition Modification Functions
188206

189207
*The Mimi Change:*
208+
190209
For consistency with julia syntax rules, the small set of unexported functions available to modify an existing `SimulationDefinition` have been renamed, moving from a camel case format to an underscore-based format as follows.
191210

192211
*The User Change:*
212+
193213
Replace your functions as follows.
194214

195215
- `deleteRV!` --> `delete_RV!`
@@ -203,7 +223,9 @@ Replace your functions as follows.
203223
## Composite Components (optional)
204224

205225
*The Mimi Change:*
226+
206227
The biggest functionality **addition** of Mimi v1.0.0 is the inclusion of composite components. Prior versions of Mimi supported only "flat" models, i.e., with one level of components. This new version supports mulitple layers of components, with some components being "final" or leaf components, and others being "composite" components which themselves contain other leaf or composite components. This approach allows for a cleaner organization of complex models, and allows the construction of building blocks that can be re-used in multiple models.
207228

208229
*The User Change:*
230+
209231
All previous models are considered "flat" models, i.e. they have only one level of components, and do **not** need to be converted into multiple layer models to run. Thus this addition does not mean users need to alter their models, but we encourage you to check out the other documentation on composite components to learn how you can enhance your current models and built better onces in the future!

docs/src/howto/howto_main.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,24 @@
11
# How-to Guides Introduction
22

3-
The following how-to guides provide steps to carry out several common real-world problems that Mimi is targeted at solving. They are a bit less detailed than the tutorials, and are thus targeted at a user with some level of experience with Mimi (likely obtained through moving through some or all of the tutorials).
3+
The following how-to guides provide steps to work through several common real-world problems that Mimi is targeted at solving. They are a bit less detailed than the tutorials, and are thus targeted at a user with some level of experience with Mimi (likely obtained through moving through some or all of the tutorials).
44

55
If you find a bug in these guides, or have a clarifying question or suggestion, please reach out via Github Issues or our [Mimi Framework forum](https://forum.mimiframework.org). We welcome your feedback.
66

77
## Available How-to Guides
88

9-
1. **Construct and Run a Flat Model**
9+
1. [How-to Guide 1: Construct and Run a Model](@ref)
1010

11-
[How-to Guide 1: Construct and Run a Model](@ref)
1211

12+
2. [How-to Guide 2: View and Explore Model Results](@ref)
1313

14-
2. **View and Explore Model Results**
1514

16-
[How-to Guide 2: View and Explore Model Results](@ref)
15+
3. [How-to Guide 3: Conduct Sensitivity Analysis](@ref)
1716

1817

19-
3. **Conduct Sensitivity Analysis**
18+
4. [How-to Guide 4: Work with Timesteps, Parameters, and Variables](@ref)
2019

21-
[How-to Guide 3: Conduct Sensitivity Analysis](@ref)
2220

21+
5. [How-to Guide 5: Port to Mimi v0.5.0](@ref)
2322

24-
4. **Work with Timesteps, Parameters, and Variables**
2523

26-
[How-to Guide 4: Work with Timesteps, Parameters, and Variables](@ref)
27-
28-
29-
5. **Port to Mimi v0.5.0**
30-
31-
[How-to Guide 5: Port to Mimi v0.5.0](@ref)
32-
33-
34-
6. **Port to Mimi v1.0.0**
35-
36-
[How-to Guide 6: Port from (>=) Mimi v0.5.0 to Mimi v1.0.0](@ref)
24+
6. [How-to Guide 6: Port from (>=) Mimi v0.5.0 to Mimi v1.0.0](@ref)
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# Advanced How-to Guides Introduction
22

3-
The following how-to guides provide steps to carry out more specified and advanced real-world problems that Mimi can solve. They are less detailed than the tutorials, and are thus targeted at a user with some level of experience with Mimi (likely obtained through moving through some or all of the tutorials).
3+
The following how-to guides provide steps to work through more specified and advanced real-world problems that Mimi can solve. They are less detailed than the tutorials, and are thus targeted at a user with some level of experience with Mimi (likely obtained through moving through some or all of the tutorials).
44

55
If you find a bug in these guides, or have a clarifying question or suggestion, please reach out via Github Issues or our [Mimi Framework forum](https://forum.mimiframework.org). We welcome your feedback.
66

77
## Available Advanced How-to Guides
88

9-
- **Build and Init Functions**
9+
- [Advanced How-to Guide: Build and Init Functions](@ref) describes the innerworkings of the `build` and `init` functions which may be useful in special cases.
1010

11-
[Advanced How-to Guide: Build and Init Functions](@ref) describes the innerworkings of the `build` and `init` functions which may be useful in special cases.
1211

13-
- **Using Datum References**
14-
15-
[Advanced How-to Guide: Using Datum References](@ref) describes how to use references to datum, or more specifically components, for scenarios where such use improves code brevity and understandability.
12+
- [Advanced How-to Guide: Using Datum References](@ref) describes how to use references to datum, or more specifically components, for scenarios where such use improves code brevity and understandability.
1613

docs/src/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Mimi is a [Julia](http://julialang.org) package that provides a component model for [integrated assessment models](https://en.wikipedia.org/wiki/Integrated_assessment_modelling), as described in detail on the [Mimi Framework Homepage](https://www.mimiframework.org).
66

7-
The following documentation is organized into the following four sections, roughly adhering to the [Divio documentation system](https://documentation.divio.com) guidelines. For insights into the goals of each of these sections, please refer to the Divio documentation.
7+
The documentation is organized into the following four sections, roughly adhering to the [Divio documentation system](https://documentation.divio.com) guidelines. For insights into the goals of each of these documentation categories, please refer to the Divio documentation.
88

99
1. Tutorials
1010
2. How-to Guides
@@ -13,11 +13,11 @@ The following documentation is organized into the following four sections, rough
1313

1414
## Getting started
1515

16-
We aim to provide assistance to users of all different experience levels, starting with first-time users. If this is your first time using Mimi, we recommend you begin with the Tutorials. In addition, looking through the code at the links below to various existing models based on Mimi can be instructive.
16+
We aim to assist users of all different experience levels, starting with first-time users. If this is your first time using Mimi, we recommend you begin with the Tutorials. In addition, looking through the code at the links below to various existing models based on Mimi can be instructive.
1717

1818
The first step for any user includes installation of julia and Mimi, as well as optionally adding the Mimi Registry. See the first tutorial for instructions on these tasks.
1919

20-
Finally, when in doubt, ask your question on the [Mimi Framework forum](https://forum.mimiframework.org) or post an [Issue](https://github.com/mimiframework/Mimi.jl/issues) to the Github repository if you have a specific request for the development team. Don't be shy about either option, we would much prefer to be inundated with lots of questions and help people out than people give up on Mimi!
20+
Finally, when in doubt, ask your question on the [Mimi Framework forum](https://forum.mimiframework.org) or post an [Issue](https://github.com/mimiframework/Mimi.jl/issues) to the Github repository, the latter being especially pertintent if you have a specific request for the development team. Don't be shy about either option, we would much prefer to be inundated with lots of questions and help people out than people give up on Mimi!
2121

2222
## Models using Mimi
2323

0 commit comments

Comments
 (0)