Number of variables vs number of equations in Simscape components
1 次查看(过去 30 天)
显示 更早的评论
When I define a new custom component in Simscape, as a general rule I take care that the number of equations in the "equations" section match the number of variables in the "variables" section. So far so good.
However, while studying the source code of some components of the Foundation Library, I discovered that this requirement is not always satisfied. For example: "convection_port.ssc" is the source code for a convection port component, which is part of the "Thermal Liquids" library. The code shows a clear mismatch between the number of variables and the number of equations (specifically: there are more variables than equations). However, this component is obviously a valid one.
In conclusion, I was wondering if there is a general rule that must be followed when setting the number of variables & equations for a custom Simscape component, so that its validity is guaranteed.
I searched the documentation online, but I could not find a detailed answer so far
Thanks
0 个评论
回答(1 个)
J Chen
2023-3-20
编辑:J Chen
2023-3-21
For a Simscape component, the variables include variables in the variables AND nodes sections as in this example. The number of equations in the "equations" section doesn't need to match the number of variables in the "variables" section. Look at the resistor example: there are 6 variables (p.v, p.i, n.v, n.i, i, v), 2 eqs in the equations section and 2 eq in the branches section (i=p.i, p.i=-n.i). So we need to know 2 variables (e.g., p.v, n.v) in order to solve the problem. This is consistent with a real resistor, i.e., if two variables are specified (e.g., voltages at the two terminal), all the variables are defined.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Foundation and Custom Domains 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!