Model Your First System

This tutorial provides a beginner-friendly guide to creating your first system with SysML v2 and SysON, adapted from the training SysML v2 Introductory Training Flashlight Starter Model by Sanford Friedenthal. The focus is on representing a flashlight.

1. Step 1: Create a Project

  1. Open the Projects Browser and create a new SysML v2 project by clicking on the SysML v2 card.

  2. The Project Editor automatically opens, creating a new project named SysML v2 with a package Package1. A default General view representation associated with the package is opened in the main editor area.

  3. From the project toolbar, rename the project to Flashlight.

  4. From the Project Explorer, rename the model to Flashlight.sysml and the package to Flashlight_StarterModel.

2. Step 2: Model Organization (Package Structure)

  1. In the main editor area, right-click on the diagram background to open the palette.

  2. Click on StructureNew Package to create a new package.

  3. Rename the package to FlashlightSpecificationAndDesign.

  4. Right-click on the FlashlightSpecificationAndDesign package, select StructureNew Package to create a new package inside it.

  5. Rename it to Requirements.

  6. Right-click again on the FlashlightSpecificationAndDesign, and use the quick access tool New Package.

  7. Rename it to ActionTree.

  8. Repeat the earlier step to create and rename the following packages inside FlashlightSpecificationAndDesign:

    • PartsTree

    • RequirementsAllocation

  9. Click on the Arrange all elements menu in the global toolbar at the top of the diagram.

Flashlight Model Organization

3. Step 3: Flashlight Requirements Tree

  1. In the explorer, select the Requirements package, click the "more" menu, and choose New representation

  2. Set the name of the representation to Requirements General View.

  3. Create a new General View and open it.

  4. In the main editor area, right-click on the diagram background to open the palette.

  5. Click on RequirementsNew Requirement to create a new requirement.

  6. Rename it to flashlightSpecification.

  7. Right-click on the flashlightSpecification requirement, then select RequirementsNew Requirement to create a nested requirement.

  8. Rename the new requirement to userInterface.

  9. In the explorer, select flashlightSpecification, click the "more" menu, and choose New objects from text.

  10. In the modal input box, paste the following content:

requirement illumination{
 requirement fieldOfView{
  doc /* The flashlight field of view shall be 0 - 20 degrees.*/
 }
requirement lightPower{
 doc /* The light power shall be a minimum of TBD lumens.*/
 }
}
requirement physical{
 requirement portability;
 requirement size{
  doc /* The flashlight shall be less than 6 inches in length.*/
 }
 requirement weight;
}
requirement reliability;
requirement cost;
  1. Select the newly created elements (illumination, physical, reliability, cost, portability, size, weight, fieldOfView, lightPower) in the explorer (Ctrl + Click), and drag-and-drop them into the diagram.

  2. Use the Arrange all elements tool from the diagram toolbar to auto layout the diagram.

  3. Right-click on the size requirement and select Show/Hide → Show valued content to display the documentation in the diagram.

  4. Repeat the operation for the children of illumination: fieldOfView and lightPower.

  5. Right-click on the weight requirement and select the New Documentation tool.

  6. In the newly created doc element, enter the text: The weight shall be less than 0.25 kg.

  7. Right-click on the weight requirement again and choose Structure → New Attribute.

  8. Edit the new attribute to actualweight :> mass.

  9. Right-click on the background of diagram and use the tool New Namespace Import. Then select SI/Library Package SI to import it from the standard libraries.

  10. Use the palette filter to locate the New Required Constraint tool, and apply it to the weight requirement.

  11. Edit the constraint to: actualweight<=0.25[kg]

Flashlight Requirements Tree

4. Step 4: Produce Directed Light Action Flow

  1. In the explorer, select the ActionTree package, click the "more" menu, and choose New representation.

  2. Set the name of the representation to Action Tree General View.

  3. Create a new General View and open it.

  4. In the main editor area, right-click on the diagram background to open the palette.

  5. Click on BehaviorNew Action to create a new action.

  6. Rename it produceDirectedLight.

  7. Right-click on the produceDirectedLight action, then select BehaviorNew Start Action.

  8. Right-click again on produceDirectedLight, then select BehaviorNew Fork.

  9. Rename the fork to fork1.

  10. Select the start node and use the connection tool to create a succession between the start action and the fork node.

  11. Right-click on the produceDirectedLight and select BehaviorNew Action to create a nested action.

  12. Rename the nested action to provideDCPwr.

  13. Select fork1 and use the connection tool to create a succession to the provideDCPwr action.

  14. Right-click on provideDCPwr, then select StructureNew Item Out.

  15. Rename the item to outdcPwr.

  16. In the explorer, select the produceDirectedLight action, click the "more" menu, and choose New objects from text.

  17. In the model input box, paste the following content:

in item onOffCmd;
out item lightOut;
action connectDCPwr {
  	in item onOffCmd;
  	in item dcPwrIn;
  	out item dcPwrOut;
}
action generateLight{
  	in item dcPwrIn;
  	out item light;
}
action directLight{
  	in item lightIn;
  	out item lightOut;
}
  1. In the action flow compartment of produceDirectLight use the tool Related Elements → Add existing element.

  2. Create a new transition between fork1 and connectDCPwr.

  3. Set the value of connectDCPwr::onOffCmd by renaming the item in onOffCmd of connectDCPwr to in onOffCmd = produceDirectedLight.onOffCmd

  4. Create a Flow Connection (flow) from dcPwrOut of connectDCPwr to dcPwrIn of generateLight.

  5. Create a Flow Connection (flow) between light of generateLight to lightIn of directLight.

  6. Create a Flow Connection (flow) between outdcPwr of provideDCPwr to dcPwrIn of connectDCPwr.

  7. Using the eye icon on the produceDirectLight action display the items compartement

  8. Set the value of produceDirectedLight::lightOut by renaming the item out lightOut of produceDirectedLight to out lightOut = directLight.lightOut.

Flashlight Requirements Tree

5. Step 5: Flashlight Interconnection

  1. In the explorer, select the PartsTree package, click the "more" menu, and choose New representation.

  2. Set the name of the representation to Parts Tree General View.

  3. Create a new General View and open it.

  4. In the main editor area, right-click on the diagram background to open the palette.

  5. Click on StructureNew Part to create a new part usage.

  6. Rename it to flashlight.

  7. Right-click on flashlight, then select StructureNew Attribute.

  8. Edit it to mass :> ISQ::mass

  9. Right-click again on flashlight, and use the quick access tool New Attribute to add fov:Real.

  10. Right-click again on flashlight, and use the quick access tool New Attribute to add illuminationLevel:Real.

  11. Right-click on flashlight, then select the BehaviorNew Perform and select the action produceDirectedLight created earlier.

  12. In the explorer, select the flashlight part, click the "more" menu, and choose New representation.

  13. Set the name of the representation to Flashlight Interconnection View.

  14. Create a new Interconnection View and open it.

  15. Right-click on flashlight, then select the StructureNew Port.

  16. Rename it cmdPort.

  17. Right-click on flashlight, then select the StructureNew Part to create a nested part.

  18. Rename it switch.

  19. Right-click on switch, then select the StructureNew Port.

  20. Rename it cmdPort.

  21. Create a new binding between the cmdPort of flashlight and the cmdPort of the switch.

  22. Right-click on switch, then select the StructureNew Port In.

  23. Rename it inPort.

  24. Right-click on switch, then select the StructureNew Port Out.

  25. Rename it outPort.

  26. Right-click on flashlight, then select the StructureNew Part to create a nested part.

  27. Rename it battery.

  28. In the Details view, select the Advanced tab and uncheck the Is Composite property, to declare that this is a reference.

  29. Edit it to battery[2] to declare that the part has a multiplicity equal to 2.

  30. Right-click on battery, then select the StructureNew Port Out.

  31. Rename it dcPwrOutPort.

  32. Select dcPwrOutPort, create a flow between dcPwrOutPort and inPort.

  33. In the explorer, select the flashlight part, click the "more" menu, and choose New objects from text.

  34. In the model input box, paste the following content:

port lightOutPort;
port handPort;
part lamp{
  attribute efficiency:Real;
  in port dcPwrInPort;
  out port lightOutPort;
}
part optics{
  in port lightInPort;
  out port lightOutPort;
  part reflector{
  	attribute radius :> ISQ::length;
  }
  part lens;
}
part structure{
	port handPort;
  part frontHousing;
  part middleHousing;
  part backHousing;
}
  1. Drag and drop the newly created parts lamp, optics, structure into the flashlight part.

  2. Create a new binding between the lightOutPort of flashlight and the lightOutPort of the optics.

  3. Create a new binding between the handPort of flashlight and the handPort of the structure.

  4. Select outPort, create a flow between outPort and dcPwrInPort.

  5. Select lightOutPort, create a flow between lightOutPort and lightInPort.

Flashlight Interconnection

6. Step 6: Flashlight States

  1. In the explorer, select the flashlight part, click the "more" menu, and choose New representation.

  2. Set the name of the representation to Flashlight General View.

  3. Create a new General View and open it.

  4. In the main editor area, right-click on the diagram background to open the palette.

  5. Click on BehaviorNew Exhibit State to create an exhibit state usage.

  6. Rename it to flashlightStates.

  7. Right-click on flashlightStates, then select the BehaviorNew State to create a three nested states.

  8. Rename them to initial, off, and on.

  9. Create transition named init between the initial state and the off state.

  10. Create the following transitions between the on state and the off state.

    1. transition off_To_on from off to on

    2. transition on_To_off from on to off

  11. Right-click on the on state, select the BehaviorDo Action with referenced action, and select the produceDirectedLight action defined earlier .

Flashlight States

7. Step 7: Flashlight Requirements Allocation

  1. In the explorer, select the RequirementsAllocation package, click the "more" menu, and choose New representation.

  2. Create a new General View and open it.

  3. Drag and drop the following elements from the explorer to the diagram :

    • Requirements:

      • flashlightSpecification,

      • illumination,

      • fieldofView,

      • lightPower,

      • physical,

      • weight;

    • Part:

      • flashlight;

    • Attributes of flashlight:

      • mass,

      • illuminationLevel,

      • fov;

    • Action:

      • produceDirectedLight.

  4. Create the following allocations:

    • illuminationproduceDirectedLight,

    • weightmass,

    • fieldOfViewfov,

    • lightPowerilluminationLevel.

Flashlight Requirements Allocation