SlideShare una empresa de Scribd logo
1 de 43
No Magic World Symposium, Allen TX
Ed Seidewitz
Model Driven Solutions, Inc. ● http://www.modeldriven.com
ed-s@modeldriven.com ● @Seidewitz
http://slideshare.net/seidewitz
Copyright © 2018 Ed Seidewitz
Using the Alf Action Language
with Cameo Simulation Toolkit
Part 2 – Modeling
Page 2
About me
Ed Seidewitz
Chief Technology Officier, Model Driven Solutions, Inc.
ed-s@modeldriven.com ● @seidewitz
• 30 years experience as a project manager,
architect, developer and modeler
• Involved with UML since version 0.8
• Developer of fUML and Alf Reference
Implementations and MagicDraw Alf Plugin
• Chair of the OMG fUML and Alf Revision Task
Forces; member of the UML Revision Task Force
Copyright © 2018 Ed Seidewitz
Page 3
Goals
Part 1 – Basics (Sunday)
• Learn the basics of the Alf action language for Executable UML.
• Use the Alf Plugin for MagicDraw.
• Practice using Alf with Cameo Simulation Toolkit.
Part 2 – Modeling (Today)
• Model simulations using the Alf action language.
• Use Alf in class and state machine models in MagicDraw.
• Creating and run simulations using Alf with Cameo Simulation
Toolkit.
Copyright © 2018 Ed Seidewitz
Page 4
Prerequisites (for Part 2)
• Participant
– Basic knowledge of class, activity and state machine modeling
using MagicDraw
– Some experience with model execution using Cameo Simulation
Toolkit
– Introductory understanding of using Alf in CST (e.g., from Part 1 of
this tutorial)
• System (for hands-on exercises)
– MagicDraw 18.5
– Cameo Simulation Toolkit 18.5sp3
– Alf plugin 18.5
Install MagicDraw, CST and Alf Plugin on line or from USB stick
Copyright © 2018 Ed Seidewitz
Page 5
5
Installing the Alf plugin
Copyright © 2018 Ed Seidewitz
Plugin documentation is available at:
https://docs.nomagic.com/display/ALFP185/Alf+plugin
Under Plugins
(commercial),
download / install the
Alf plugin v18.5.
Select Help ► Resource/Plugin
Manager to open the Resource/
Plugin Manager window.
 A new version will be
available for the 19.0
release.
Or click here to install
from USB stick.
Page 6
Class Models
Copyright © 2018 Ed Seidewitz
Page 7
Object creation and property access
Copyright © 2018 Ed Seidewitz
order = new Order();
order.product = aProduct;
order.quantity = aQuantity;
order.amount = aQuantity * aProduct.price;
Create a new Order.
Set the properties
of the new order.
aCustomer.orders->add(order);
totalAmount =
aCustomer.orders.amount->
reduce RealFunctions::'+' ?? 0.0;
Add the new order to
an existing customer.
Navigate associations to
compute total amount.
 A reduce expression “inserts” a binary
function into the elements of a sequence.
 Properties must be public
to be accessible.
A property access
Page 8
Operations and methods
Copyright © 2018 Ed Seidewitz
this.product = product;
this.quantity = quantity;
return this.quantity * this.product.price;
this.orders->add(order);
return this.orders.getAmount()->
reduce RealFunctions::'+' ?? 0.0;
 The behavior that implements an operation
is called its method.
An operation call
Page 9
Operation invocations
Copyright © 2018 Ed Seidewitz
order = new Order(aQuantity, aProduct);
amount = order.getAmount();
aCustomer.addOrder(order);
totalAmount = aCustomer.getTotalAmount();
A constructor can be used to create an
object with initialization.
A constructor operation
has the standard Create
stereotype applied.
 Operation calls are synchronous invocations.
The caller waits until the operation method
execution completes.
Page 10
Hands On
Address Book
Copyright © 2018 Ed Seidewitz
Page 11
Create the Address Book project
Copyright © 2018 Ed Seidewitz
In the Alf folder,
select the Alf
template.
Under Other,
select Project
from Template.
Select File ► New Project to
open the project creation window.
Create an Address
Book project.
Page 12
Create the Address Book class model
Copyright © 2018 Ed Seidewitz
Make sure these Entry
attributes are public.
Give this association
end a multiplicity of *.
Page 13
Are you using SysML?
Copyright © 2018 Ed Seidewitz
 CST and Alf assume the use
of the UML primitive types.
But SysML provides primitive
value types that are different
than the UML primitive types.
Value properties have to
have value types, so String
here is the SysML type.
Remove the ValueProperty
stereotype and change the type to
the UML primitive type.
✗
✗
 This is resolved in v19.0 for
both CST and Alf.
Page 14
Create Address Book and Entry operations
Copyright © 2018 Ed Seidewitz
Create a constructor operation in
the usual way, and then apply
the standard Create stereotype.
Page 15
Create the Entry constructor method
Copyright © 2018 Ed Seidewitz
Right click on the Entry
operation and select
Create Method ►
Behavior to open this
selection window.
Choose either
Activity or
Opaque Behavior.
Enter code in the Alf
editor window to
initialize an Entry.
Page 16
Create Address Book operation methods
Copyright © 2018 Ed Seidewitz
Create methods for
the AddressBook
operations, and then
enter the Alf code
shown for them.
 A select expression is used to filter
a sequence based on a condition.
The index [1] ensures that at most
one value is selected.
 This expression will return either a
single value or null, as required by
the return multiplicity of 0..1.
 The constructor
operation is used when
creating an instance of
the Entry class.
 The braces { } are
required in if statement
clauses in Alf.
Page 17
Test the Address Book model
Copyright © 2018 Ed Seidewitz
Create an
AddressBookTest
activity with the
Alf code below.
 The ?? (null-coalescing) operator is
used here because get has return
multiplicity 0..1 and the + operator
requires argument multiplicity 1..1.
Run the activity
and see if it works!
Page 18
State Machine Models
Copyright © 2018 Ed Seidewitz
Page 19
Classifier behaviors
Copyright © 2018 Ed Seidewitz
A signal reception declares
the ability of instances of a
class to handle a signal.
A state machine can be
attached to a class as a
classifier behavior.
The state machine reacts to
signals that are sent to
instances of its context class.
Page 20
Transition and state behaviors
Copyright © 2018 Ed Seidewitz
Alf can be used to define
transition and state behaviors
in state machines.
Page 21
Signal sending
Copyright © 2018 Ed Seidewitz
fan = new Fan();
fan.TurnOn();
fan.TurnOff();
A signal send has a similar syntax to
operation calls, but referencing a
signal reception, rather than an
operation.
The state machine starts running
when an object is created.
 A signal can only be sent using Alf
to an object whose class has a
reception declared for the signal.
 Signal sends are asynchronous
invocations. The sender continues
immediately after the signal is sent.
Page 22
Hands On
Heating Simulation
Copyright © 2018 Ed Seidewitz
Page 23
Create the Heating Simulation project
Copyright © 2018 Ed Seidewitz
In the Alf folder,
select the Alf
template.
Under Other,
select Project
from Template.
Select File ► New Project to
open the project creation window.
Create a Heating
Simulation project.
Page 24
Create the model package structure
Copyright © 2018 Ed Seidewitz
Page 25
Create Environment and House classes
Copyright © 2018 Ed Seidewitz
Create three signals...
…and use them to declare
signal receptions.
Make this attribute
public.
Make this association
composite.
Make this operation
private.
Give both association
ends names.
Page 26
Create the Environment state machine
Copyright © 2018 Ed Seidewitz
Page 27
Add triggers to transitions
Copyright © 2018 Ed Seidewitz
Page 28
Create opaque behavior
Copyright © 2018 Ed Seidewitz
Under Effect, set the
Behavior Type to
Opaque Behavior.
Page 29
Add Alf code
Copyright © 2018 Ed Seidewitz
 A signal is sent by invoking the
signal reception on the target
object.
Click on the transition to enter
code for its effect behavior in
the Alf editor window.
Create an opaque
behavior and add Alf code
for this transition, too.
Page 30
Create the House state machine
Copyright © 2018 Ed Seidewitz
Page 31
Create the cool method
Copyright © 2018 Ed Seidewitz
Right click on the cool operation
and select Create Method ►
Behavior to open the Behavior
selection window.
Enter the Alf code in
the Alf editor window.
Choose either
Activity or
Opaque Behavior.
 The braces { } are
required in if statement
clauses in Alf.
Page 32
Coming in v19.0!
Copyright © 2018 Ed Seidewitz
Access event data
in transition and
state behaviors.
Page 33
Create an instance model
Copyright © 2018 Ed Seidewitz
Add a link for the Environment-
House composite association.
Be sure to create
slots for both ends.
Right click on the
Environment instance and
select Simulation ► Run
to execute the model.
Page 34
Add a Heater class
Copyright © 2018 Ed Seidewitz
Add new signals.
Add new reception.
Add new operation.
Make this
attribute public.
Make this
association
composite.
Add new attribute.
Page 35
Update the House state machine
Copyright © 2018 Ed Seidewitz
Add a new transition
triggered by the Heat
signal with Alf code to
call the heat operation.
Create a method behavior
for the heat operation.
Page 36
Create the Heater state machine
Copyright © 2018 Ed Seidewitz
Page 37
Update the instance model
Copyright © 2018 Ed Seidewitz
Add a Heater instance and
a link of the House-Heater
composite association.
Right click on the
Environment instance and
select Simulation ► Run
to execute the model again.
Page 38
Add a Thermostat class
Copyright © 2018 Ed Seidewitz
Make this
association
composite.
Add a new attribute.
This
association is
not composite.
Page 39
Update the Heater state machine
Copyright © 2018 Ed Seidewitz
Use the isOn attribute
to record which state
the Heater is in.
 There is no built-in way in
Alf to determine what state
a state machine is in.
Page 40
Create the monitor method
Copyright © 2018 Ed Seidewitz
Page 41
Are you using SysML?
Copyright © 2018 Ed Seidewitz
Alf currently cannot be
used to send a signal
via a specified port.
 To be resolved through
further integration of
Alf with composite
structure semantics.
Page 42
Update the House state machine
Copyright © 2018 Ed Seidewitz
Double click on the running
state (as a whole) to open
its specification window.
Under Entry, set the
Behavior Type to
Opaque Behavior.
Click on just the entry behavior
line and enter code in the Alf
editor window.
Page 43
Update the instance model
Copyright © 2018 Ed Seidewitz
Add a Thermostat instance
and links to the House and
Heater instances.
Right click on the
Environment instance and
select Simulation ► Run
to execute the model again.

Más contenido relacionado

La actualidad más candente

IFML - Interaction Flow Modeling Language - tutorial on UI and UX modeling &...
IFML -  Interaction Flow Modeling Language - tutorial on UI and UX modeling &...IFML -  Interaction Flow Modeling Language - tutorial on UI and UX modeling &...
IFML - Interaction Flow Modeling Language - tutorial on UI and UX modeling &...Marco Brambilla
 
[ Capella Day 2019 ] Model-based safety analysis on Capella using Component F...
[ Capella Day 2019 ] Model-based safety analysis on Capella using Component F...[ Capella Day 2019 ] Model-based safety analysis on Capella using Component F...
[ Capella Day 2019 ] Model-based safety analysis on Capella using Component F...Obeo
 
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...Edureka!
 
Introduction to React Native - Nader Dabit
Introduction to React Native - Nader DabitIntroduction to React Native - Nader Dabit
Introduction to React Native - Nader DabitAmazon Web Services
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - CoreDzmitry Naskou
 
Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.Yaroslav Pernerovsky
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Previewvaluebound
 
SpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSunghyouk Bae
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooksMaulik Shah
 
Dotnet Frameworks Version History
Dotnet Frameworks Version HistoryDotnet Frameworks Version History
Dotnet Frameworks Version Historyvoltaincx
 
User guide C++ Protookit, Creotoolkit project setup vs2010
User guide C++ Protookit, Creotoolkit project setup vs2010User guide C++ Protookit, Creotoolkit project setup vs2010
User guide C++ Protookit, Creotoolkit project setup vs2010sureshyalagudri01
 
SysML v2 and the Next Generation of Modeling Languages
SysML v2 and the Next Generation of Modeling LanguagesSysML v2 and the Next Generation of Modeling Languages
SysML v2 and the Next Generation of Modeling LanguagesEd Seidewitz
 
Adobe Experience Manager Core Components
Adobe Experience Manager Core ComponentsAdobe Experience Manager Core Components
Adobe Experience Manager Core ComponentsGabriel Walt
 

La actualidad más candente (20)

IFML - Interaction Flow Modeling Language - tutorial on UI and UX modeling &...
IFML -  Interaction Flow Modeling Language - tutorial on UI and UX modeling &...IFML -  Interaction Flow Modeling Language - tutorial on UI and UX modeling &...
IFML - Interaction Flow Modeling Language - tutorial on UI and UX modeling &...
 
[ Capella Day 2019 ] Model-based safety analysis on Capella using Component F...
[ Capella Day 2019 ] Model-based safety analysis on Capella using Component F...[ Capella Day 2019 ] Model-based safety analysis on Capella using Component F...
[ Capella Day 2019 ] Model-based safety analysis on Capella using Component F...
 
JSX
JSXJSX
JSX
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
 
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginne...
 
Introduction to React Native - Nader Dabit
Introduction to React Native - Nader DabitIntroduction to React Native - Nader Dabit
Introduction to React Native - Nader Dabit
 
React native
React nativeReact native
React native
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
React native
React nativeReact native
React native
 
Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
Netbeans IDE & Platform
Netbeans IDE & PlatformNetbeans IDE & Platform
Netbeans IDE & Platform
 
SpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSL
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
 
Dotnet Frameworks Version History
Dotnet Frameworks Version HistoryDotnet Frameworks Version History
Dotnet Frameworks Version History
 
User guide C++ Protookit, Creotoolkit project setup vs2010
User guide C++ Protookit, Creotoolkit project setup vs2010User guide C++ Protookit, Creotoolkit project setup vs2010
User guide C++ Protookit, Creotoolkit project setup vs2010
 
SysML v2 and the Next Generation of Modeling Languages
SysML v2 and the Next Generation of Modeling LanguagesSysML v2 and the Next Generation of Modeling Languages
SysML v2 and the Next Generation of Modeling Languages
 
Selenium cheat sheet
Selenium cheat sheetSelenium cheat sheet
Selenium cheat sheet
 
React js
React jsReact js
React js
 
Adobe Experience Manager Core Components
Adobe Experience Manager Core ComponentsAdobe Experience Manager Core Components
Adobe Experience Manager Core Components
 

Similar a Using Alf with Cameo Simulation Toolkit - Part 2: Modeling

Chapter 08
Chapter 08Chapter 08
Chapter 08llmeade
 
Alfresco - You probably didn't know that
Alfresco - You probably didn't know thatAlfresco - You probably didn't know that
Alfresco - You probably didn't know thatDavid Ciamberlano
 
Diving into VS 2015 Day4
Diving into VS 2015 Day4Diving into VS 2015 Day4
Diving into VS 2015 Day4Akhil Mittal
 
MoodLocator HwT
MoodLocator HwTMoodLocator HwT
MoodLocator HwTJDihlmann
 
Inteligencia artificial, open source e IBM Call for Code
Inteligencia artificial, open source e IBM Call for CodeInteligencia artificial, open source e IBM Call for Code
Inteligencia artificial, open source e IBM Call for CodeLuciano Resende
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfoliomwillmer
 
Functional programming in Java
Functional programming in Java  Functional programming in Java
Functional programming in Java Haim Michael
 
Diving into VS 2015 Day3
Diving into VS 2015 Day3Diving into VS 2015 Day3
Diving into VS 2015 Day3Akhil Mittal
 
Day1 Lab1
Day1 Lab1Day1 Lab1
Day1 Lab1Ron Liu
 
Rethink Frontend Development With Elm
Rethink Frontend Development With ElmRethink Frontend Development With Elm
Rethink Frontend Development With ElmBrian Hogan
 
How to Use Sim CFD (to your advantage): A Primer for Computational Fluid Dyna...
How to Use Sim CFD (to your advantage): A Primer for Computational Fluid Dyna...How to Use Sim CFD (to your advantage): A Primer for Computational Fluid Dyna...
How to Use Sim CFD (to your advantage): A Primer for Computational Fluid Dyna...Synergis Engineering Design Solutions
 
Application Frameworks an Experience Report
Application Frameworks an Experience ReportApplication Frameworks an Experience Report
Application Frameworks an Experience ReportESUG
 
Use of Classes and functions#include iostreamusing name.docx
 Use of Classes and functions#include iostreamusing name.docx Use of Classes and functions#include iostreamusing name.docx
Use of Classes and functions#include iostreamusing name.docxaryan532920
 
Standards-Based Executable UML: Today's Reality and Tomorrow's Promise
Standards-Based Executable UML: Today's Reality and Tomorrow's PromiseStandards-Based Executable UML: Today's Reality and Tomorrow's Promise
Standards-Based Executable UML: Today's Reality and Tomorrow's PromiseEd Seidewitz
 

Similar a Using Alf with Cameo Simulation Toolkit - Part 2: Modeling (20)

Chapter 08
Chapter 08Chapter 08
Chapter 08
 
Simulation using model sim
Simulation using model simSimulation using model sim
Simulation using model sim
 
Alfresco - You probably didn't know that
Alfresco - You probably didn't know thatAlfresco - You probably didn't know that
Alfresco - You probably didn't know that
 
Diving into VS 2015 Day4
Diving into VS 2015 Day4Diving into VS 2015 Day4
Diving into VS 2015 Day4
 
MoodLocator HwT
MoodLocator HwTMoodLocator HwT
MoodLocator HwT
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Inteligencia artificial, open source e IBM Call for Code
Inteligencia artificial, open source e IBM Call for CodeInteligencia artificial, open source e IBM Call for Code
Inteligencia artificial, open source e IBM Call for Code
 
UCD components
UCD components UCD components
UCD components
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
Functional programming in Java
Functional programming in Java  Functional programming in Java
Functional programming in Java
 
Diving into VS 2015 Day3
Diving into VS 2015 Day3Diving into VS 2015 Day3
Diving into VS 2015 Day3
 
Day1 Lab1
Day1 Lab1Day1 Lab1
Day1 Lab1
 
Create New Android Activity
Create New Android ActivityCreate New Android Activity
Create New Android Activity
 
Rethink Frontend Development With Elm
Rethink Frontend Development With ElmRethink Frontend Development With Elm
Rethink Frontend Development With Elm
 
How to Use Sim CFD (to your advantage): A Primer for Computational Fluid Dyna...
How to Use Sim CFD (to your advantage): A Primer for Computational Fluid Dyna...How to Use Sim CFD (to your advantage): A Primer for Computational Fluid Dyna...
How to Use Sim CFD (to your advantage): A Primer for Computational Fluid Dyna...
 
Application Frameworks an Experience Report
Application Frameworks an Experience ReportApplication Frameworks an Experience Report
Application Frameworks an Experience Report
 
Use of Classes and functions#include iostreamusing name.docx
 Use of Classes and functions#include iostreamusing name.docx Use of Classes and functions#include iostreamusing name.docx
Use of Classes and functions#include iostreamusing name.docx
 
Standards-Based Executable UML: Today's Reality and Tomorrow's Promise
Standards-Based Executable UML: Today's Reality and Tomorrow's PromiseStandards-Based Executable UML: Today's Reality and Tomorrow's Promise
Standards-Based Executable UML: Today's Reality and Tomorrow's Promise
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 

Más de Ed Seidewitz

SysML v2 - What's the big deal, anyway?
SysML v2 - What's the big deal, anyway?SysML v2 - What's the big deal, anyway?
SysML v2 - What's the big deal, anyway?Ed Seidewitz
 
Introduction to the OMG Systems Modeling Language (SysML), Version 2
Introduction to the OMG Systems Modeling Language (SysML), Version 2Introduction to the OMG Systems Modeling Language (SysML), Version 2
Introduction to the OMG Systems Modeling Language (SysML), Version 2Ed Seidewitz
 
The Very Model of a Modern Metamodeler
The Very Model of a Modern MetamodelerThe Very Model of a Modern Metamodeler
The Very Model of a Modern MetamodelerEd Seidewitz
 
SysML v2 and MBSE: The next ten years
SysML v2 and MBSE: The next ten yearsSysML v2 and MBSE: The next ten years
SysML v2 and MBSE: The next ten yearsEd Seidewitz
 
Precise Semantics Standards at OMG: Executing on the Vision
Precise Semantics Standards at OMG: Executing on the VisionPrecise Semantics Standards at OMG: Executing on the Vision
Precise Semantics Standards at OMG: Executing on the VisionEd Seidewitz
 
Model Driven Architecture without Automation
Model Driven Architecture without AutomationModel Driven Architecture without Automation
Model Driven Architecture without AutomationEd Seidewitz
 
UML: This Time We Mean It!
UML: This Time We Mean It!UML: This Time We Mean It!
UML: This Time We Mean It!Ed Seidewitz
 
A Unified View of Modeling and Programming
A Unified View of Modeling and ProgrammingA Unified View of Modeling and Programming
A Unified View of Modeling and ProgrammingEd Seidewitz
 
UML as a Programming Language
UML as a Programming LanguageUML as a Programming Language
UML as a Programming LanguageEd Seidewitz
 
Executable UML Roadmap (as of September 2014)
Executable UML Roadmap (as of September 2014)Executable UML Roadmap (as of September 2014)
Executable UML Roadmap (as of September 2014)Ed Seidewitz
 
Essence: A Common Ground for Flexible Methods
Essence: A Common Ground for Flexible MethodsEssence: A Common Ground for Flexible Methods
Essence: A Common Ground for Flexible MethodsEd Seidewitz
 
UML: Once More with Meaning
UML: Once More with MeaningUML: Once More with Meaning
UML: Once More with MeaningEd Seidewitz
 
Succeeding with Agile in the Federal Government: A Coach's Perspective
Succeeding with Agile in the Federal Government: A Coach's PerspectiveSucceeding with Agile in the Federal Government: A Coach's Perspective
Succeeding with Agile in the Federal Government: A Coach's PerspectiveEd Seidewitz
 
UML 2.5: Specification Simplification
UML 2.5: Specification SimplificationUML 2.5: Specification Simplification
UML 2.5: Specification SimplificationEd Seidewitz
 
Models, Programs and Executable UML
Models, Programs and Executable UMLModels, Programs and Executable UML
Models, Programs and Executable UMLEd Seidewitz
 
Architecting Your Enterprise
Architecting Your EnterpriseArchitecting Your Enterprise
Architecting Your EnterpriseEd Seidewitz
 
Programming in UML: Why and How
Programming in UML: Why and HowProgramming in UML: Why and How
Programming in UML: Why and HowEd Seidewitz
 

Más de Ed Seidewitz (17)

SysML v2 - What's the big deal, anyway?
SysML v2 - What's the big deal, anyway?SysML v2 - What's the big deal, anyway?
SysML v2 - What's the big deal, anyway?
 
Introduction to the OMG Systems Modeling Language (SysML), Version 2
Introduction to the OMG Systems Modeling Language (SysML), Version 2Introduction to the OMG Systems Modeling Language (SysML), Version 2
Introduction to the OMG Systems Modeling Language (SysML), Version 2
 
The Very Model of a Modern Metamodeler
The Very Model of a Modern MetamodelerThe Very Model of a Modern Metamodeler
The Very Model of a Modern Metamodeler
 
SysML v2 and MBSE: The next ten years
SysML v2 and MBSE: The next ten yearsSysML v2 and MBSE: The next ten years
SysML v2 and MBSE: The next ten years
 
Precise Semantics Standards at OMG: Executing on the Vision
Precise Semantics Standards at OMG: Executing on the VisionPrecise Semantics Standards at OMG: Executing on the Vision
Precise Semantics Standards at OMG: Executing on the Vision
 
Model Driven Architecture without Automation
Model Driven Architecture without AutomationModel Driven Architecture without Automation
Model Driven Architecture without Automation
 
UML: This Time We Mean It!
UML: This Time We Mean It!UML: This Time We Mean It!
UML: This Time We Mean It!
 
A Unified View of Modeling and Programming
A Unified View of Modeling and ProgrammingA Unified View of Modeling and Programming
A Unified View of Modeling and Programming
 
UML as a Programming Language
UML as a Programming LanguageUML as a Programming Language
UML as a Programming Language
 
Executable UML Roadmap (as of September 2014)
Executable UML Roadmap (as of September 2014)Executable UML Roadmap (as of September 2014)
Executable UML Roadmap (as of September 2014)
 
Essence: A Common Ground for Flexible Methods
Essence: A Common Ground for Flexible MethodsEssence: A Common Ground for Flexible Methods
Essence: A Common Ground for Flexible Methods
 
UML: Once More with Meaning
UML: Once More with MeaningUML: Once More with Meaning
UML: Once More with Meaning
 
Succeeding with Agile in the Federal Government: A Coach's Perspective
Succeeding with Agile in the Federal Government: A Coach's PerspectiveSucceeding with Agile in the Federal Government: A Coach's Perspective
Succeeding with Agile in the Federal Government: A Coach's Perspective
 
UML 2.5: Specification Simplification
UML 2.5: Specification SimplificationUML 2.5: Specification Simplification
UML 2.5: Specification Simplification
 
Models, Programs and Executable UML
Models, Programs and Executable UMLModels, Programs and Executable UML
Models, Programs and Executable UML
 
Architecting Your Enterprise
Architecting Your EnterpriseArchitecting Your Enterprise
Architecting Your Enterprise
 
Programming in UML: Why and How
Programming in UML: Why and HowProgramming in UML: Why and How
Programming in UML: Why and How
 

Último

WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 

Último (20)

WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 

Using Alf with Cameo Simulation Toolkit - Part 2: Modeling

  • 1. No Magic World Symposium, Allen TX Ed Seidewitz Model Driven Solutions, Inc. ● http://www.modeldriven.com ed-s@modeldriven.com ● @Seidewitz http://slideshare.net/seidewitz Copyright © 2018 Ed Seidewitz Using the Alf Action Language with Cameo Simulation Toolkit Part 2 – Modeling
  • 2. Page 2 About me Ed Seidewitz Chief Technology Officier, Model Driven Solutions, Inc. ed-s@modeldriven.com ● @seidewitz • 30 years experience as a project manager, architect, developer and modeler • Involved with UML since version 0.8 • Developer of fUML and Alf Reference Implementations and MagicDraw Alf Plugin • Chair of the OMG fUML and Alf Revision Task Forces; member of the UML Revision Task Force Copyright © 2018 Ed Seidewitz
  • 3. Page 3 Goals Part 1 – Basics (Sunday) • Learn the basics of the Alf action language for Executable UML. • Use the Alf Plugin for MagicDraw. • Practice using Alf with Cameo Simulation Toolkit. Part 2 – Modeling (Today) • Model simulations using the Alf action language. • Use Alf in class and state machine models in MagicDraw. • Creating and run simulations using Alf with Cameo Simulation Toolkit. Copyright © 2018 Ed Seidewitz
  • 4. Page 4 Prerequisites (for Part 2) • Participant – Basic knowledge of class, activity and state machine modeling using MagicDraw – Some experience with model execution using Cameo Simulation Toolkit – Introductory understanding of using Alf in CST (e.g., from Part 1 of this tutorial) • System (for hands-on exercises) – MagicDraw 18.5 – Cameo Simulation Toolkit 18.5sp3 – Alf plugin 18.5 Install MagicDraw, CST and Alf Plugin on line or from USB stick Copyright © 2018 Ed Seidewitz
  • 5. Page 5 5 Installing the Alf plugin Copyright © 2018 Ed Seidewitz Plugin documentation is available at: https://docs.nomagic.com/display/ALFP185/Alf+plugin Under Plugins (commercial), download / install the Alf plugin v18.5. Select Help ► Resource/Plugin Manager to open the Resource/ Plugin Manager window.  A new version will be available for the 19.0 release. Or click here to install from USB stick.
  • 6. Page 6 Class Models Copyright © 2018 Ed Seidewitz
  • 7. Page 7 Object creation and property access Copyright © 2018 Ed Seidewitz order = new Order(); order.product = aProduct; order.quantity = aQuantity; order.amount = aQuantity * aProduct.price; Create a new Order. Set the properties of the new order. aCustomer.orders->add(order); totalAmount = aCustomer.orders.amount-> reduce RealFunctions::'+' ?? 0.0; Add the new order to an existing customer. Navigate associations to compute total amount.  A reduce expression “inserts” a binary function into the elements of a sequence.  Properties must be public to be accessible. A property access
  • 8. Page 8 Operations and methods Copyright © 2018 Ed Seidewitz this.product = product; this.quantity = quantity; return this.quantity * this.product.price; this.orders->add(order); return this.orders.getAmount()-> reduce RealFunctions::'+' ?? 0.0;  The behavior that implements an operation is called its method. An operation call
  • 9. Page 9 Operation invocations Copyright © 2018 Ed Seidewitz order = new Order(aQuantity, aProduct); amount = order.getAmount(); aCustomer.addOrder(order); totalAmount = aCustomer.getTotalAmount(); A constructor can be used to create an object with initialization. A constructor operation has the standard Create stereotype applied.  Operation calls are synchronous invocations. The caller waits until the operation method execution completes.
  • 10. Page 10 Hands On Address Book Copyright © 2018 Ed Seidewitz
  • 11. Page 11 Create the Address Book project Copyright © 2018 Ed Seidewitz In the Alf folder, select the Alf template. Under Other, select Project from Template. Select File ► New Project to open the project creation window. Create an Address Book project.
  • 12. Page 12 Create the Address Book class model Copyright © 2018 Ed Seidewitz Make sure these Entry attributes are public. Give this association end a multiplicity of *.
  • 13. Page 13 Are you using SysML? Copyright © 2018 Ed Seidewitz  CST and Alf assume the use of the UML primitive types. But SysML provides primitive value types that are different than the UML primitive types. Value properties have to have value types, so String here is the SysML type. Remove the ValueProperty stereotype and change the type to the UML primitive type. ✗ ✗  This is resolved in v19.0 for both CST and Alf.
  • 14. Page 14 Create Address Book and Entry operations Copyright © 2018 Ed Seidewitz Create a constructor operation in the usual way, and then apply the standard Create stereotype.
  • 15. Page 15 Create the Entry constructor method Copyright © 2018 Ed Seidewitz Right click on the Entry operation and select Create Method ► Behavior to open this selection window. Choose either Activity or Opaque Behavior. Enter code in the Alf editor window to initialize an Entry.
  • 16. Page 16 Create Address Book operation methods Copyright © 2018 Ed Seidewitz Create methods for the AddressBook operations, and then enter the Alf code shown for them.  A select expression is used to filter a sequence based on a condition. The index [1] ensures that at most one value is selected.  This expression will return either a single value or null, as required by the return multiplicity of 0..1.  The constructor operation is used when creating an instance of the Entry class.  The braces { } are required in if statement clauses in Alf.
  • 17. Page 17 Test the Address Book model Copyright © 2018 Ed Seidewitz Create an AddressBookTest activity with the Alf code below.  The ?? (null-coalescing) operator is used here because get has return multiplicity 0..1 and the + operator requires argument multiplicity 1..1. Run the activity and see if it works!
  • 18. Page 18 State Machine Models Copyright © 2018 Ed Seidewitz
  • 19. Page 19 Classifier behaviors Copyright © 2018 Ed Seidewitz A signal reception declares the ability of instances of a class to handle a signal. A state machine can be attached to a class as a classifier behavior. The state machine reacts to signals that are sent to instances of its context class.
  • 20. Page 20 Transition and state behaviors Copyright © 2018 Ed Seidewitz Alf can be used to define transition and state behaviors in state machines.
  • 21. Page 21 Signal sending Copyright © 2018 Ed Seidewitz fan = new Fan(); fan.TurnOn(); fan.TurnOff(); A signal send has a similar syntax to operation calls, but referencing a signal reception, rather than an operation. The state machine starts running when an object is created.  A signal can only be sent using Alf to an object whose class has a reception declared for the signal.  Signal sends are asynchronous invocations. The sender continues immediately after the signal is sent.
  • 22. Page 22 Hands On Heating Simulation Copyright © 2018 Ed Seidewitz
  • 23. Page 23 Create the Heating Simulation project Copyright © 2018 Ed Seidewitz In the Alf folder, select the Alf template. Under Other, select Project from Template. Select File ► New Project to open the project creation window. Create a Heating Simulation project.
  • 24. Page 24 Create the model package structure Copyright © 2018 Ed Seidewitz
  • 25. Page 25 Create Environment and House classes Copyright © 2018 Ed Seidewitz Create three signals... …and use them to declare signal receptions. Make this attribute public. Make this association composite. Make this operation private. Give both association ends names.
  • 26. Page 26 Create the Environment state machine Copyright © 2018 Ed Seidewitz
  • 27. Page 27 Add triggers to transitions Copyright © 2018 Ed Seidewitz
  • 28. Page 28 Create opaque behavior Copyright © 2018 Ed Seidewitz Under Effect, set the Behavior Type to Opaque Behavior.
  • 29. Page 29 Add Alf code Copyright © 2018 Ed Seidewitz  A signal is sent by invoking the signal reception on the target object. Click on the transition to enter code for its effect behavior in the Alf editor window. Create an opaque behavior and add Alf code for this transition, too.
  • 30. Page 30 Create the House state machine Copyright © 2018 Ed Seidewitz
  • 31. Page 31 Create the cool method Copyright © 2018 Ed Seidewitz Right click on the cool operation and select Create Method ► Behavior to open the Behavior selection window. Enter the Alf code in the Alf editor window. Choose either Activity or Opaque Behavior.  The braces { } are required in if statement clauses in Alf.
  • 32. Page 32 Coming in v19.0! Copyright © 2018 Ed Seidewitz Access event data in transition and state behaviors.
  • 33. Page 33 Create an instance model Copyright © 2018 Ed Seidewitz Add a link for the Environment- House composite association. Be sure to create slots for both ends. Right click on the Environment instance and select Simulation ► Run to execute the model.
  • 34. Page 34 Add a Heater class Copyright © 2018 Ed Seidewitz Add new signals. Add new reception. Add new operation. Make this attribute public. Make this association composite. Add new attribute.
  • 35. Page 35 Update the House state machine Copyright © 2018 Ed Seidewitz Add a new transition triggered by the Heat signal with Alf code to call the heat operation. Create a method behavior for the heat operation.
  • 36. Page 36 Create the Heater state machine Copyright © 2018 Ed Seidewitz
  • 37. Page 37 Update the instance model Copyright © 2018 Ed Seidewitz Add a Heater instance and a link of the House-Heater composite association. Right click on the Environment instance and select Simulation ► Run to execute the model again.
  • 38. Page 38 Add a Thermostat class Copyright © 2018 Ed Seidewitz Make this association composite. Add a new attribute. This association is not composite.
  • 39. Page 39 Update the Heater state machine Copyright © 2018 Ed Seidewitz Use the isOn attribute to record which state the Heater is in.  There is no built-in way in Alf to determine what state a state machine is in.
  • 40. Page 40 Create the monitor method Copyright © 2018 Ed Seidewitz
  • 41. Page 41 Are you using SysML? Copyright © 2018 Ed Seidewitz Alf currently cannot be used to send a signal via a specified port.  To be resolved through further integration of Alf with composite structure semantics.
  • 42. Page 42 Update the House state machine Copyright © 2018 Ed Seidewitz Double click on the running state (as a whole) to open its specification window. Under Entry, set the Behavior Type to Opaque Behavior. Click on just the entry behavior line and enter code in the Alf editor window.
  • 43. Page 43 Update the instance model Copyright © 2018 Ed Seidewitz Add a Thermostat instance and links to the House and Heater instances. Right click on the Environment instance and select Simulation ► Run to execute the model again.

Notas del editor

  1. 5