Number of variables vs number of equations in Simscape components
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
J Chen
il 20 Mar 2023
Modificato: J Chen
il 21 Mar 2023
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.
Vedere anche
Categorie
Scopri di più su Foundation and Custom Domains in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!