4/9/2010 11:19 AM  
Posts: 1 Rating: (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. 
Last edited by: O_Moderator at: 4/12/2010 8:30 AMnew subject after splitting 

4/13/2010 9:40 AM  
Posts: 45 Rating: (8) 
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 
2/9/2011 3:45 AM  
Posts: 7 Rating: (1) 
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. 
2/9/2011 7:36 AM  
Posts: 151 Rating: (3) 
hello my friend matlab nntool give you excell output file then you have to search "how can iimport excell data to my plc?" good luck 
2/9/2011 7:52 AM  
Posts: 151 Rating: (3) 
sorry but i have another question isyour system real time? or you desiged a neural network and after all calculation you want to use the result in plc? 
2/9/2011 2:35 PM  
Posts: 7 Rating: (1) 
This reply is based on the assumption that youdesire to puta 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 MathWorkstoolboxes). Regarding realtime (online)performance, MATLAB has been used in online process systems via OPC. What is you sampling rate? Generally, OPCcan be used for online application 0.5 second updates and slower. It is not good for deterministic realtime. Also, it depends on the size of the Neural Networkapplication. Once the model is trained, it should process information quickly. Please consider that MATLAB is a PCbased application for design and analysis use. It is up to the user to qualifiy and maintaintheir 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. 
This contribution was helpful to1 thankful Users 
2/9/2011 2:49 PM  
Posts: 40 Rating: (1) 
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 
Last edited by: Gogy at: 2/9/2011 2:52 PM 

2/9/2011 6:21 PM  
Posts: 7 Rating: (1) 
Thanks for the explanation. I will look into transferring the data from the m file to the Data Block. 
2/9/2011 6:48 PM  
Posts: 7 Rating: (1) 
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/f5115614.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 timemanualtransfer. Are you looking to do this as a automatic update? 
2/9/2011 7:32 PM  
Posts: 40 Rating: (1) 
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. 
Follow us on