SysML

[SysML] #19. Mastering SysML Generalization: A Hands-On Guide with EA Examples

AutoSysEng 2025. 8. 5. 23:16

 

Unlock Complex System Design: The Secret of 'Generalization'! Ever struggled with system diagrams where elements are similar yet slightly different? This article will show you how to clarify inheritance relationships and maximize reusability and maintainability in your models!

Have you ever thought this while designing a system? "Seriously, this block and that block are almost identical, so why do I have to create them from scratch every time?" We've all been there—when multiple components share common features but also have unique ones, diagrams get complicated and hard to manage. It's a frustrating moment. Today, we're going to dive into a powerful and elegant concept called 'Generalization' that solves this very problem, in a way that's easy and fun. Join me, and you'll witness the magic of how a complex model can become remarkably clean! 😊

 

🤔 What Exactly Is Generalization?

Generalization is very similar to what we commonly call 'inheritance' in object-oriented programming. It's a relationship that allows subclasses to inherit the characteristics and functions of a superclass. In SysML's Block Definition Diagrams (BDD), generalization is used to represent this inheritance relationship between various classifiers like blocks, interfaces, and signals.

Let's take an example. Imagine a superclass called 'Car'. All cars have common attributes like 'wheels' and 'engine type,' and functions like 'drive' and 'stop'. Subclasses like 'Electric Car' or 'Hybrid Car' inherit these general features from 'Car' while adding their own special functionalities, such as 'electric charging' or 'combined use of fuel and electricity'.

💡 Good to Know!
Using generalization has great benefits!
  • Reusability & Extensibility: Define common functions once in a superclass, and subclasses can inherit, use, or extend them.
  • Ease of Maintenance: If you need to modify a common function, just change the superclass, and it applies to all subclasses. So convenient!
  • Model Clarity: The system's structure becomes clear at a glance, and you can clearly define relationships between components.

 

📊 Inheritance and Redefinition: The Core Functions of Generalization

The greatest power of generalization comes from 'inheritance' and 'redefinition'. A subclass can inherit the structural and behavioral features of its superclass and modify them to suit its own needs.

Category Description
Inheritance/Redefinition of Structural Features A subclass can add new properties or ports that are not in the superclass. It can also 'redefine' existing features, such as changing the type to a more restrictive one or modifying default values.
Inheritance/Redefinition of Behavioral Features Behavioral features like operations (functions) of the superclass can also be inherited and redefined. This allows for flexible design, such as modifying the signature of a service.
⚠️ Hold On! Be Cautious with Multiple Inheritance!
'Multiple inheritance', where a subclass inherits features from multiple superclasses, is also possible. However, it can make the structure overly complex and difficult to understand, so use it judiciously only when absolutely necessary!

 

📚 Hands-On: Modeling Generalization with Enterprise Architect (EA)

Alright, enough theory—it's time to get our hands dirty! Let's walk through how to create a generalization relationship in EA step-by-step using the example: "Model 'Car' as a superclass, and 'Electric Car' and 'Internal Combustion Engine Car' as subclasses." 🚗

  1. Create the Superclass 'CAR' Block
    First, create a new BDD and a block named 'CAR'. To represent the car's power generator, energy storage, and energy source, add `Power Generator`, `Energy Storage`, and `Energy Source` blocks and assign them as properties of the 'CAR' block.
  2. Add Behavioral Features
    Add an Activity named `Initialize` to the CAR block, an Operation named `Re-Energy`, and a Reception to handle a Signal called `Acceleration`. Now our 'CAR' block is a fine superclass with both properties and behaviors!
    Structure and features of the CAR block

    The completed CAR block.

  3. Create Subclasses and Connect the Generalization
    Now, create a new BDD called 'CAR Types' and create 'E-CAR' (Electric Car) and 'ICE-CAR' (Internal Combustion Engine Car) blocks. From the toolbox, select the 'Generalization' arrow and drag it from the subclass (E-CAR) to the superclass (CAR). If you see a relationship with a hollow triangle arrowhead, you've succeeded!
  4. Check and Display Inherited Features
    Select the E-CAR block and look at the 'Parts/Properties' tab in the 'Features' window. You'll see the properties from CAR have been inherited. To display them on the diagram, right-click the block and go to the 'Compartment Visibility' menu. Here, you can check options like 'Inherited Operation' and 'Receptions' to display the inherited features neatly on your diagram.
    E-CAR block showing inherited features

    The '::CAR' notation clearly shows the inheritance relationship.

  5. Specialize the Subclasses (Redefinition)
    Now, let's make each subclass more specific. For the E-CAR, change the type of `Power Generator` to `Motor` and `Energy Storage` to `Battery`. This is how you can 'redefine' the type of an inherited property to a more specific subtype. Similarly, for the ICE-CAR, you can change them to `Engine`, `Fuel Tank`, and so on.

 

🗂️ Adding Rules with Generalization Sets

Finally, let's look at 'Generalization Sets', which are used to group subclasses and define rules. They are used to describe how instances of a superclass relate to instances of its subclasses.

Key Properties of a Generalization Set 📝

  • Coverage: Indicates whether all instances of the superclass are included in this set ('complete' or 'incomplete').
  • Overlapping: Indicates whether one instance of the superclass can be an instance of multiple subclasses in the set ('disjoint' or 'overlapping').

In our example, since a car could also be a hybrid, the coverage is 'incomplete'. And since a car cannot be both an electric car and an internal combustion car at the same time, the overlapping property is 'disjoint'.

In EA, you can configure this by right-clicking the generalization line and selecting the 'Advanced' → 'Generalization Set' menu. This will add a notation like `{incomplete, disjoint}` to the diagram, making the model's rules even clearer.

 

💡

'Generalization' at a Glance

✨ Core Concept: Inheritance! A child (subclass) inherits features from a parent (superclass).
📊 Key Benefit: Reusability & Extensibility! Reuse what you've built and add new features as needed.
🗂️ Defining Rules:
Use Generalization Sets to clarify inheritance rules!
👩‍💻 Practical Tool: Enterprise Architect enables visual and systematic modeling.
 

So, what did you think? Today, we explored 'Generalization', a core concept in system modeling. It might feel a bit unfamiliar at first, but if you apply what you've learned today step by step, your modeling skills will surely level up! Generalization is an essential tool for efficiently modeling complex systems and clearly defining interactions between components. If you have more questions, feel free to ask in the comments anytime~ 😊

Frequently Asked Questions ❓

Q: What is the difference between a Generalization and an Association relationship?
A: Generalization is an 'is-a' relationship (e.g., an Electric Car is a type of Car), signifying inheritance. In contrast, an Association is a 'has-a' relationship (e.g., a Car has wheels), indicating that one object holds a reference to another as a property. They represent fundamentally different structures.
Q: Can a subclass delete a feature from its superclass?
A: No, according to the basic principles of inheritance, you cannot delete a feature. However, you can override the feature to change its behavior or add constraints to limit its use.
Q: My inherited properties are not visible on the diagram in EA. Why?
A: Right-click the block and check the 'Compartment Visibility' menu. You need to ensure the options related to 'Inherited Features' are checked. This setting can also be used to manage the complexity of the diagram.
Q: What does {incomplete, disjoint} mean for a generalization set?
A: 'Incomplete' means that there can be other types of the superclass besides the subclasses defined in the set (e.g., besides electric and gasoline cars, there are also hybrid cars). 'Disjoint' means that an object cannot be an instance of multiple subclasses at the same time (e.g., a car cannot be both an electric car and a gasoline car).