Plotting Variable Selections

You can plot variable selections. Variable selections are defined by annotations.

In this scenario, you extend the Coupled Clutches demo, add a variable selection, and then simulate and plot that variable selection.

  1. Open the model example Coupled Clutches.
  2. To extend the model example, do the following:
    1. From the Package Browser, right-click the model Coupled Clutches and select Extend From.
    2. In the dialog box, do the following:

      1. In the Name field, enter MyCoupledClutches.
      2. Erase the Insert in field.
      3. Click OK to create a free-standing model MyCoupledClutches.

  3. Open MyCoupledClutches and add Modelica text, to get the following:

    You have to add the second annotation, line 4-8 below.

    model MyCoupledClutches
      extends Modelica.Mechanics.Rotational.Examples.CoupledClutches;
      annotation (uses(Modelica(version="4.0.0")));
      annotation (__Dymola_selections={Selection(
            name="PlottedVariables",
            override=true,
            match={MatchVariable(name="Time"),MatchVariable(name="J1.phi"),
              MatchVariable(name="J1.w"),MatchVariable(name="torque.tau")})});
    end MyCoupledClutches;

    You have added a variable selection PlottedVariables to the model.
    Note: For more information on variable selections, see Managing Variable Selections.
  4. Simulate the model.

    For more information about simulation, see Simulating a Behavior.

  5. From the Variable Browser, right-click any signal, and select Predefined Actions > Plot Variable Selection > PlottedVariables .
    A plot window appears:

    For more information about opening a model example, see Accessing Model Examples.