Show contents 

Ms > About the MS Assembly > General Principles of Programming using Ms Assembly > Modeling Scenario

Modeling Scenario

Currently, modeling containers contain scenarios as a tree and not as individual repository objects. Use the IMsScenarioTreeEntries interface to work with a scenario tree. The following elements can be added to this tree:

NOTE. The example given below requires objects listed in variable description section.

The desired scenario must be added to the modeling problem to calculate by the required scenario:

Sub UserProc;
Var
    ModelSpace: IMsModelSpace; // Modeling container
    ScenarioTree: IMsScenarioTreeEntries; // Scenario tree
    ScenarioElement: IMsScenarioTreeElement; // Tree element, to which scenario corresponds
    Problem: IMsProblem; // Modeling problem
    Scenarios: IMsScenarios; // Collection of modeling scenarios
    Scenario: IMsScenario; // Modeling scenario
Begin
    ScenarioTree := ModelSpace.ScenarioTree;
    ScenarioElement := ScenarioTree.Item(0As IMsScenarioTreeElement;
    Scenario := ScenarioElement.Scenario;
    Scenarios := Problem.Scenarios;
    Scenarios.AddScenario(Scenario);
End Sub UserProc;

The example of creating a scenario is given in the Working with Modeling Container Scenarios section.

See also:

General Principles of Programming using Ms Assembly