UML与SysML的联系
UML(统一建模语言)和SysML(系统建模语言)是两种与建模相关的语言,它们之间存在联系和区别。
SysML的图分类如下图所示。
联系
- SysML是基于UML的,它重用了UML 2的子集,并提供了额外的扩展来满足系统工程领域的需求。
- SysML保留了UML的一些建模构造,并将其称为UML4SysML子集。
- UML和SysML都提供了一种通用的建模语言,用于描述系统的结构、行为和交互。
- UML和SysML都使用图形符号和规则来表示系统的各个方面,以帮助开发人员和设计师进行系统建模和分析。
区别
- UML是一种更通用的建模语言,可应用于各种软件系统的建模和设计,重点是面向对象分析与设计。
- SysML是一种专门用于系统工程领域的建模语言,强调系统的结构、行为和交互的建模和分析。
- SysML在重用了UML的基础上,提供了额外的建模构造和扩展,以满足系统工程领域的特定需求。
- SysML包括了UML的一部分构造,并引入了一些新的构造和替代构造,以更好地支持系统工程的需求。
设计原则
SysML的基本设计原则如下:
- 需求驱动:SysML旨在满足UML for SE RFP的需求。
- UML重用:SysML在尽可能的情况下重用UML,以满足RFP的需求。当需要进行修改时,SysML会尽量减少对底层语言的更改。因此,对于支持UML 2的供应商来说,实施SysML相对容易。
- UML扩展:SysML根据RFP的需求对UML进行扩展。主要的扩展机制是UML 2的配置机制,在第17条“Profiles & Model Libraries”中进一步进行了详细说明。
- 分区:包是这个国际标准中的基本分区单位。包将模型元素分组成逻辑集合,以最小化它们之间的循环依赖。
- 层次结构:SysML包被指定为UML元模型的扩展层。
- 互操作性:SysML继承了UML的XMI交换能力。SysML还旨在通过ISO 10303-233数据交换标准来支持与其他工程工具的互操作性。
SysML提供了三个模型库:
- PrimitiveValueTypes(原始值类型)
- UnitAndQuantityKind(单位和量纲类型)
- ControlValues(控制值类型)
架构
SysML与UML 2之间的关系如下图所示。SysML扩展了UML 2的StandardProfile,其中的Trace和Refine stereotypes为SysML中的需求追踪提供了基础。
虽然SysML由于包导入的传递性间接导入了UML 2的PrimitiveTypes库,但SysML提供了一个PrimitiveValueTypes模型库,系统工程师可以通过SysML的ValueType stereotype来扩展它。在本文档的其余部分,对Boolean、Integer、Real和String的未限定引用应按如下方式解释:
- 在SysML Stereotype定义的上下文中,名称引用了UML 2 PrimitiveTypes库中UML::PrimitiveType的定义。
- 在其他上下文中,名称引用了SysML PrimitiveValueTypes库中UML::DataType的SysML::ValueType stereotype的定义。
SysML的设计方法是重用UML的子集,并创建扩展来支持满足UML for SE RFP中需求的特定概念。如下图所示的SysML包结构:SysML Extension of UMLFigure包含一组与SysML中扩展的概念领域对应的包。
SysML的包扩展了UML如下:
- SysML::Model Elements扩展了Classification、Common Structure。
- SysML::Blocks扩展了Classification、Structured Classifiers、Common Structure、Simple Classifiers。
- SysML::ConstraintBlocks扩展了Structured Classifiers。
- SysML::Ports and Flows扩展了Actions、Common Behavior、Classification。
- SysML::Activities扩展了Activities。
- SysML::Allocations扩展了Common Structure、Activities。
- SysML::Requirements扩展了Common Structure、Classification、Common Behavior、Structured Classifiers。
- SysML::DeprecatedElements扩展了Common Structure、Simple Classifiers、Classification、Structured Classifiers、Actions和SysML Item Flows。
下图显示了本国际标准中非规范的包,这些包依赖于SysML和UML。请注意,QUDV和ISO-80000库在本规范的非规范附录中进行了描述。
扩展机制
本国际标准使用以下机制来定义SysML的扩展:
- UML stereotypes
- UML diagram extensions
- 模型库(model libraries)
SysML构造型通过扩展现有的UML 2构造型,并添加新的属性和约束,来定义新的建模构造。SysML图扩展定义了新的图形符号,补充了从UML 2重用的图形符号。SysML模型库描述了可重用的特定模型元素。附录E“非规范扩展”中还包括其他非规范的扩展。
SysML用户模型是通过实例化其元模型并应用SysML配置文件中指定的构造型来创建的,可以选择性地引用或子类化SysML模型库中的模型元素。第17条“配置文件和模型库”描述了如何应用配置文件和模型库,并说明了如何进一步扩展SysML。
以下metaclasses方便查询
UML2 metaclasses excluded from the UML4SysML subset
Artifact, ClassifierTemplateParameter, Collaboration, CollaborationUse,
CommunicationPath, Component, ComponentRealization,
ConnectableElementTemplateParameter, Deployment, DeploymentSpecification,
Device, ExceptionHandler, ExecutionEnvironment, ExpansionNode, ExpansionRegion,
Manifestation, Node, OperationTemplateParameter, ProtocolConformance,
ProtocolStateMachine, ProtocolTransition, QualifierValue,
ReadLinkObjectEndQualifierAction, RedefinableTemplateSignature, StringExpression,
TemplateBinding, TemplateParameter, TemplateParameterSubstitution,
TemplateSignature, UMLActivityDiagram, UMLAssociationEndLabel,
UMLAssociationOrConnectorOrLinkShape,
UMLAssociationOrConnectorOrLinkShapeKind, UMLBehaviorDiagram,
UMLClassDiagram, UMLClassifierShape, UMLCompartment,
UMLCompartmentableShape, UMLComponentDiagram,
UMLCompositeStructureDiagram, UMLDeploymentDiagram, UMLDiagram,
UMLDiagramElement, UMLDiagramWithAssociations, UMLEdge,
UMLInteractionDiagram, UMLInteractionDiagramKind, UMLInteractionTableLabel,
UMLKeywordLabel, UMLLabel, UMLMultiplicityLabel, UMLNameLabel,
UMLNavigabilityNotationKind, UMLObjectDiagram, UMLPackageDiagram,
UMLProfileDiagram, UMLRedefinesLabel, UMLShape, UMLStateMachineDiagram,
UMLStateShape, UMLStereotypePropertyValueLabel, UMLStructureDiagram,
UMLStyle, UMLTypedElementLabel, UMLUseCaseDiagram
UML 2 metaclasses and datatypes included in the UML4SysML subsetTable
Abstraction, AcceptCallAction, AcceptEventAction, Action,
ActionExecutionSpecification, ActionInputPin, Activity, ActivityEdge, ActivityFinalNode,
ActivityGroup, ActivityNode, ActivityParameterNode, ActivityPartition, Actor,
AddStructuralFeatureValueAction, AddVariableValueAction, AggregationKind,
AnyReceiveEvent, Association, AssociationClass, Behavior,
BehaviorExecutionSpecification, BehavioralFeature, BehavioredClassifier,
BroadcastSignalAction, CallAction, CallBehaviorAction, CallConcurrencyKind,
CallEvent, CallOperationAction, CentralBufferNode, ChangeEvent, Class, Classifier,
Clause, ClearAssociationAction, ClearStructuralFeatureAction, ClearVariableAction,
CombinedFragment, Comment, ConditionalNode, ConnectableElement,
ConnectionPointReference, Connector, ConnectorEnd, ConnectorKind,
ConsiderIgnoreFragment, Constraint, Continuation, ControlFlow, ControlNode,
CreateLinkAction, CreateLinkObjectAction, CreateObjectAction, DataStoreNode,
DataType, DecisionNode, Dependency, DeployedArtifact, DeploymentTarget,
DestroyLinkAction, DestroyObjectAction, DestructionOccurrenceSpecification,
DirectedRelationship, Duration, DurationConstraint, DurationInterval,
DurationObservation, Element, ElementImport, EncapsulatedClassifier, Enumeration,
EnumerationLiteral, Event, ExecutableNode, ExecutionOccurrenceSpecification,
ExecutionSpecification, Expression, Extend, Extension, ExtensionEnd, ExtensionPoint,
Feature, FinalNode, FinalState, FlowFinalNode, ForkNode, FunctionBehavior, Gate,
GeneralOrdering, Generalization, GeneralizationSet, Image, Include, InformationFlow,
InformationItem, InitialNode, InputPin, InstanceSpecification, InstanceValue,
Interaction, InteractionConstraint, InteractionFragment, InteractionOperand,
InteractionOperatorKind, InteractionUse, Interface, InterfaceRealization,
InterruptibleActivityRegion, Interval, IntervalConstraint, InvocationAction, JoinNode,
Lifeline, LinkAction, LinkEndCreationData, LinkEndData, LinkEndDestructionData,
LiteralBoolean, LiteralInteger, LiteralNull, LiteralReal, LiteralSpecification, LiteralString,
LiteralUnlimitedNatural, LoopNode, MergeNode, Message, MessageEnd,
MessageEvent, MessageKind, MessageOccurrenceSpecification, MessageSort, Model,
MultiplicityElement, NamedElement, Namespace, ObjectFlow, ObjectNode,
ObjectNodeOrderingKind, Observation, OccurrenceSpecification, OpaqueAction,
OpaqueBehavior, OpaqueExpression, Operation, OutputPin, Package, PackageImport,
PackageMerge, PackageableElement, Parameter, ParameterDirectionKind,
ParameterEffectKind, ParameterSet, ParameterableElement, PartDecomposition, Pin,
Port, PrimitiveType, PrimitiveTypes::Boolean, PrimitiveTypes::Integer,
PrimitiveTypes::Real, PrimitiveTypes::String, PrimitiveTypes::UnlimitedNatural,
PrimitiveValueTypes::Boolean, Profile, ProfileApplication, Property, Pseudostate,
PseudostateKind, RaiseExceptionAction, ReadExtentAction,
ReadIsClassifiedObjectAction, ReadLinkAction, ReadLinkObjectEndAction,
ReadSelfAction, ReadStructuralFeatureAction, ReadVariableAction, Realization,
Reception, ReclassifyObjectAction, RedefinableElement, ReduceAction, Region,
Relationship, RemoveStructuralFeatureValueAction, RemoveVariableValueAction,
ReplyAction, SendObjectAction, SendSignalAction, SequenceNode, Signal,
SignalEvent, Slot, StartClassifierBehaviorAction, StartObjectBehaviorAction, State,
StateInvariant, StateMachine, Stereotype, StructuralFeature, StructuralFeatureAction,
StructuredActivityNode, StructuredClassifier, Substitution, TestIdentityAction,
TimeConstraint, TimeEvent, TimeExpression, TimeInterval, TimeObservation,
Transition, TransitionKind, Type, TypedElement, UnmarshallAction, Usage, UseCase,
ValuePin, ValueSpecification, ValueSpecificationAction, Variable,VariableAction,
Vertex, VisibilityKind, WriteLinkAction, WriteStructuralFeatureAction,
WriteVariableAction
SysML stereotypes, blocks, valuetypes, and datatypes
AcceptChangeStructuralFeatureEventAction, AdjunctProperty, Allocate,
AllocateActivityPartition, BindingConnector, Block, BoundReference,
ChangeStructuralFeatureEvent, ClassifierBehaviorProperty, Conform,
ConnectorProperty, ConstraintBlock, Continuous, ControlOperator, ControlValueKind,
Copy, DeriveReqt, DirectedFeature, DirectedRelationshipPropertyPath, Discrete,
DistributedProperty, ElementGroup, ElementPropertyPath, EndPathMultiplicity, Expose,
FeatureDirectionKind, FlowProperty, FullPort, InterfaceBlock,
InvocationOnNestedPortAction, ItemFlow, NestedConnectorEnd, NoBuffer, Optional,
Overwrite, ParticipantProperty, PrimitiveValueTypes::Boolean,
PrimitiveValueTypes::Complex, PrimitiveValueTypes::Integer,
PrimitiveValueTypes::Number, PrimitiveValueTypes::Real, PrimitiveValueTypes::String,
Probability, Problem, PropertySpecificType, ProxyPort, Rate, Rationale, Refine,
Requirement, Satisfy, Stakeholder, TestCase, Trace, TriggerOnNestedPort, ValueType,
VerdictKind, Verify, View, Viewpoint
参考:sysml-specification-1.6书中第四章
文章仅供学习参考使用,勿用做商业或其他违法活动