Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Next »

SCCharts

Each SCChart starts with the keyword scchart followed by an IDA ID can be any alpha-numerical combination, but must start with an alphabetical character or an underscore (a single underscore is prohibited). However, underscores are used to identify auto-generated constructs, so the modeler should not use them as prefix.

Simple States

One of the basic constructs of SCCharts is a simple state. A simple state does not have any inner behavior and can be connected via transitions to other states.

Initial State

To tell the program where to start, a state can be marked as initial. Exactly one state (per concurrent region, see concurrency) must be marked as initial.

Transitions

Transitions connect states. There are different kinds of Transitions, but we will restrict ourselves to the two basic types for now. (See below for more complex transitions.)

Delayed Transitions

Immediate Transitions

Explicit Delay Behavior

Final State

A state can also be marked as final. A final state marks the end of a thread. If a final state is reached on root level, the program terminates.

scchart Simple {
	
  initial state A
  go to B 
  
  state B
  go to C 
  
  state C
  go to A immediate
}
scchart Simple {
	
  initial state A
  go to B auto
  
  state B
  go to C delayed
  
  final state C
}

Comments

You can simply use JavaDoc-style comments to comment you SCChart. The comments will appear in the synthesized diagram as comment boxes. You can toggle these boxes in your sidebar. 

Additionally, for documentation reason, you can annotate different elements to give them a user-defined style. E.g. colorize a state or comment box for visual effect. Use html-like color codes for different colors. Please read more on annotations in the section below.

/**
 * Getting there!
 */
scchart Root {
  /** Test */
  input bool second 
  output bool speaker 

  /**
    * Main region!
    */
  region main:

  /**	
    * The initial state
    * This is entered as soon as the program starts.
    */    
  @foreground f0f024
  @background ffffcc
  @backgroundTarget fff9ba
  initial state Superstate {
    initial state R1
  } 
  /** Transition */
  /** Transition 2 */
  join to S

  /**
    * The final state!
    * @foreground f00
    * @background a00
    */
  final state S
}

Declarations & Variables

Types

Arrays

Constants


Tuples

You can assign a whole vector at once to an array. 

scchart tuples {
  output int arr[5] = {1, 2, 3, 4, 5}

  initial state init {
    entry do arr = {6, 7, 8, 9, 10}
  }
}

To assign only certain values of an array, you can also use the ignore value placeholder. Consult the expression manual for further information.

scchart tuples {
  const int A = 1
  output int arr[3][2] = {{A,0}, {2,0}, {3,0}}

  initial state init
    --> init do arr = {{arr[0] + 1, _}, _, {arr[2] + 1, _}}
}

This would, for example, result in c code assignments as displayed on the right.

void logic(TickData* d) {
  d->_g0 = d->_GO;
  if (d->_g0) {
    d->arr[0][0] = 1;
    d->arr[0][1] = 0;
    d->arr[1][0] = 2;
    d->arr[1][1] = 0;
    d->arr[2][0] = 3;
    d->arr[2][1] = 0;
  }
  d->_g2 = d->_pg1;
  if (d->_g2) {
    d->arr[0][0] = d->arr[0] + 1;
    d->arr[2][0] = d->arr[2] + 1;
  }
  d->_g1 = d->_g0 || d->_g2;
}

Trigger & Effects

hey can be guarded by a trigger that determines when this transition is enabled and they can have effects that are executed whenever this transition becomes active.



Hierarchy & Concurrency

Superstates

Regions



For Regions

You can automatically duplicate regions and access a region counter variable.

scchart IIIRO {
  input int I
  input bool R
  output bool O

  initial state IIO {
    entry do O = false

    initial state II {
      region main for i : 1 .. 3 {
        initial state IWait
        go to IDone if I == i
	
        final state IDone
      }
    }
    join to Done do O = true
		
    state Done
  }
  go to IIO if R
}

This is also possible for a complete array.

scchart IIIRO {
  input int I
  input bool R
  output bool O
  input bool ACTIVE[10]

  initial state IIO {
    entry do O = false

    initial state II {
      region for i : ACTIVE {
        initial state IWait
        go to IDone if ACTIVE[i]
	
        final state IDone
      }
    }
    join to Done do O = true
	
    state Done
  }
  go to IIO if R
}


Actions

Entry Action

During Action

Exit Action


Complex Transitions

Count Delay

Shallow History

Deep History

Deferred


Signals

References

Hostcode

Annotations

Pragmas

Expressions


Overview

Here you can see an SCCharts graphical notation overview.



  • No labels