Passing objects in Simulink

9 次查看(过去 30 天)
Pim Nederstigt
Pim Nederstigt 2015-3-15
Dear Matlab Community,
I've been struggling with this one for quite some time now, I would like to know if something like the following is possible in Simulink.
I'm building a model of a thermal power plant in Simulink. Currently, individual system components require as an input different signals for thermodynamic properties like pressure, temperature, flow rate, enthalpy, etc. For such an elaborate model, it's quite cumbersome to work with multiple input signals and to constantly use matlab functions to invoke third party thermodynamic libraries.
Lately I've been looking into matlab classes, and found that it might be usefull to assign the separate properties above (pressure, temperature, etc.) to a custom class and to put any thermodynamic relations in the methods of the class. This obviously works fine in the matlab workspace environment but, unfortunately, Simulink signals cannot not work with class objects.
I'm wondering if there is any way similar to do this: to pass single entities in simulink from component to component, containing both properties and methods relating the properties. To this purpose, I've been looking into creating custom System Objects and Data Classes, but have not been successful thus far. Am I searching in the right direction, or is there no way this could ever work?
Looking forward to any responses,
Kind regards, Pim

回答(1 个)

Ganesh Gaonkar
Ganesh Gaonkar 2015-3-16
I think you are searching in right direction. System object may be able to help your requirement as they also support having one system object as private or public property of another object as mentioned here . This way, you should be able to have your thermodynamic properties defined for different components across different object and should be able to access them .
  1 个评论
Pim Nederstigt
Pim Nederstigt 2015-4-16
Dear Ganesh,
Firstly thank you for your reply.
I've been intensively looking into system objects lately, and I'm making some real progress. Though, there is one thing that I can't get quite done.
Let's say that a thermodynamic library is called by various Simulink System Blocks during simulation. I've defined an other system object within the MATLAB workspace which contains the settings for this library to be used during simulation. This way, if required, one can change the thermodynamic library to be used without redefining separate parameters within each of the Simulink blocks.
You mentioned that a system object (in simulink?) supports having one system object (from the workspace) as private or public property (which is exactly what I would like to have at this point).
Though, I cannot quite get this to work. How would one implement this sort of thing?
Kind regards, Pim

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Thermodynamics and Heat Transfer 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by