OPC服务器:启动停止暂停getData(再次使用)DYMOLA MATLAB [英] OPC Server: Start Stop Pause getData(again use) DYMOLA MATLAB

查看:79
本文介绍了OPC服务器:启动停止暂停getData(再次使用)DYMOLA MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Dymola OPC服务器

I am using a Dymola OPC server

DYMOLA具有许多可以使用SimControl.Run,​​SimControl.Stop等控制的标签

DYMOLA HAS these many tags which can be controlled using SimControl.Run, SimControl.Stop ,etc

在这里我用MATLAB写的

here i wrote it in MATLAB

hostInfo = opcserverinfo('localhost');
da = opcda('localhost','Dymosim.OPCServer.1');
connect(da);
fprintf("CONNECTED\n");
grp=addgroup(da,'Demo');
itmIDs={'ModelVariables.Tco','ModelVariables.der(Tco)'};
itm=additem(grp,itmIDs);
area=additem(grp,{'ModelVariables.Area'});
set(grp,'UpdateRate',0.2,'RecordsToAcquire',50);
start(grp);
wait(grp);
[logIDs,Tco]=getdata(grp,'double'); // PREVIOUS ONE
Now I want to change/write  value to area so what I did is this
write(area,23);

现在我要重新记录或获取数据

Now I want to Relog or getdata

NEWTco=read(itm,'device').Value; //using This I can read one instance
[NewlogIDs,NewTco]=getdata(grp,'double');// GIVES ERR

推荐答案

写这篇文章可以帮助我解决此问题

Writing this helped me to solve this issue

grp2=addgroup(da,'Demo2');
Run=additem(grp2,{'SimControl.Run'});
Status=additem(grp2,{'SimControl.Status'});
Stop=additem(grp2,{'SimControl.Stop'});
Pause=additem(grp2,{'SimControl.Pause'});

RunStatusBefore=read(Run,'device');
StatusBefore=read(Status,'device').Value;
StopStatusBefore=read(Stop,'device');
PauseStatusBefore=read(Pause,'device');

write(Initialize,1);  //INITITALIZE
write(Run,1);  // RUN
write(Stop,1);  // STOP
write(Pause,1);  // PAUSE

这篇关于OPC服务器:启动停止暂停getData(再次使用)DYMOLA MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆