Creating Charts, with Titles, by Scripting

You can create one or more charts (i.e. subplots) to organize and compare your execution results, using the Modelica Scripting functions. You can also add a chart titles.

Note: Below the Modelica Scripting window is used, the Modelica Script Editor can also be used. For information about scripting alternatives, see Dymola Behavior Modeling User's Guide: Performing a Virtual Execution: Scripting..

  1. From the Behavior Tools section of the action bar, click Modelica Scripting .
    The Modelica Scripting window appears.
  2. To create a plot window with a first chart, do, in the command input line in the lower part of the Modelica Scripting window, the following:
    1. To create a plot window with a chart, type createPlot(id=1,subPlot=1); and press Enter.

      • The "id" value is an identifier for the plot window.
      • The "subplot" value is an identifier for the chart.

      An plot window with an empty chart is created.
    2. To create a curve in the chart, type plotArray({0,1,2,3},{5,4,6,5}); and press Enter.
      A curve is created in the empty chart.
    3. To create a header of the chart, type plotTitle("My Chart 1",id=1); and press Enter.
      The chart now also has a header:

  3. To add another chart in this plot, do Step 1 again, but with these lines, one by one:

    createPlot(id=1,subPlot=2);
    plotArray({0,1,2,3},{2,10,1,0});
    plotTitle("My Chart 2",id=1);

    The plot window now has two charts, with headers:

    Note: You may have to enlarge the plot window to see the headers.