Can I use data from the OPC toolbox to run a real time simulation with Simulink Desktop Real-Time using a model that I created with Simscape?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Matheus Andrade
el 10 de Jul. de 2020
Comentada: Matheus Andrade
el 14 de Jul. de 2020
I'm creating a model using Simscape and I want to use real time data coming from a PLC to run a simulation using the Simulink Desktop Real-Time and the model created with Simscape, is it posible? Is there another way to get this real time data from the PLC?
I'm basically trying to develop a digital twin (using historical and real time data) for optimization purposes.
2 comentarios
Vasco Lenzi
el 10 de Jul. de 2020
Hi Matheus, great question.
I have a couple of follow-up questions:
1) Which PLC vendor are you using, and which software platform? We have various way to integrate with them.
2) Which release of Simulink are you using? Are you locked-in in a release?
3) Which version of OPC? UA vs DA. Is OPC a "must-have" (because of the machine architecture, maybe other systems using OPC) or would you use it only to connect Simulink to it?
4) How fast does your model runs when you simulate on your computer - is it faster than real-time or slower than real-time?
Respuesta aceptada
Vasco Lenzi
el 13 de Jul. de 2020
Hi Matheus
Thank you for the additional information.
1) Deployment on PLC Itself:
First of all, with most PLC you can generate C code from the model and integrate it into the PLC itself. For instance for Siemens Simatic STEP7:
Usually the code generate is from a controller/state machine, but you can as easily generate code from a physical model of your plant ("digital twin") this would be then run on the PLC itself, with no hassle regarding the communication. A disadvantage would be the reduced possibility to perform optimization of parameters, because of the few computing ressources available on the PLC, depending on your application.
2) Industrial communication - OPC DA
Your idea of using OPC Toolbox and Simulink Desktop Real-Time is a valid one. Simulink Blocks of the OPC toolbox only exist for OPC DA. So you would need to setup the OPC DA, use the block in the model and then run it with Simulink Desktop Real-Time. This is good for simulations that requires a slow time-step such as 1-100 ms.
3) Industrial Communication - MODBUS-TCP/IP
This is particularly good for Siemens PLC. If the PLC suppots MODBUS or TCP/IP, you can use the Instrument Control Toolbox to setup a connection between Simulink and the PLC, and deploy it in near-real-time using Simulink Destop Real-Time. Modbus is supported through MATLAB command, but you may use them in a MATLAB function block in Simulink.
see an example here of controlling a PLC using MODBUS Explorer:
4) If hard real-time is a requirement, you may need to go through Simulink Real-Time and a Speedgoat machine
Hope this gives you some inputs and food for thought!
Cheers
Vasco
3 comentarios
Vasco Lenzi
el 14 de Jul. de 2020
That sounds like a great project! We have an example of machine learning developed in MATLAB and then implemented in a simulink model used as a digital twin:
It can be a great example for you to take a look at.
Cheers
Vasco
Más respuestas (0)
Ver también
Categorías
Más información sobre Model Statistics en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!