{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# SysML v2 MBSE Methodologies JupyterBook\n",
"\n",
"*Last update: May 26th, 2022*\n",
"\n",
"**Please note: This is work in progress. You will see sketchy stuff. If you have any comments, contact me: [tim@mbse4u.com](mailto:tim@mbse4u.com).**\n",
"\n",
"* [SYSMOD with SysML v2](#sysmlv2sysmod)\n",
" * [Problem Statement, System Idea and System Objectives](#sysmlv2sysmodproblemideaobjectives)\n",
" * [Base Architecture](#sysmlv2sysmodba)\n",
" * [SYSMOD Language Extension Library](#sysmodlibrary)\n",
" * [The Complete FFDS System Example](#sysmlv2ffds)\n",
" \n",
"* [FAS with SysML v2](#sysmlv2fas)\n",
"* [VAMOS (Variant Modeling with SysML v2](#sysmlv2vamos)\n",
"\n",
"## How to use this notebook\n",
"\n",
"First, execcute the [SYSMOD library](#sysmodlibrary) before use execute the examples. The library is used by all of them.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## SYSMOD with SysML v2\n",
"\n",
"The example is taken from the book [SYSMOD - The Systems Modeling Toolbox](https://leanpub.com/sysmod). It is a Forest Fire Detection System (FFDS).\n",
"\n",
"The following will be part of the next edition of the SYSMOD book which will cover SysML v2.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Problem Statement, System Idea and System Objectives\n",
"\n",
"The language extension of SysML v2 is still under development. Until it is available, I use a simplified approach to introduce SYSMOD concepts into the language. "
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Package ForestFireDetectionSystemModel (11845394-a87f-4610-8a2a-f2480300b3df)\n"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"package ForestFireDetectionSystemModel { \n",
"\timport SYSMOD::*;\n",
"\n",
"\tpackage FFDS_Core {\n",
"\t\t\n",
"\t\t#system ffds {\n",
"\t\t\tattribute redefines problemStatement = \"How can we [...]\";\n",
"\t\t\tattribute redefines systemIdea = \"The FFDS is a [...]\";\n",
"\t }\n",
"\t }\n",
"\t \n",
"\t package FFDS_Objectives {\n",
"\t \t#systemObjective <'OBJ-B1'> 'Market Leader' {\n",
"\t \t\tdoc /* The system will make the vendor the market \n",
" \t * leader for forest fire detection systems.\n",
" \t\t */\n",
" }\n",
" #systemObjective <'OBJ-S1'> 'Reliable Detection' {\n",
" doc /* Any forest fire is detected by the system on time \n",
" * to start effective counteractions.\n",
" */\n",
" }\n",
" #systemObjective <'OBJ-S2'> 'Affordability' {\n",
" doc /* The system is affordable for any forest authority. */\n",
" } \n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%viz ForestFireDetectionSystemModel"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Base Architecture"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The base architecture of the FFDS includes a base context."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Package FFDS_BaseArchitecture (699e4a2f-1ce0-4897-a8dc-b64ccaad87d3)\n"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"package FFDS_BaseArchitecture {\n",
"\tdoc /* Base Architecture of the \n",
" * SYSMOD Forest Fire Detection System (FFDS)\n",
" */\n",
" \n",
" import SYSMOD::*;\n",
" \n",
" #systemContext ffds_BaseArchitectureContext { \n",
"\n",
" // External entities\n",
" #externalObject animals[1..*] :> actors;\n",
" connect animals to ffds_BaseArchitecture.animalPort;\n",
" #externalObject environment :> actors;\n",
" #externalSystem satellites [1..*] :> actors;\n",
" connect satellites to ffds_BaseArchitecture.satPort;\n",
"\n",
" // Base Architecture\t\t\n",
" #system ffds_BaseArchitecture :> systemOfInterest {\n",
" part forestFireObservationDrones[1..*];\n",
" part sensors[1..*];\n",
" part animalMovementSensors[1..*] :> sensors {\n",
" \tport animalPort;\n",
" } \t\n",
" part server {\n",
" \tport satPort;\n",
" }\n",
" \n",
" port animalPort;\n",
" \t bind animalPort = animalMovementSensors.animalPort;\n",
" \t\t\n",
" \t port satPort;\n",
" \t bind satPort = server.satPort;\t \n",
" }\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%viz --view=interconnection FFDS_BaseArchitecture"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### System Use Cases"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Use Case Activities"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Domain Model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Quality Requirements"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Logical Architecture "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Product Architecture"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### System States"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Verify Architecture with Scenarios"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Test Cases"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### SYSMOD Language Extension Library"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Package SYSMOD (84af4294-cb22-4ce0-bccf-5c973defaeb2)\n",
"Package Engineering4Planet (2a6e081c-0002-4a01-9cbd-c9cec4a1d0cc)\n"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"package SYSMOD {\n",
" \n",
" doc /* SYSMOD - The Systems Modeling Toolbox, Version 5.0beta, Language Extension for SysML v2\n",
" *\n",
" * Copyright 2022 MBSE4U, Tim Weilkiens\n",
" *\n",
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n",
" * you may not use this file except in compliance with the License.\n",
" * You may obtain a copy of the License at\n",
" *\n",
" * http://www.apache.org/licenses/LICENSE-2.0\n",
" *\n",
" * Unless required by applicable law or agreed to in writing, software\n",
" * distributed under the License is distributed on an \"AS IS\" BASIS,\n",
" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
" * See the License for the specific language governing permissions and\n",
" * limitations under the License.\n",
" *\n",
" */ \n",
"\n",
"\tpackage SYSMODConcepts {\n",
"\t\tdoc /*\n",
"\t\t * Definition of the SYSMOD concepts \n",
"\t\t */ \n",
"\n",
" part def System {\n",
" \tdoc /* Represents an engineered system. */\n",
" \n",
" \tattribute problemStatement : ScalarValues::String;\n",
" \tattribute systemIdea : ScalarValues::String;\n",
" }\n",
" part systems[*] : System; \n",
"\n",
"\t\trequirement def Objective {\n",
" \t doc /* A objective is an objective of the system. \n",
" \t * It is a special kind of a requirement that is typically not satisfied \n",
" \t * but is targeted by the system.\n",
" \t*/\n",
" }\n",
" requirement objectives[*] : Objective;\n",
" \t \t \n",
" \t\tpart def SystemContext {\n",
" doc /* A system context is a wrapper around the system and it's actors \n",
" \t * to allow a detailed system context modeling. \n",
" \t */\n",
"\n",
" \tpart systemOfInterest :> systems;\n",
" \tpart actors[0..*];\n",
" \t}\n",
"\t\tpart systemContexts[*] : SystemContext;\n",
"\n",
" // Actor categories\n",
" \tpart def User;\n",
" \tpart users[*] : User; \n",
" \tpart def ExternalSystem;\n",
" \tpart externalSystems[*] : ExternalSystem;\n",
" \tpart def MechanicalSystem :> ExternalSystem;\n",
" \tpart mechanicalSystems[*] :> externalSystems;\n",
" \tpart def ExternalObject;\n",
"\t part externalObjects[*] : ExternalObject;\n",
" \tpart def EnvironmentalEffect;\n",
" part environmentalEffects[*] : EnvironmentalEffect;\n",
" \tpart def EnvironmentalImpact;\n",
" \tpart environmentalImpacts[*] : EnvironmentalImpact;\n",
"\n",
" use case def SystemUseCase {\n",
" doc /* The System Use Cases are a table of content of the services provided by the system to its system actors. \n",
" * A system use case describes a coherent interaction of an actor with the system. The interaction is initiated \n",
" * by a trigger. The use case returns a result that is of value for an actor or stakeholder of the system.\n",
" */\n",
" \n",
" \tattribute useCasetrigger : ScalarValues::String;\n",
" \tattribute useCaseResult : ScalarValues::String;\n",
" }\n",
" use case systemUseCases[*] : SystemUseCase;\n",
" \n",
" use case def ContinuousUseCase :> SystemUseCase {\n",
" doc /* A continuous use case is a special system use case that, typically, is triggered by a state switch of the \n",
" * system, but could also have an external trigger. It has no final result, but continuous results. \n",
" */\n",
" }\n",
" use case continuousUseCases[*] : ContinuousUseCase; \n",
"\n",
" action def SystemProcess {\n",
" \tdoc /* The system process describes the logical execution sequence of use cases */\n",
" } \n",
" action systemProcesses[*] : SystemProcess;\n",
" \n",
" \t \n",
" \tpart def DomainItem {\n",
" \t\tdoc /* A domain items represents an object, a concept, a location, \n",
" \t\t * or a person from the real-world domain. A domain item is directly known to the system.\n",
" \t\t */ \n",
" \t}\n",
" \tpart domainItems[*] : DomainItem;\n",
" \t\n",
" \tport def UserInteractionPoint {\n",
" \t doc /* The user interaction point contains features which describe the communication with a (human) user. \n",
" \t * The concept emphasizes the special character of the interface in relation to more technical interfaces.\n",
" \t */\n",
" \t}\n",
" \tport userInteractionPoints[*] : UserInteractionPoint; \t\n",
"\t}\n",
"\n",
" \n",
" //\n",
" // Language Extensions of the SYSMOD concepts\n",
" //\n",
" \tmetadata def SystemObjective :> Metaobjects::SemanticMetadata {\n",
" \t:>> baseType = SYSMODConcepts::objectives as SysML::Usage;\n",
" \t}\n",
"\n",
"\tmetadata def System :> Metaobjects::SemanticMetadata {\n",
" \t\t:>> baseType = SYSMODConcepts::systems as SysML::Usage; \t\n",
" \t}\n",
"\n",
" \tmetadata def SystemContext :> Metaobjects::SemanticMetadata {\n",
" \t\t:>> baseType = SYSMODConcepts::systemContexts as SysML::Usage;\n",
" \t}\n",
"\n",
" metadata def User :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::users as SysML::Usage; \t\n",
" }\n",
" metadata def ExternalSystem :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::externalSystems as SysML::Usage; \t\n",
" }\n",
" metadata def MechanicalSystem :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::mechanicalSystems as SysML::Usage; \t\n",
" }\n",
" metadata def ExternalObject :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::externalObjects as SysML::Usage; \t\n",
" }\n",
" metadata def EnvironmentalEffect :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::environmentalEffects as SysML::Usage; \t\n",
" }\n",
" metadata def EnvironmentalImpact :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::environmentalImpacts as SysML::Usage; \t\n",
" }\t\t\n",
"\n",
" metadata def SystemUseCase :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::systemUseCases as SysML::Usage; \t\n",
" }\t\t\n",
" metadata def ContinuousUseCase :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::continuousUseCases as SysML::Usage; \t\n",
" }\t\t\n",
" metadata def SystemProcess :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::systemProcesses as SysML::Usage; \t\n",
" }\t\t \n",
"\n",
" metadata def DomainItem :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::domainItems as SysML::Usage; \t\n",
" }\t\t\n",
"\n",
" metadata def UserInteractionPoint :> Metaobjects::SemanticMetadata {\n",
" :>> baseType = SYSMODConcepts::userInteractionPoints as SysML::Usage; \t\n",
" }\t\t\n",
"\n",
"}\n",
"\n",
"\n",
"package Engineering4Planet {\n",
"\tattribute def Kg;\n",
"\n",
"\titem def PlanetImpact {\n",
" \t\t\tattribute co2 : Kg;\n",
" \t\t\twaste : ScalarValues::String;\n",
" \t}\n",
"}\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%viz SYSMOD"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### The Complete FFDS System Example\n",
"\n",
"Below you find the complete example in a single code section."
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Package ForestFireDetectionSystemModel (735723e1-175c-4b17-ad07-8d5b3a3287be)\n"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"package ForestFireDetectionSystemModel { \n",
"\n",
" import SYSMOD::*;\n",
" \n",
" package FFDS_BaseArchitecture {\n",
" doc /* Base Architecture of the \n",
" * SYSMOD Forest Fire Detection System (FFDS)\n",
" */\n",
" import SYSMOD::*;\n",
" \n",
" #systemContext ffds_BaseArchitectureContext { \n",
" // External entities\n",
" #externalObject animals[1..*] :> actors;\n",
" connect animals to ffds_BaseArchitecture.animalPort;\n",
" #externalObject environment :> actors;\n",
" #externalSystem satellites [1..*] :> actors;\n",
" connect satellites to ffds_BaseArchitecture.satPort;\n",
"\n",
" // Base Architecture\n",
" #system ffds_BaseArchitecture :> systemOfInterest {\n",
" part forestFireObservationDrones[1..*];\n",
" part sensors[1..*];\n",
" part animalMovementSensors[1..*] :> sensors {\n",
" port animalPort;\n",
" } \n",
" part server {\n",
" port satPort;\n",
" }\n",
" \n",
" port animalPort;\n",
" bind animalPort = animalMovementSensors.animalPort;\n",
"\n",
" port satPort;\n",
" bind satPort = server.satPort;\t \n",
" }\n",
" }\n",
" }\n",
" \n",
" package FFDS_Core {\n",
"\n",
" #system ffds {\n",
" attribute redefines problemStatement = \"How can we [...]\";\n",
" attribute redefines systemIdea = \"The FFDS is a [...]\";\n",
" }\n",
" }\n",
" \n",
" package FFDS_Objectives {\n",
" #systemObjective <'OBJ-B1'> 'Market Leader' {\n",
" doc /* The system will make the vendor the market \n",
" * leader for forest fire detection systems.\n",
" */\n",
" }\n",
" #systemObjective <'OBJ-S1'> 'Reliable Detection' {\n",
" doc /* Any forest fire is detected by the system on time \n",
" * to start effective counteractions.\n",
" */\n",
" }\n",
" #systemObjective <'OBJ-S2'> 'Affordability' {\n",
" doc /* The system is affordable for any forest authority. */\n",
" }\n",
" }\n",
"}\n"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%viz ForestFireDetectionSystemModel"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "SysML",
"language": "sysml",
"name": "sysml"
},
"language_info": {
"codemirror_mode": "sysml",
"file_extension": ".sysml",
"mimetype": "text/x-sysml",
"name": "SysML",
"pygments_lexer": "java",
"version": "1.0.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}