Why am I receiving an error related to "OutputPor​tOutputBus​AsStructs" when using model reference and virtual buses?

13 ビュー (過去 30 日間)
I have a top model containing a model reference block. The outport block inside the reference model is set to be a virtual bus. When I simulate my model, I receive the following error: 
Ports and parameters must match between Model block 'top_model/Model' and referenced model 'ref_model'. Refresh the Model block or revert the changes to the referenced model.
Caused by:
'Output Port 1' of Model block 'top_model/Model' has "OutputPortOutputBusAsStructs" set to "on". The referenced model, 'ref_model', has "OutputPortOutputBusAsStructs" set to "off" for this port. 

採用された回答

MathWorks Support Team
MathWorks Support Team 2020 年 11 月 4 日
編集済み: MathWorks Support Team 2020 年 11 月 4 日
Root-cause of the error:
This error is thrown due to a combination of the following two factors:  
  1. There is a mismatch between the reference model outport and the reference block in the top model: 
  • The top model is expecting a nonvirtual bus. 
  • But the reference model checkbox is not selected to" output as nonvirtual bus in parent model": 
  2. Plus, "Ports and parameters mismatch" is set to "error" in Diagnostics > Model referencing in the configuration parameters. 
How to fix this error:
  • If you want to output a nonvirtual bus from the reference model, you can check the option "output a nonvirtual bus in parent model" in the outport inside the reference model (see image above), and the error will be fixed. 
  • If you want a virtual bus, you will need to update the reference model block from the top model, so that the configuration is updated based on the referenced model: 
If the "Ports and parameters mismatch" diagnostic were set to "none", the model reference block is automatically updated. Because it is set to "error" here, you will need to update it manually. 

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModel References についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by