# Getting Started

This guide will briefly explain how to install Julia and MimiPAGE2009.

## Installing Julia

Mimi-PAGE requires the programming language Julia, version 1.1 or later, to run. Download and install the current release from the Julia download page.

### Julia Editor Support

There are various editors around that have Julia support:

• IJulia adds Julia support to the jupyter (formerly IPython) notebook system.
• Juno adds Julia specific features to the Atom editor.
• Sublime, VS Code, Emacs and many other editors all have Julia extensions that add various levels of support for the Julia language.

## Installing Mimi

The Mimi-PAGE model is written for the Mimi modeling framework, which needs to be installed as a standard Julia package.

Once Julia is installed, start Julia and you should see a Julia command prompt. To install the Mimi package, issue the following command:

julia> using Pkg
julia> Pkg.add("Mimi")

Or, alternatively enter the (Pkg REPL-mode)[https://docs.julialang.org/en/v1/stdlib/Pkg/index.html] is from the Julia REPL using the key ]. After typing this, you may proceed with Pkg methods without using Pkg.. This would look like:

julia> ]add Mimi

To exit the Pkg REPL-mode, simply backspace once to re-enter the Julia REPL.

You only have to run this (whichever method you choose) once on your machine.

Mimi-PAGE also requires the Distributions, DataFrames, CSVFiles and Query packages.

For more information about the Mimi component framework, you can refer to the Mimi Github repository, which has a documentation and links to various models that are based on Mimi.

## Installing Mimi-PAGE

You first need to connect your julia installation with the central Mimi registry of Mimi models. This central registry is like a catalogue of models that use Mimi that is maintained by the Mimi project. To add this registry, run the following command at the julia package REPL: 

pkg> registry add https://github.com/mimiframework/MimiRegistry.git

You only need to run this command once on a computer.

The next step is to install MimiPAGE2009.jl itself. You need to run the following command at the julia package REPL:

pkg> add MimiPAGE2009

## Using Mimi-PAGE

To run the model, run the main.jl file in the examples folder. This runs the deterministic version of Mimi-PAGE with central parameter estimates. The MimiPAGE209.get_model function used in that file create the initialized PAGE model. You can print the model, by typing m, which returns a list of components and each of their incoming parameters and outgoing variables. Results can be viewed by running m[:ComponentName, :VariableName] for the desired component and variable. You may also explore the results graphically by running explore(m) to view all variables and parameters, or explore(m, :VariableName) for just one. For more details on the graphical interface of Mimi look to the documentation in the Mimi User Guide.

To run the stochastic version of Mimi-PAGE, which uses parameter distributions, see the mcs.jl file in the src folder and the documentation for Mimi Monte Carlo support here. The simplest version of the stochastic can be implemented as follows:

julia> MimiPAGE2009.do_monte_carlo_runs(1000) #1000 runs

The current Monte Carlo process outputs a selection of variables that are important for validation, but these can be modified by the user if desired. For more information, see the Technical Guide.

## Troubleshooting

To troubleshoot individual components, you can refer to the test` directory, which has separate files that check each component.

For specific questions, you can send an email to David Anthoff (<anthoff@berkeley.edu>).