向现有的 Dymola 图添加额外的垂直线

Adding extra vertical line to the existing Dymola plot

我有一个看起来像这样的图表:

请注意x轴不是时间而是一个任意的自变量。

我需要绘制上图中所示的垂直线并标记它们。如何使用 mos 脚本在 Dymola 中完成此操作?

谢谢!

除了通过 plotArray() plotText() 的随附文本手动添加一行之外,我找不到其他任何东西。请参阅下面的特定于 Dymola 的 .mos 脚本,它应该在最后生成绘图。

// Simulate the model
simulateModel("Modelica.Mechanics.Rotational.Examples.CoupledClutches", stopTime=1.5, numberOfIntervals=0, outputInterval=0.001, resultFile="CoupledClutches");

// Create the actual plot
createPlot(id=1, position={191, 39, 672, 423}, x="clutch1.tau", y={"clutch1.phi_rel", "clutch1.w_rel"}, range={-10.0, 4.0, -200.0, 20.0}, grid=true, colors={{28,108,200}, {238,46,47}}, displayUnits={"deg", ""});

// Add the vertical line
plotArray(x={-8,-8},y={-200,0},color={0,128,0},thickness=0.5, erase=false);
plotArray(x={-2,-2},y={-200,0},color={128,0,128},thickness=0.5, erase=false);

// Add text
plotText(id=1, extent={{-9,-210}, {-7,-220}}, textString="Description 01", lineColor={0,128,0});
plotText(id=1, extent={{-3,-210}, {-1,-220}}, textString="Description 02", lineColor={128,0,128});

如果您想像在模型中那样使用图例进行说明,请使用 plotArray() 函数的 'legend' 字符串参数,而不是手动添加文本。

脚本肯定可以通过数组和文本的一些更复杂的维度得到增强,但这应该是一个很好的起点。还使用 plotArrays() 组合垂直线的线。