Skip to content

AutomotiveExamplesForUmple

Kevin Brightwell edited this page Aug 26, 2015 · 1 revision

Syntax and semantics of proposed Umple extensions to accommodate AUTOSAR

Examples of defined types

// Extended primitive type to support custom restriction
// Syntax suggestion 1
class myInt {
  // Keyword type with an Umple primitive 
  type int;
  // Set of constraints
  restriction { min:0, max:10 }
}
// Syntax suggestion 2
primitive constrained0To10 {  // could be extended beyond primitives
  isA int;
  [value >=0] [value <=10]
}
// Usage of above
class X {
  // An attribute that implicitly has the above constraints
  constrained0To10 y;
}

Example of concepts

A concept is a set of methods that can work together

// Proposed syntax 1
class myConcept1 {
  isA autosarType;  // Extend a superconcept
  method operation1 (int arg);
}
// Proposed syntax 2
concept myConcept1 {
  isA autosarType;  // Extend a superconcept
  operation1 (int arg);
}
// Proposed syntax 3
interface myConcept1 {
  concept;
  isA autosarType;  // Extend a superconcept
  operation1 (int arg);
}

Example of data communication event type

Defines a structure that is communicated between ports.

// Example syntax 1
class myComm1 {
  data multiValt d1;
}
// Example syntax 2
class myComm1 {
  isA customEvent;
  multiValt d1;
}
// Example syntax 3
class myComm1 {
  signal;  // implies immutable, no associations (could be 'data', 'pure data', 'event',
  multiValt d1;
}

Example of application structure communication

serviceComp is a implemented component port type in another class

// Example syntax 1
class myApp {
  // Component serviceComp will connect to me though my port 1
  serviceComp -> port1;
  ports {
    // myconcept is my port through which other components can talk to me
    myConcept1 port1;
  }
}
// Example syntax 2
class myApp {
  component;  // means it would be 'active'; capable of communicating using channels
  
  // myconcept is my port through which other components can talk to me
  in port myConcept1 port1;
  // could have in port, out port, in out port
}
// first class channel; could also inline as serviceComp -> port1;
channel ch1 {
   serviceComp -> myApp port1;  
}

Example of flows

// Example syntax 1
class myLatency {
   // There would be a time out if there is excessive delay
   latency {min: 0 sec, max 100 sec}

   // If time out, do something, if exception, do something
   flow { //behaviour } 
}
// Example syntax 2

channel ch1 {
   serviceComp -> myApp port1; 
   [latency > 0 && latency <=100]

   flow { //behaviour } // needs defining in more detail
   
}

Examples of client, and server

class X {
  component; // active object
  client;  // initiates connections
  server;  // receives conn requests and est communications
}
Clone this wiki locally