- Please use
String()
for conversion of numeric values to string.
- Browse the Modelica Standard Library which uses DynamicSelect in various places.
- Here is an improved example for Modelica Standard Library version 4 with slowed down simulation:
model TestDynamicSelect
Modelica.Blocks.Sources.Sine sine(amplitude=100, f=1) annotation(Placement(transformation(extent={{-80,40},{-60,60}})));
Modelica_DeviceDrivers.Blocks.OperatingSystem.RealtimeSynchronize realtimeSynchronize annotation(Placement(transformation(extent={{-80,0},{-60,20}})));
annotation(experiment(StopTime=10), Diagram(graphics={
Text(
extent={{-22,60},{98,10}},
lineColor={28,108,200},
fillColor={238,46,47},
fillPattern=FillPattern.None,
textString=DynamicSelect(10,String(sine.y)))}),
uses(Modelica(version="4.0.0"), Modelica_DeviceDrivers(version="2.0.0")));
end TestDynamicSelect;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…