The 'Evaluate' attribute is not valid - Simscape masking
    30 views (last 30 days)
  
       Show older comments
    
I am trying to make a masked subsystem with an integrated Pipe (TL) block from the Simscape Fluids library. In the mask, I promote the 'Cross-sectional geometry' and 'Pipe diameter' properties. Previewing the dialog box works at this point. When changing the cross-sectional geometry in the dialog box from Circular to e.g. Annular, the mask editor gives the following error: The 'Evaluate' attribute specified for parameter 'Parameter 2' of block 'Model/Subsystem' is not valid. Looking at the Mask editor, the entire list of parameters changes. The properties are still there but all the namings are gone. Moreover, I noticed that depending on which property is loaded in 'Cross-sectional geometry', the Evaluate attribute of 'Pipe diameter' is either checked or not, and I cannot change it by clicking in the mask - it seems to be locked. I've been looking for the attributes via command line using get(gcbh), but I was not able to find a way to change the attribute. I found something in the 'DialogParameters' structure, but this is read-only and cannot be changed using set_param.
Is there a way I can get the masking working, with the ability to set both the Cross-sectional geometry as other properties like Pipe diameter?
Mask before changing cross-sectional geometry:

Mask after changing cross-sectional geometry:

4 Comments
  Yifeng Tang
    
 on 29 Oct 2025 at 14:20
				
      Edited: Yifeng Tang
    
 on 29 Oct 2025 at 14:26
  
			I have an idea in mind that may work a big more elegantly, but it will involve some (simple) Simscape language task.  The general idea is to write a custom Simscape block, underneath which is just using the library block and assigning a set of selected parameters to the library block.  You may use any .png or .svg file as the icon of the custom block.  Does this sounds like a reasonable solution?  If so, I can point you to more details and examples.
Answers (1)
  Yifeng Tang
    
 on 29 Oct 2025 at 22:45
        
      Edited: Yifeng Tang
    
 on 29 Oct 2025 at 22:48
  
      Here are more details on the idea I mentioned.
I suggest that you look into making a composite component using Simscape language.  Usually a composite component combines multiple blocks underneath, but in your case, you may need only one block, and the composite component is there to provide a way to design your own UI.  The UI will appear as a typical Simscape block.
I attached an example.  Due to the file type limitation of MATLAB Answer, please change the .txt file to .svg (it's a picture) and the .m file to .ssc (it's a Simscape component).

In the example, the pipe block is a custom Simscape component, with its own icon.  I stole the icon of the Pipe (TL) block and add text to it, using the Simulink.IconEditor.open(gcb) command (reference).
The block itself is using the Pipe (TL) block from the Fluids library.  I started with the subsystem2ssc command (Doc) to get the basic structure of the component code.  The "nodes" section defines the connections, the "components" section imports the library block, and the "connections" section connects the Pipe (TL) block to the connections of the "parent" component.  I then added a parameter section and some if statements to control the UI, based on the pipe geometry selection, making only the relevant ones visible.  You can find more about the syntax here.  As a result, this custom pipe will change what parameter is visible, just like the library block, based on geometry selection:
 
   
I then assign the parent level parameters to the Pipe block in the components section.
    components(ExternalAccess = observe)
      Pipe_TL = fluids.thermal_liquid.pipes_fittings.pipe(...
                    cross_section_geometry  = cross_section_geometry_1, ...
                    pipe_length             = pipe_length_1, ...
                    pipe_diameter           = pipe_diameter_1, ...
                    pipe_outer_diameter     = pipe_outer_diameter_1, ...
                    pipe_width              = pipe_width_1, ...
                    pipe_height             = pipe_height_1, ...
                    area                    = area_1, ...
                    Dh                      = Dh_1 ...
                );
Those parameter names on the right are what I defined in the .ssc file before this section, and the parameter names on the left are what's inside this Pipe (TL) block.  I understand you don't have visibility to the source code of this block but there is a way to find out what the parameter names are. Open the parameter dialog of the Pipe block, hover your cursor to the parameter you are interested in, and it should show you the variable name in the code.  

You need to assign a "Simscape parameter" to it, meaning defined with value and unit, like this:

There are probably much more to explore, but hopefully this explains the idea.
If the list of parameters to elevate is relatively small, feel free to list them and I can make more specific suggestions.  If the list is long, consider reach out to MathWorks account team to get connected with Application Engineering support, or to Tech Support and see if they can quick locate the information.
0 Comments
See Also
Categories
				Find more on Foundation and Custom Domains in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
