Mimi Framework

PSA Models as Packages

We may soon add a sort of “PSA” category for announcements to clarify this type of a announcement, but I do want to let you all know of an additional feature that slightly changes the way you use models as submodules. It should not really break existing code that uses existing models, although if you re-pull an existing Mimi repo that you were using as a submodule you may need to change a few lines to be consistent with the module syntax.

The primary goal of this update was to allow completed models to function like packages, and thus make their use easier especially for first-time users. We know it changes like this may be challenging at first but firmly believe this is a step forward for ease of use. We set about accomplishing this goal with our new MimiRegistry where we have registered five most-used models: MimiDICE2010, MimiDICE2013, MimiRICE2010, MimiFUND, and MimiPAGE2009.

As described in each of these packages’ README, to use this feature 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 a model, such as, MimiRICE2010.jl itself. You need to run the following command at the julia package REPL:

pkg> add MimiRICE2010

Now in your code you may type using MimiRICE2010 to import the exported functions, generally some form of getmodel function as described in the model’s README. You can also access non-exported functions as you would with any other package. Also as with any package, you can use ] dev MimiRICE2010 to get the package in your environment’s dev folder and work on its development or access the code on your machine.

All tutorials and README’s have been updated with this information.

UPDATE this feature is ready to be used, we have registered the latest versions of the models. @hbenveniste let me know if you need help getting this going for FUND.

I’m only getting to this now and have a few questions.

Do I still need to include the FUND helper.jl file in order to use its functions? Or should I write something like:
parameters = MimiFUND.loadparameters(datadir) ?

Also how do I access the data folder in MimiFUND? Something like datadir = MimiFUND.data ?

More generally, can I replace some components of MimiFUND with others, as I need to do with my migration work, or is the MimiFUND package only useful if I don’t need to do that?

Thanks a lot!

Looking at your code, you had already implemented the module syntax of using .FUND, so this is quite similar. When you call using MimiFUND, it will do the same thing that using .FUND did before, but without the need to include the main file or have the FUND model folder on your computer at all. I can take a look at your code either from GitHub or posted here if that helps you make it more clear why that access might be needed for your work.

(1) You are adding FUND as a package, which means you don’t have direct access to all of the different files that make up FUND, but instead the exported functions (in this case just getfund) and non-exported functions via MimiFUND.fcn_name syntax. This is how you would would access, for example, MimiFUND.loadparameters(dirname).

(2) Why do you need to access the data folder in MimiFUND? MimiFUND.data is not a valid call. If you want to access the parameter information from a built model that you got from m = getfund; run(m), then you can use the API that accesses parameters of a model.

(3) The package certainly works for your application. You can replace components, it’s the same work you’ve done, you will just get your model with m = getfund; run(m) and then you can replace components etc.

Thanks Lisa, the update works fully!

1 Like