- Have its own Model Workspace where you could store local data
- Be capable of running as a standalone simulation
Libraries, model workspace, base workspace and how to parameterize my models
조회 수: 14 (최근 30일)
이전 댓글 표시
Hello everybody,
I am building a library (with sublibraries) of models that will eventually be used as parts in simulations of industrial equipment.
Although it is not exactly this way, let us consider this hierarchy:
Library/
* Motors/
* -- Diesel_A31
* -- Diesel_A32
* Powertrains/
* -- PT03
* -- PT10
Now the question is that every model should be able to run independently, but all the models make use of constants such as for example:
- Gravity (both for motors and powertrains)
- Themodynamical properties from air in normal conditions (only for motors, nor for Powertrains)
and parameters, like:
- Air temperature (both for motors and powertrains the same), would be a "whole simulation" parameter
- Horsepower (only for motors, for every motor potentially different, for every instance of the model the same)
- Initial position of the cilinder (only for motors, for every instance different)
Now the question is how do I manage and store all this information in the library and the models that reside inside each library or sub-library.
- Global workspace? Please no
- Model workspace? It looks like my models haven't got a model workspace, maybe since they are in a library
- Mask parameters? I would rather be able to write them down in a text file where I could explain the meaning of each parameter. The number of parameters is too high anyway. I think that the initial position of the cilinder could be a mask parameter.
And would it be possible to make the parameters accesible to the model without the user actually intervining? I try to keep in mind that the model should be able to work independently without the user having to look under the mask or perform any action.
Even though the problem is not very clear either to me, I hope I was able to state the question clearly.
Any help or experience in this regard would be greatly appreciated.
Carlos.
댓글 수: 0
채택된 답변
Jarrod Rivituso
2011년 5월 6일
Hi Carlos,
Is there any specific reason you have decided on using libraries for this? It sounds like you'd have a much easier time using model references.
With model references, each component (Diesel_A31, Diesel_A32, PT03, etc.) would be it's own separate model. This means each component would
If you use subsystems stored in libraries for these components, then the only local workspace those subsystems have for parameters is the Mask Workspace.
What's very nice about the Model Workspace over the Mask Workspace is that you can define either a MAT-file or a MATLAB script as the data source for the Model Workspace. So, you could write all your parameters for a given component in a MATLAB script and then tell the Model Workspace to use that MATLAB script as its data source.
Does that make sense?
댓글 수: 0
추가 답변 (2개)
Kaustubha Govind
2011년 5월 9일
I am partial to the Mask Parameters option, because it doesn't pollute the Model Workspace and allowing the blocks to run independently. Why not simply return all the parameters from a shared MATLAB function, and run that function in the Mask Initialization? I guess the downside is that each block will have its own copy of the data, but I also think of it as an advantage, because the block has complete control over its data.
Alternatively, you could assign the parameter values directly in the Model Workspace from the block mask (you could check if the variable already exists before attempting to define a parameter) - but this is roundabout and not transparent to the user, since most people tend not to examine the model workspace and could potentially define conflicting parameters in the base workspace (which are always overrided by the model workspace variables, causing confusion).
댓글 수: 0
Carlos Martinez
2011년 5월 10일
댓글 수: 1
Jarrod Rivituso
2011년 5월 20일
For the "really constant" stuff, I would use parameters in the base workspace (it is, after all, a workspace that can be accessed by all models).
For the external temperature - if it really does vary a lot during the simulation then I would consider adding it as an input signal to the models that require it.
Hope this helps!
참고 항목
카테고리
Help Center 및 File Exchange에서 Powertrain Reference Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!