Mimi Framework

Compartmentalizing MC definitions?

Do all Monte Carlo variable distribution definitions need to be defined in @defsim?

The new version of PAGE has quite a few MC variables, and I would like to keep them associated with the components for which they apply. Concretely, I am wondering if I can do something like the following, for our CO2Cycle component:

function montecarloCO2Cycle(model)
  model[:res_CO2atmlifetime] = TriangularDist(50, 100, 70)
  ...
end

where all of the MC variables associated with the COCycle are set in a function, and that function is defined in the CO2Cycle.jl file.

Hi, James. When you say “associated with”, do mean in terms of code organization (keep distros with components) or the ability at run-time to recall the component containing the parameter to which the distribution applies ?

If it’s the former, we recently added an API to modify a Simulation instance. I just created a PR that will allow you to easily create an empty one via sim = Simulation(), and then use the API to populate it. The API is under some revision, but it might accomplish what you want.

Thanks Richard. Sorry for not being clear: I meant the former: I just want to have a way to keep the code that defines the repos in the same files as the other code for the components.

The Simulation modification approach seems like it would work fine, or a Simulation-merging process like the discussion in the PR seems to be going. If the second option means that the syntax can be identical to defining a single MC simulation, that seems nice.

Any sense on the timeline for this?

I thought that was the case, but wanted to be sure. We’re actively working on the simulation API now. I can’t commit to a timeframe, but we’re working on it!