【发布时间】:2020-01-27 15:36:28
【问题描述】:
【问题讨论】:
标签: plot modelica dymola openmodelica
【问题讨论】:
标签: plot modelica dymola openmodelica
除了通过plotArray() 手动添加一行plotText() 随附的文本外,我找不到其他任何东西。请参阅下面的特定于 Dymola 的 .mos-script,该脚本应在末尾生成绘图。
// 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() 组合垂直线。
【讨论】: