Description
Actions describe the behavior of a system using a subset textual syntax from SysML v2. Actions can be composed using nested levels to refine behavior in detail, with sequences defined using standard Python control flow and specialized action functions.Syntax for Action Modeling
Actions in Davinci use a Python-based syntax that aligns with SysML v2 action modeling principles. This approach provides:- Executable Behavior: Actions are defined as executable Python code that can be simulated and tested
- Hierarchical Composition: Actions can call nested sub-actions to build complex behaviors from simple components
- Standard Control Flow: Use familiar Python constructs (if/else, for, while) for action sequencing
Key Concepts
Actions as Functions: Each action is a function that can be called by parent actions or executed directly. Attribute Binding: Attributes referenced in action sequences are global variables, enabling data flow between actions and physics simulations. Flow Modeling: Theflow() function explicitly models message passing and data routing between system components, critical for architectural definition.
View Types
| View | Description |
|---|---|
| Activity | Visually represent action flow and logic. |
| Sequence | Visualize interactions over time. |
| Properties | Edit the object’s properties, attributes, and metadata. |
| Table | Display the object and its children in a tabular format. |
| Tree | View the hierarchical structure of the object. |
| Relationships | Explore the network of connections to other objects. |
Properties Fields
Name of the object.
Short name of the object.
Description of the object.
Code that defines the action’s behavior and flow. The sequence uses standard Python syntax with specialized functions and reference notation for modeling behaviors.
A list of all Relationships this object has with other model objects.Read more about Relationships
Action References
Actions are referenced using the@ system (which get resolved into elements in the code):
Attribute References
Attributes can be linked with@ system and represent single scalar values:
Control Flow
Standard Python control structures are supported: Sequential Execution:Action Control Functions
fork([actions]) - Execute actions in parallel:Code Object References
Call functions from code objects using the@ symbol:
Complete Example
Message Flow Modeling
Useflow() statements to explicitly model data and message routing between system components:
Best Practices
Action Composition
- Single Responsibility: Each action should have a clear, focused purpose
- Hierarchical Design: Break complex behaviors into nested sub-actions
- Reusability: Design actions to be reusable across different contexts
Sequence Definition
- Clear Flow: Use comments to explain complex logic
- Proper Indentation: Follow Python indentation rules strictly
- Error Handling: Use conditional logic to handle edge cases and failures
- Termination: Ensure all execution paths reach
end()or the final line
Performance Considerations
- Parallel Execution: Use
fork()for independent actions that can run concurrently - Efficient Loops: Avoid unnecessary iterations; use appropriate loop bounds
- Attribute Access: Minimize redundant attribute reads in tight loops
Technical Implementation
Parse-Time Resolution
When an action sequence is executed, the system performs several parse-time transformations:- UUID Resolution: References like
[Action Name]are resolved to actual function calls likeaction_abc123_def456() - Attribute Binding: Attribute references are converted to global variable names and bound to their current values
- Code Import Resolution: References to code objects are resolved to module imports
- Unit Conversion: Attribute values with units are automatically converted to the target unit system