message_ix_models.model.buildings.build_and_solve

message_ix_models.model.buildings.build_and_solve(context: Context) → Scenario[source]

Build MESSAGEix-Buildings and solve.

The function responds to a buildings.Config instance at context.buildings.

  1. Either clone the base scenario (Context.clone_to_dest(), if buildings.Config.clone is True) or load an existing scenario.

  2. Retrieve prices (using get_prices()) and historical_activity from the scenario.

  3. Call pre_solve() to run (optionally) ACCESS, (always) STURM, add appropriate structure to the scenario, and update the demand parameter using STURM/ACCESS outputs

  4. For 1 or more iterations:

    1. Solve the MESSAGE scenario.

    2. Run post_solve() to check convergence.

    3. Possibly run pre_solve() to start the next iteration.

The number of iterations at (4) is controlled by buildings.Config.max_iterations; setting to 1 or less means the process is ‘once-through’, and the MESSAGEix-Buildings models are only run once.