首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在我的程序中使用Scilab/xcos中的模型?

如何在我的程序中使用Scilab/xcos中的模型?
EN

Stack Overflow用户
提问于 2014-07-01 17:18:13
回答 1查看 3.2K关注 0票数 0

我需要在我的应用程序中运行来自xcos (Scilab)的控制模型。

因此,控制算法工程师可以开发自己的控制模型,并在xcos的可视化环境中进行测试。所开发的模型可以直接合并到应用程序中。

如何在我的python应用程序中加载和运行xcos模型?文档非常差。

EN

回答 1

Stack Overflow用户

发布于 2014-07-02 20:01:54

运行scicos模型

我没有太多使用XCOS的经验。但您可以尝试scicos_simulate documentation中提到的方法。

代码语言:javascript
复制
importXcosDiagram("SCI/modules/xcos/demos/batch_simulation.zcos")

typeof(scs_m) //The diagram data structure

//This diagram uses 3 context variables : 
//  Amplitude : the sin function amplitude
//  Pulsation : the sin function pulsation
//  Tf        : the final simulation time
scs_m.props.context; //the embedded definition

//first batch simulation with the parameters embedded in the diagram 
scicos_simulate(scs_m);
// Change the final time value
Context.Tf=10;
scicos_simulate(scs_m,Context);
// without display
Context.Tf=10;
Context.Pulsation=9;
scicos_simulate(scs_m,list(),Context,'nw');
//get the variable created by the "from workspace block"
counter

使用脚本启动scilab

您可以创建一个Scilab脚本来运行模型,并使用该脚本执行call Scilab。另请参阅calling-an-external-command-in-python

代码语言:javascript
复制
from subprocess import call
call(["scilab", "-f run_my_xcos.sci"])     

来自Python的调用

还有一个a kind of python api for scilab calls,所以你可以使用它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24506618

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档