{ "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": [ "ForestFireDetectionSystemModelFFDS_CoreFFDS_Objectives«usage»ffdsproblemStatement= \"How can we [...]\";:>>System::problemStatementsystemIdea= \"The FFDS is a [...]\";:>>System::systemIdeaattributes«metadata»System«usage»Market Leader«usage»Reliable Detection«usage»Affordability«metadata»SystemObjective@The system will make the vendor the marketleader for forest fire detection systems.«metadata»SystemObjective@Any forest fire is detected by the system on timeto start effective counteractions.«metadata»SystemObjective@The system is affordable for any forest authority." ] }, "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": [ "FFDS_BaseArchitecture«usage»ffds_BaseArchitectureContext«usage»ffds_BaseArchitecture:> SystemContext::systemOfInterestanimalMovementSensors:> ffds_BaseArchitecture::sensorsserver@Base Architecture of theSYSMOD Forest Fire Detection System (FFDS)«metadata»SystemContext«metadata»ExternalObject«metadata»ExternalObject«metadata»ExternalSystem«metadata»System«usage»animals:> SystemContext::actors«usage»environment:> SystemContext::actors«usage»satellites:> SystemContext::actorsanimalPortsatPortforestFireObservationDronessensorsanimalPortsatPort**" ] }, "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": [ "SYSMODSYSMODConcepts@SYSMOD - The Systems Modeling Toolbox,Version 5.0beta, Language Extension for SysML v2Copyright 2022 MBSE4U, Tim WeilkiensLicensed under the Apache License, Version 2.0 (the \"License\");you may not use this file except in compliance withthe License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to inwriting, softwaredistributed under the License is distributed on an \"AS IS\" BASIS,WITHOUT WARRANTIES OR CONDITIONS OFANY KIND, either express or implied.See the License for the specific language governingpermissions andlimitations under the License.«metadata def»SystemObjectivebaseType= SYSMODConcepts::objectives as SysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»SystembaseType= SYSMODConcepts::systems as SysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»SystemContextbaseType= SYSMODConcepts::systemContexts as SysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»UserbaseType= SYSMODConcepts::users as SysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»ExternalSystembaseType= SYSMODConcepts::externalSystems as SysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»MechanicalSystembaseType= SYSMODConcepts::mechanicalSystems asSysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»ExternalObjectbaseType= SYSMODConcepts::externalObjects as SysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»EnvironmentalEffectbaseType= SYSMODConcepts::environmentalEffects asSysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»EnvironmentalImpactbaseType= SYSMODConcepts::environmentalImpacts asSysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»SystemUseCasebaseType= SYSMODConcepts::systemUseCases as SysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»ContinuousUseCasebaseType= SYSMODConcepts::continuousUseCases asSysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»SystemProcessbaseType= SYSMODConcepts::systemProcesses as SysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»DomainItembaseType= SYSMODConcepts::domainItems as SysML::Usage;:>>SemanticMetadata::baseTypereferences«metadata def»UserInteractionPointbaseType= SYSMODConcepts::userInteractionPoints asSysML::Usage;:>>SemanticMetadata::baseTypereferences«part def»SystemproblemStatement: StringsystemIdea: Stringattributes«part»systems: System«requirement def»Objective«requirement»objectives: Objective«part def»SystemContext«part»systemOfInterest :> SYSMODConcepts::systems«part»actors«part»systemContexts: SystemContext«part def»User«part»users: User«part def»ExternalSystem«part»externalSystems: ExternalSystem«part def»MechanicalSystem«part»mechanicalSystems :> SYSMODConcepts::externalSystems«part def»ExternalObject«part»externalObjects: ExternalObject«part def»EnvironmentalEffect«part»environmentalEffects: EnvironmentalEffect«part def»EnvironmentalImpact«part»environmentalImpacts: EnvironmentalImpact«use case def»SystemUseCaseuseCaseResult: StringuseCasetrigger: Stringattributes«requirement»obj«use case def»ContinuousUseCase«requirement»obj«part def»DomainItem«part»domainItems: DomainItem«port def»UserInteractionPoint«port»userInteractionPoints: UserInteractionPoint@Definition of the SYSMOD concepts@Represents an engineered system.@A objective is an objective of the system.It is a special kind of a requirement that is typicallynot satisfiedbut is targeted by the system.@A system context is a wrapper around thesystem and it's actorsto allow a detailed system context modeling.@The System Use Cases are a table of content ofthe services provided by the system to its systemactors.A system use case describes a coherentinteraction of an actor with the system. Theinteraction is initiatedby a trigger. The use case returns a result that is ofvalue for an actor or stakeholder of the system.@A continuous use case is a special system usecase that, typically, is triggered by a state switch ofthesystem, but could also have an external trigger. Ithas no final result, but continuous results.@The system process describes the logicalexecution sequence of use cases@A domain items represents an object, a concept,a location,or a person from the real-world domain. A domainitem is directly known to the system.@The user interaction point contains features whichdescribe the communication with a (human) user.The concept emphasizes the special character ofthe interface in relation to more technical interfaces.«use case»systemUseCases«use case»continuousUseCases«action def»SystemProcess«action»systemProcesses1*«objective»*«objective»*" ] }, "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": [ "ForestFireDetectionSystemModelFFDS_BaseArchitecture«usage»ffds_BaseArchitectureContext«usage»ffds_BaseArchitecture:> SystemContext::systemOfInterestanimalMovementSensors:> ffds_BaseArchitecture::sensorsserverFFDS_Core«usage»ffdsFFDS_Objectives@Base Architecture of theSYSMOD Forest Fire Detection System (FFDS)«metadata»SystemContext«metadata»ExternalObject«metadata»ExternalObject«metadata»ExternalSystem«metadata»System«usage»animals:> SystemContext::actors«usage»environment:> SystemContext::actors«usage»satellites:> SystemContext::actorsanimalPortsatPortforestFireObservationDronessensorsanimalPortsatPort«metadata»System«attribute»problemStatement«attribute»systemIdea«metadata»SystemObjective@The system will make the vendor the marketleader for forest fire detection systems.«metadata»SystemObjective@Any forest fire is detected by the system on timeto start effective counteractions.«metadata»SystemObjective@The system is affordable for any forest authority.«usage»Market Leader«usage»Reliable Detection«usage»Affordability**" ] }, "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 }