Sysplorer中如何构建复杂的自定义波形?
技术分享
发布于 2025-08-06 16:30:56
查看 1过去300天
问题现象
Sysplorer中如何构建复杂的自定义波形,如下图:

解决方法
针对上述问题,可以建一个模块,点击“文本”进行编辑:
参考如下代码构建复杂的自定义波形:
model Model1
parameter Real period=0.7"周期设定";
Modelica.Blocks.Tables.CombiTable1Ds x(table
={{0.0,0),{0.1,15),{0.2,25),{0.3,9},{0.4,13},{0.5,0},{0.6,17},{0.7,25}})
annotation (Placement(transformation(origin
{1.9999999999999982,-5.551115123125783e-16},
extent={-10.0,-10.0},{10.0,10.0}}));
Modelica.Blocks.Sources.RealExpression realExpression
(y= time - floor((time /period))*period)
annotation (Placement(transformation(origin ={-119.0,-3.3306690738754696e-16},
extent={-35.0,-10.0},{35.0,10.0}})):
annotation (experiment
(Algorithm = Dassl,NumberOfIntervals =500,StartTime =0,StopTime=0.7,Tolerance=0.0001));
equation
connect(realExpression.y,x.u)
annotation (Line(origin= {-23.0,0.0),
points={-60.0,-3.3306690738754696e-16},{12.999999999999998,-5.551115123125783e-16}},
co1or={0,0,127})):
end Model1;
仿真后选中输出y[[1],可以看到已经构成了复杂的自定义波形:

所属专栏:Sysplorer基础平台
产品信息:Sysplorer系统建模仿真环境