OPC Server: Start Stop Pause getData(again use) DYMOLA
3 views (last 30 days)
Show older comments
I am using a Dymola OPC server
DYMOLA HAS these many tags which can be controlled using SimControl.Run, SimControl.Stop ,etc
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
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!