Technical Forum

Communication / Networks

how can i transfer a data form MATlab nntool, to PLC?

Thread Starter: Perger   Started: 4/9/2010 11:19 AM   Replies: 12

« Previous thread Next thread »
12» Page 1 of 2 (13 items)
  4/9/2010, 11:19 AM
Joined 3/15/2010
Last visit: 4/12/2010
Posts: 1
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hi, i know this is the old topic, but i have a question, how can i transfer a data form MATlab nntool, to PLC?? can you help me with this, give me some links or some solutions...??

Thank you.
Goran

Splitted from Matlab with S7300 PLC , Mathworks & SIEMENS.



=== Edited by O_Moderator @ 4/12/2010 8:30 AM [GMT ] ===
new subject after splitting

Top
  4/13/2010, 9:40 AM
Joined 12/6/2008
Last visit: 6/4/2011
Posts: 45
Rating:
Rated: Outstanding [3.33 out of 5 / rated 3 time(s)]. (3) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

Hi,

Can you describe your intension more precisely, what for? Is it real PLC or PLCSIM you have to communicate with?

You may consider your task as transfer data between PLC and Simulink with neural network model. One of solutions available - OPC Toolbox and Simatic Net OPC Server.

Best regards


MATLAB/Sumulink & PLC developer
SimPanel - Multifunctional industrial control panel designer/emulator
PLCSIM OPC Server - an OPC DA2/DA3 Server for S7-PLCSIM
Top
  2/9/2011, 3:45 AM
Joined 2/9/2011
Last visit: 3/8/2011
Posts: 7
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
I realize this is an old question, but are you needing to transfer data or a transfer function?  If it is data, there are posts about using the MathWorks OPC Toolbox.  If it is a function, consider Simulink PLC Coder, which can translate a transfer function into STEP7 as structured text.
Top
  2/9/2011, 7:36 AM
Joined 5/14/2009
Last visit: 12/14/2012
Posts: 150
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
hello
my friend matlab nntool give you excell output file then you have to search "how can i import excell data to my plc?"

good luck
Top
  2/9/2011, 7:52 AM
Joined 5/14/2009
Last visit: 12/14/2012
Posts: 150
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
sorry but i have another question

is your system real time?

or you desiged a neural network and after all calculation you want to use the result in plc?
Top
  2/9/2011, 2:35 PM
Joined 2/9/2011
Last visit: 3/8/2011
Posts: 7
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
This reply is based on the assumption that you desire to put a Neural Network application online.  If I am misunderstanding the application, please correct me.

For data transfer to a PLC system, the simplest way is to use OPC DA (supported by MATLAB and most MathWorks toolboxes).  Regarding real-time (online) performance, MATLAB has been used in online process systems via OPC.  What is you sampling rate?  Generally, OPC can be used for online application 0.5 second updates and slower.  It is not good for deterministic real-time.  Also, it depends on the size of the Neural Network application.  Once the model is trained, it should process information quickly.

Please consider that MATLAB is a PC-based application for design and analysis use.  It is up to the user to qualifiy and maintain their application for online use.  The user should consider that the PC needs to be focused on the application to avoid interrupts for the Windows operating system.
Top
Thank you for this post from:
  2/9/2011, 2:49 PM
Joined 9/15/2010
Last visit: 3/30/2011
Posts: 40
Rating:
Rated: Excellent [5 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Ok, thank you for replys .... This is the deal... I have to create and train neural network in nntool. I have my input data and target data... When I train my network, i get some output. This is easy part. Now, i have sone m file, that extracts data from network structure ( weights, biases, number of neurons in hidden layer...) and saves them into arrays. All of this i have done. Next step is the problem, i need to take all this arrays and data, and save it into Data block in my PLC ..... On plc i have made a function that calculates the output of network for given input... Results are very similar on PLC and in matlab, difference is in 0.000001 .... So I have done everything, exept this data transfer. Thank you.

EDIT: I am the same guy from first post, but my email was stolen, so i couldn't continue to use that account.

Gogy



=== Edited by Gogy @ 2/9/2011 2:52 PM [GMT ] ===


Top
  2/9/2011, 6:21 PM
Joined 2/9/2011
Last visit: 3/8/2011
Posts: 7
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Thanks for the explanation.  I will look into transferring the data from the m file to the Data Block.
Top
  2/9/2011, 6:48 PM
Joined 2/9/2011
Last visit: 3/8/2011
Posts: 7
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
I believe that Bermuda has a likely answer.  The first step is convert the m file into an Excel file.  You can find an explanation here
http://www.mathworks.com/help/techdoc/import_export/f5-115614.html

It appears that STEP7 can import an Excel file to a Data Block.  I found an explanation here.
http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&objId=15162450&nodeid4=20208582&load=content&csSort=DOCBETREFF&lang=en&siteid=cseus&aktprim=4&objaction=csview&extranet=standard&viewreg=WW

If you want, you could try a direct import to the data block from MATLAB.  Between the Siemens documentation above and this link about exporting data, you may be able to create a direct link.
http://www.mathworks.com/help/techdoc/import_export/br5s872.html

Another point, the above assumes a one timemanual transfer.  Are you looking to do this as a automatic update?
Top
  2/9/2011, 7:32 PM
Joined 9/15/2010
Last visit: 3/30/2011
Posts: 40
Rating:
Rated: Excellent [5 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Thank you. First, creating Excel file with data from Matlab i s not a problem. I can use write function, and that is ok... Problem is with second solution you provided me. Sortware is need to be payed, and I can't pay for this.... I am doing a college project, and money for software is not available. So is there any free solution, that can be arrange with Matlab and Step 7 only, without aditional softwer... We have licenced Matlab and SIMATIC Step 7...

BR,
Gogy.
Top
12» Page 1 of 2 (13 items)
Actions