Write Array into OPC blocks in Simulink

9 ビュー (過去 30 日間)
Tan Edwin
Tan Edwin 2011 年 4 月 8 日
コメント済み: Attilio 2019 年 1 月 29 日
How can i write array into OPC write blocks in Simulink?
I tried writing an array into Bucket Brigade.ArrayOfReal8 through the OPC Write Block provided by OPC Toolbox, but it appears that the OPC Write Block can only take in one element.
I also noticed that the dcumentation does not shows writing of array in simulink so is it not feasible to write array?
Methods i tried:
1) [1,2,3,4,5] from embedded matlab function and input into write block.
2) creating 5 constant block and using mux to combine them.
  1 件のコメント
Attilio
Attilio 2019 年 1 月 29 日
I had the same problem, which is strange as using MATLAB commands instead I could write arrays in the same kind of item, e.g.:
%% Initialization of an OPC client for data access by models
% (one array input)
Nsignals = 2; % number of signals array components
% Step 1 - Creating a data access client object, named 'da'
da = opcda('localhost','Matrikon.OPC.Simulation.1');
connect(da)
% Step 2 - Creating two groups in the client object, named 'grp'
grp = addgroup(da);
% Step 3 - creating one item in 'grp', with fully qualified item IDs
% given second argument of additem function
itm = additem(grp,'Bucket Brigade.ArrayOfReal8');
% Step 4 - reading the values of the two items of grp1
array_ini = zeros(1, Nsignals);
write(itm, array_ini);
r_grp = read(grp)
% Step 5 - disconnecting and saving the client for access from OPC Data Access Explorer and
disconnect(da)
save opcda_client da

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeUnified Architecture についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by