使用循环指令控制的比率-速度转换器¶
转换器将比率转换为速度。
转换器的数学模型是一个代数方程,其中位置范围 K = 0 至 1,对应的速度范围 v = 45 至 95 km/h。
速度范围 v = 45 至 95 km/h。
总速度为
v = 50x + 45,下图显示了实现的模型本身。

接下来,让我们连接辅助函数来启动模型,并为其声明初始状态。
Out[0]:
run_model (generic function with 1 method)
Building...
Progress 100%
Building...
Progress 100%
Building...
Progress 100%
Building...
Progress 100%
Building...
Progress 100%
Building...
Progress 100%
根据模型的结果,我们可以看出,随着系数的增加,速度也会相应增加。
{"id": "b42334cc-68db-42af-8e69-7bb69eb6db50", "data": [{"showlegend": true, "mode": "lines", "xaxis": "x", "colorbar": {"title": {"text": ""}}, "name": "y1", "zmin": null, "yaxis": "y", "legendgroup": "y1", "zmax": null, "line": {"color": "rgba(0, 154, 250, 1.000)", "shape": "linear", "dash": "solid", "width": 1}, "y": [45, 55, 65, 75, 85, 95], "type": "scatter", "x": [0, 0.2, 0.4, 0.6, 0.8, 1], "zaxis": null, "z": null, "metadata": {"shouldEnableSmartZoom": false, "smartZoomParams": {"minCount": 25000, "maxCount": 6, "currentCount": 6}}}], "config": {"showlegend": true, "xaxis": {"showticklabels": true, "gridwidth": 0.5, "range": [-0.030000000000000027, 1.03], "domain": [0.03619130941965587, 0.9934383202099738], "mirror": false, "tickangle": 0, "showline": true, "zeroline": false, "tickfont": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 11}, "zerolinecolor": "rgba(0, 0, 0, 1)", "anchor": "y", "visible": true, "ticks": "inside", "tickmode": "array", "linecolor": "rgba(0, 0, 0, 1)", "showgrid": true, "title": {"text": "", "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 15}}, "gridcolor": "rgba(0, 0, 0, 0.1)", "tickcolor": "rgb(0, 0, 0)", "type": "linear"}, "paper_bgcolor": "rgba(255, 255, 255, 1.000)", "annotations": [], "height": 400, "margin": {"l": 0, "b": 20, "r": 0, "t": 20}, "plot_bgcolor": "rgba(255, 255, 255, 1.000)", "yaxis": {"showticklabels": true, "gridwidth": 0.5, "range": [43.5, 96.5], "domain": [0.03762029746281716, 0.9901574803149606], "mirror": false, "tickangle": 0, "showline": true, "zeroline": false, "tickfont": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 11}, "zerolinecolor": "rgba(0, 0, 0, 1)", "anchor": "x", "visible": true, "ticks": "inside", "tickmode": "array", "linecolor": "rgba(0, 0, 0, 1)", "showgrid": true, "title": {"text": "", "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 15}}, "gridcolor": "rgba(0, 0, 0, 0.1)", "tickcolor": "rgb(0, 0, 0)", "type": "linear"}, "legend": {"yanchor": "auto", "xanchor": "auto", "bordercolor": "rgba(0, 0, 0, 1)", "bgcolor": "rgba(255, 255, 255, 1.000)", "borderwidth": 1, "tracegroupgap": 0, "y": 1, "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 11}, "title": {"font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 15}, "text": ""}, "traceorder": "normal", "x": 1}, "width": 319}}