Compose Models
Combine multiple models into complex multi-scale simulations.
Time estimate: 20 minutes
Goal
By the end of this tutorial, you’ll be able to:
- Understand model composition concepts
- Create a composition from multiple models
- Connect model inputs and outputs
- Run and analyze composed simulations
What is Model Composition?
Model composition allows you to:
- Connect models: Link outputs of one model to inputs of another
- Multi-scale simulation: Combine molecular, cellular, and tissue-level models
- Modular design: Reuse validated models as building blocks
- Complex systems: Model interactions between subsystems
Model composition is an advanced feature. We recommend completing the basic tutorials first.
The Composition Editor
Navigate to Compose in the main navigation to open the composition editor.
Canvas
The main workspace where you arrange and connect models.
- Drag models from the library onto the canvas
- Connect ports by dragging from output to input
- Select models to configure properties
- Pan and zoom to navigate large compositions
Model Library
Browse and search for models to add to your composition.
Properties Panel
View and edit properties of selected models or connections.
Creating a Composition
Step 1: Add Models
- Search for your first model in the library
- Drag it onto the canvas
- Repeat for additional models
Step 2: Understand Ports
Each model has:
- Input ports (left side): Accept data from other models
- Output ports (right side): Provide data to other models
Hover over a port to see its name and data type.
Step 3: Connect Models
- Click and drag from an output port
- Drop onto a compatible input port
- A connection line appears
Only compatible ports can be connected (matching data types and dimensions).
Step 4: Configure Connections
Click on a connection to set:
- Mapping: How values are transformed
- Time delay: If outputs should be delayed
- Aggregation: How to combine multiple sources
Example: Coupled Oscillators
Let’s create a simple composition with two oscillator models:
Add Models
- Search for “oscillator” in the library
- Add two instances to the canvas
- Arrange them side by side
Connect
- Connect
oscillator_1.outputtooscillator_2.input - Connect
oscillator_2.outputtooscillator_1.input
This creates a feedback loop between the oscillators.
Configure
- Select
oscillator_1and set initial conditions - Select
oscillator_2and set different initial conditions - Adjust connection strengths as needed
Run
- Click Run Composition
- Set duration and output settings
- View synchronized (or chaotic) oscillations!
Advanced Features
Subcompositions
Group multiple connected models into a reusable subcomposition:
- Select multiple models
- Right-click → Create Subcomposition
- Name your subcomposition
- Reuse in other compositions
Parameter Sharing
Share parameter values across models:
- Select models that should share a parameter
- Right-click → Link Parameters
- Changing one updates all linked parameters
Conditional Connections
Control when data flows between models:
- Click a connection
- Enable Conditional
- Set condition (e.g.,
time > 50)
Time Scaling
Handle models with different time scales:
- Select a model
- Set Time Scale Factor
- Values > 1 slow down the model
- Values < 1 speed up the model
Running Compositions
Simulation Settings
Compositions have additional settings:
| Setting | Description |
|---|---|
| Global Duration | Total simulation time |
| Sync Points | When models exchange data |
| Integration Method | Algorithm for solving |
| Error Tolerance | Accuracy vs. speed tradeoff |
Execution Order
The system automatically determines execution order based on connections. For cycles (feedback loops), it uses iterative solving.
Performance
Complex compositions may take longer. Tips:
- Reduce output points
- Increase sync point interval
- Use simpler models where possible
Saving Compositions
- Click Save
- Name your composition
- Add description and tags
- Share with collaborators (optional)
Compositions appear in your Projects dashboard.
Best Practices
- Start simple: Begin with two models before adding more
- Validate components: Run individual models first
- Document connections: Add notes explaining the biology
- Test incrementally: Add one model at a time, verify each step
- Use version control: Save versions as you develop
Troubleshooting
Connection Not Allowed
- Check data types match
- Verify dimensions are compatible
- Ensure no circular dependencies (unless intended)
Simulation Fails
- Check for numerical instability
- Reduce time step
- Verify parameter values are valid
Unexpected Results
- Verify connection directions
- Check parameter sharing
- Run models individually to isolate issues
Next Steps
- B-Simulant Library - Create compositions with Python