Riferimenti al modello
Un riferimento al modello è un riferimento a un altro modello che utilizza il blocco Model. Questi riferimenti creano una gerarchia dei modelli. Ciascun modello referenziato ha un'interfaccia definita che specifica le proprietà dei relativi input e output. L'interfaccia definita rende il comportamento del modello referenziato indipendente dal suo contesto nella gerarchia dei modelli. Per la simulazione e la generazione di codice, un modello referenziato viene eseguito come un singolo blocco o unità atomica, quando viene eseguito il modello padre. I riferimenti al modello sono ideali per il riutilizzo di codice, il collaudo delle unità, le build parallele e i componenti di grandi dimensioni. Possono inoltre ridurre la conflittualità dei file e i problemi di unione.
Per determinare se i modelli referenziati soddisfano i requisiti di modellazione, vedere Component-Based Modeling Guidelines.
Per scoprire la generazione di codice per le gerarchie di riferimento al modello, vedere Referenced Models (Simulink Coder).
Per creare un modello protetto, vedere Model Protection (Simulink Coder).
Blocchi
Model | Reference another model to create model hierarchy |
Variant Model | Template subsystem containing Subsystem, Model, or Subsystem Reference blocks as variant choices |
Funzioni
Impostazioni modello
Strumenti
Advisor di conversione dei riferimenti del modello | Convert subsystems to referenced models |
Riquadro dei file referenziati | View, save, and close referenced subsystems and models (Da R2020b) |
Argomenti
Individuazione del momento in cui fare riferimento ai modelli
- Component-Based Modeling Guidelines
Consider componentization for large models and multiuser development teams. - Model Reference Basics
Create a model hierarchy by referencing one model in another model. A referenced model contains blocks that execute together as a unit. - Model Reference Requirements and Limitations
Model references have requirements and limitations relating to features such as reusability, simulation modes, masking, and debugging.
Creazione dei riferimenti al modello
- Reference Existing Models
Include a model in another model. - Reference Protected Models from Third Parties
Use a protected model that you received from a third party. - Convert Subsystems to Referenced Models
Prepare a subsystem for conversion, convert the subsystem to a model, and compare simulation results before and after conversion. - Define Model Reference Interfaces
Ports in the referenced model correspond with ports at the model reference. Signals that cross the model boundary must meet certain requirements. - Inspect Model Hierarchies
Examine the contents, structure, model versions, and logged signals in a model hierarchy.
Configurazione dei riferimenti al modello
- Set Configuration Parameters for Model Hierarchies
Configuration parameter values can be different in top models and referenced models. Some configuration parameter values have special requirements or behavior with model referencing. - Conditionally Execute Referenced Models
Execute referenced models conditionally, similar to conditionally executed subsystems. - Referenced Model Sample Times
A referenced model can inherit sample times from the model that references it. - Parameterize Instances of a Reusable Referenced Model
When you model a reusable component as a referenced model, to configure each instance of the component to use different values for block parameters, create model arguments. - Parameterize a Referenced Model Programmatically
This example shows how to programmatically configure multiple instances of a referenced model to use different values for the same block parameter. - Group Multiple Model Arguments into a Single Structure
This example shows how to programmatically configure multiple instances of a referenced model to use different values for the same block parameter by using structures. - Configure Instance-Specific Data for Lookup Tables Programmatically
When you useSimulink.LookupTable
objects to store and configure lookup table data for ASAP2 or AUTOSAR code generation (for example, STD_AXIS or CURVE), you can configure the objects as model arguments.
Simulazione della gerarchia dei modelli
- Choose Simulation Modes for Model Hierarchies
Select the simulation mode for models in a model hierarchy. - Manage Simulation Targets for Referenced Models
A simulation target, or SIM target, is a MEX-file that implements a referenced model that executes in accelerator mode. - Share Simulink Cache Files for Faster Simulation
Use Simulink cache files to share build artifacts that let you avoid the cost of a first-time build. - Reduce Update Time for Referenced Models by Using Parallel Builds
Reduce diagram update time for large model reference hierarchies by using parallel builds. - Simulate Conditionally Executed Referenced Models
Run a standalone simulation of a conditionally executed referenced model. - Simulate Multiple Referenced Model Instances in Normal Mode
Simulate a model that contains multiple instances of a referenced model.
Informazioni complementari
- Modellazione basata sui componenti
- Modellazione su larga scala
- Sistemi della variante
- Referenced Models (Simulink Coder)
- Model Protection (Simulink Coder)