SysML v2 Deep Dive 10 min read

Lesson 20: Occurrences and the 4D model; one rocket, two masses, both correct

Occurrences and the 4D model: one rocket, two masses, both correct

What is the mass of a rocket? At ignition, the rocket has one mass. After stage separation, it has a different mass. But it is the same vehicle. It has the same serial number and one continuous existence.

SysML v1 could record a mass on a Rocket block. SysML v1 also had time concepts, for example TimeConstraint, DurationConstraint and TimeObservation. The problem was that these concepts applied to interactions and behavior. You could also model time as a value property, and connect other values to it with parametric constraints. But structure did not have a standard model element for one moment in the life of one block. Thus, a model could not say "this rocket, at this moment".

SysML v2 solves this problem with one decision about the contents of a model. Parts and actions both exist over time. Thus, you can describe each of them at a moment or over an interval. This idea is the base for all of the next few posts.

First, a fair view of v1

SysML v1 had more capabilities than many people know. InstanceSpecification could describe individual instances with slots and values. It was standardized, and it worked. Activities had a formal execution model through fUML. Also, UML could constrain the duration of a behavior.

The gap was that structure and behavior did not have a shared concept of existence. In UML, every behavior is a class, so the two had a common parent. But Class tells what kind of thing something is. It does not tell when a thing starts, how long it lasts, or when it ends.

You could ask how long an activity took. You could not ask how long a block lasted. You could draw one aircraft with one avionics suite, and later with a different suite. The v1.6 spec itself shows a machine, identified by its serial number, that changes classification over time. But SysML v1 did not have a standard relationship that said these were the same aircraft at different times.

The concept: everything that exists, occurs

KerML is the kernel under SysML v2. In KerML, Occurrence is the root concept for things that exist. It is the most general class. An occurrence takes up time and space. Data values, for example a mass, are not occurrences. Data values and occurrences are both under the top type of the library, Anything.

  • An Occurrence is a thing that has a lifetime.
  • An Object is an occurrence that is structure. SysML parts specialize Object.
  • A Performance is an occurrence that is behavior. SysML actions specialize Performance.
  • individual marks a definition that describes one identifiable thing for all of its life.
  • A timeslice is a portion of an occurrence over an interval. A snapshot is a portion at one instant.

Objects and performances are disjoint. A pump is never a pump operation. But both are occurrences. Thus, both have a start, an end and a duration. The kinds stay separate, but they have the same root.

Two more parts of the library connect these concepts. The first part is Life. Each occurrence is a portion of a life. A life is the occurrence that takes up all of the time and space of that thing. If you follow portionOf from an occurrence, you always get to one Life.

An individual definition is a subclass of Life with the multiplicity 0..1. Thus, it has a maximum of one instance. The 0 has a purpose. The spec tells you that it lets you model a counterfactual. A counterfactual is an individual that the model says does not exist.

The second part is that a kind can apply to only a part of a life. All parts are items, but an item can be a part during some timeslices and not during others. The example in the spec is an engine. On the assembly line, the engine is an item. When it is installed in a car and supplies power, it is a part. In a junkyard, it is an item again.

The code: one aircraft, two configurations

The code below shows an aircraft type and one specific aircraft of that type.

package FleetModel {
    private import ISQ::*;

    part def AvionicsSuite;

    occurrence def Aircraft {
        attribute emptyMass : MassValue;
        ref part avionics : AvionicsSuite;
    }

    individual occurrence def Aircraft_N7042 :> Aircraft;
}

package FleetOperations {
    private import FleetModel::**;

    part legacySuite : AvionicsSuite;
    part upgradedSuite : AvionicsSuite;

    occurrence n7042 : Aircraft_N7042 {
        timeslice preRefit : Aircraft {
            ref part :>> avionics = legacySuite;
        }

        timeslice postRefit : Aircraft {
            ref part :>> avionics = upgradedSuite;
        }

        first preRefit then postRefit;

        snapshot atDelivery;
        snapshot at10000Hours;
    }
}

Aircraft is a type. It describes the features that each aircraft of this design has. Aircraft_N7042 adds individual. Thus, it describes one tail number for all of its existence.

Inside n7042, two timeslices mark intervals of that life. During preRefit, the aircraft carries legacySuite. During postRefit, it carries upgradedSuite. The succession puts the two timeslices in order. The two snapshots mark single moments.

Thus, one aircraft has two configurations, and both are true. The model does not copy the aircraft to show the change. A copy loses identity. A portion keeps identity.

Timeslices are not only for individuals. If you declare timeslices in an occurrence definition, they describe a portion of each instance. In the example in the spec, each flight has three phases:

occurrence def Flight {
    timeslice preflight;
    timeslice inflight;
    timeslice postflight;
}

Timeslices can contain other timeslices. Thus, inflight can have its own climb and cruise timeslices. A snapshot inside a snapshot is not useful, because a snapshot has no duration.

Look again at first preRefit then postRefit. A succession tells you that the first occurrence ends before the second occurrence starts. It does not tell you that the second occurrence starts immediately when the first ends. Thus, there can be time between them for the refit. You can model the refit as a third timeslice. For "no time between", the library has a different relation, HappensJustBefore.

Configuration is not the only thing that can change. The features of an attribute do not change over time. But the features of an occurrence can change during its life. If a value must not change, use constant. This example adds constant to the Aircraft definition in FleetModel:

occurrence def Aircraft {
    attribute emptyMass : MassValue;
    constant attribute msn : ScalarValues::String;  // manufacturer serial number
    ref part avionics : AvionicsSuite;
}

Now, emptyMass can have a different value at each snapshot. msn must have the same value at each snapshot of a given aircraft. A value can change through a binding, a flow or an explicit assignment. The spec gives this example of an assignment: assign flight.aircraft := newAircraft;.

Timeslices, snapshots, successions and composite subactions do not change in this way. They apply to the full occurrence.

n7042 is an individual usage, because its definition is individual. You can also write individual on a usage explicitly. individual applies to all kinds of occurrence definitions. Thus, individual part def is also correct.

Now, look at the rocket again:

package LaunchVehicles {
    private import ISQ::*;

    occurrence def LaunchVehicle {
        attribute totalMass : MassValue;
    }

    individual occurrence def Falcon9_B1049 :> LaunchVehicle;

    occurrence flight : Falcon9_B1049 {
        snapshot atIgnition : LaunchVehicle {
            :>> totalMass = 549054 [SI::kg];
        }

        snapshot atStageSeparation : LaunchVehicle {
            :>> totalMass = 115000 [SI::kg];
        }

        first atIgnition then firstStageBurn;
        first firstStageBurn then atStageSeparation;

        timeslice firstStageBurn;
    }
}

Both masses are correct. One mass does not replace the other mass, because each mass belongs to a named moment of the same vehicle. Also, the masses are typed quantities with units. They are the same quantities as in the attributes post.

This is the difference between a model of a design and a model of the life of a system. A digital twin must describe one specific unit as it is today. It must also connect that description to the unit at commissioning. Individuals, snapshots and timeslices give the language the words for that.

The spec gives two more details that a twin needs. First, the lifetime of an individual and its timeslices can be actual or projected. The example in the spec is a used car. The car has an actual life until the purchase. Then a mechanic measures the tire tread and estimates how much longer the tires can last.

Second, the spec separates two things. The condition of an individual at a point in time is the set of its attribute values. The discrete states are the states that you model with state definitions. You can specify both at different points in the life of the individual.

Deep dive: three topics that become clear

Every occurrence has a start and an end

Each occurrence starts and ends at a snapshot. In the library, these snapshots are startShot and endShot. Actions rename them start and done. This is not a time mechanism that is added to behavior. Each occurrence has it, and this includes parts.

Thus, the question "When did this pump start to exist?" now has a place in the model: pump.startShot. Later posts constrain the duration of actions. They use the same temporal extent that each occurrence already has.

The library also gives these details. A snapshot is a timeslice that takes no time. The first snapshot is startShot, and the last snapshot is endShot. All other snapshots occur during the middleTimeSlice. If the start and the end of an occurrence are the same snapshot, the occurrence takes no time, as a snapshot does. Each occurrence is also a timeslice of itself and a portion of itself.

Duration comes from a library function, not from a special property. DurationOf is in the KerML Clocks library. It gives the duration of an occurrence relative to a clock. The duration is the time of the end snapshot minus the time of the start snapshot.

Space has a similar concept. The KerML Occurrences library defines space slices. A space slice is a portion that keeps all of the time, but only a part of the space. SysML does not have a keyword for space slices.

A state is a kind of action

In v1, StateMachine and Activity were separate metaclasses. Both were behaviors. A state could invoke activities as its entry, do and exit behaviors. But the state itself was a vertex in a state machine, not a behavior.

In v2, StateDefinition specializes ActionDefinition. In the library, StateAction specializes Action. Action specializes Performance, and Performance specializes Occurrence.

A system is in a state for an interval of time. V2 says this directly.

The library also contains the behavior. StateAction has the features entryAction, doAction and exitAction. These features are the entry, do and exit actions of the state. Thus, a state can include an action that continues while the state lasts.

Composition is about lifetime

The composite vs. reference post told you about lifetime in composition. A composite part cannot exist after the end of the life of the whole that owns it. This rule is valid only because parts are occurrences. The language can represent the statement "The engine exists within the life of the vehicle", because both things have lives.

SysML v1 composition had a similar rule. In UML, when you delete a composite, you also delete the parts that it contains at that moment. Also, a part belongs to a maximum of one composite at a time. In v2, the rule uses occurrences and their lifetimes. A composite value cannot exist after the end of its whole. It also cannot be a value of a different composite feature, except on the same whole.

This rule has two results. First, removal is important. If a wheel is attached to the car when the car is destroyed, the wheel is also destroyed. If you remove the wheel first, the wheel can continue to exist.

Second, composition does not tell when a part starts to exist. Thus, an engine can exist before the car exists. If you need a stronger statement, the Occurrences library has the necessary relations: HappensDuring for time, InsideOf for space, and Within for both.

V1 vs. v2 occurrences cheat sheet

ConceptSysML v1SysML v2
Common rootBlock and Behavior are both Classes, with no concept of existence over timeObject and Performance both specialize Occurrence
One specific thingInstanceSpecification, real, but with no temporal identityindividual, one thing with one continuous life
The same thing, laterYou could show it, but with no standard temporal identitytimeslice and snapshot
TimeTime constraints on behavior and interactions, or time as a value property in parametricsEach occurrence has a start snapshot and an end snapshot
StatesStateMachine and Activity, separate metaclassesStateDefinition specializes ActionDefinition
A value that changesA value property, possibly constrained as a function of timeOne mass for each snapshot, and all are correct
CompositionParts are deleted with their compositeComposite parts cannot exist after their whole, defined on occurrences

Next Lesson

Action definitions. When occurrences are in place, behavior is simpler than you expect. Actions become blueprints with typed inputs and outputs. Their start, end and duration are not special. All occurrences have them.

SysML v2

SysModeler Team

Engineering & Product