modhelxs.mocs.tfsm
Class TFSMMoC

java.lang.Object
  extended by modhelxs.abstractsemantics.NamedEntity
      extended by modhelxs.abstractsemantics.ModelOfComputation<T>
          extended by modhelxs.abstractsemantics.ModelOfComputationImpl<java.lang.Double>
              extended by modhelxs.mocs.tfsm.TFSMMoC
All Implemented Interfaces:
ModelOfComputation, NamedEntity

public class TFSMMoC
extends ModelOfComputationImpl<java.lang.Double>

Author:
boulange

Field Summary
protected  java.lang.Double current_time_
          The current TFSM time.
protected  Block currentState_
           
protected  Engine exec_engine_
           
private  boolean firstUpdate
           
protected  Block initialState_
           
private  java.lang.String label_of_next_transition_
           
private  double next_time_of_update_
           
protected  Model<java.lang.Double> state_machine_
           
protected  Clock<java.lang.Double> tfsm_clock_
          The observation request clock of this MoC.
protected  java.util.List<java.lang.String> tfsmActions_
           
protected  java.util.List<java.lang.String> tfsmEvents_
           
protected  java.lang.Double timeOfEntry_
           
 
Constructor Summary
TFSMMoC(java.lang.String name)
           
 
Method Summary
 boolean canGoFurther(BlockStructure s)
          Tell if it is possible to compute more information.
private  void computeCurrentTime()
          Compute the current time by looking at the tag of the first tagged event on the tfsm clock.
private static
<T extends java.lang.Comparable<? super T>>
java.lang.Double
directTagConversion(TagRelation<T,java.lang.Double> rel)
           
 void emitObservationRequests(BlockStructure s)
          Place ticks on clocks to request to be observed in future snapshots.
 void endOfSnapshot(BlockStructure s)
          End of the snapshot => update internal state, produce outputs.
 void endOfUpdate(BlockStructure s)
          Called at the end of an update of an inner block (produce partial outputs for the upper model).
 Clock<java.lang.Double> getClock()
          Get the observation clock of this MoC.
 Block getCurrentState()
           
 java.lang.Double getCurrentTime()
          Get the current time in this MoC.
 Relation getFiringTransition(BlockStructure s)
           
private  void getIncommingEvents(BlockStructure s)
           
 java.util.List<java.lang.String> getTfsmEvents()
           
 void propagate(BlockStructure s)
          Propagate new information produced by the update of a block.
 void reset(BlockStructure s)
          Reset for a new computation of the current snapshot (called at least once at the beginning of the snapshot).
private static
<T extends java.lang.Comparable<? super T>>
java.lang.Double
reverseTagConversion(TagRelation<java.lang.Double,T> rel)
           
 void schedule(BlockStructure s)
          Choose a block to be updated.
 void setCurrentState(Block b)
           
 FSMState setInitialState(FSMState init)
           
 void setup(BlockStructure s)
          Setup for simulation.
 void startOfUpdate(BlockStructure s)
          Called at the beginning of an update of an inner block (get partial inputs from the upper model).
 void update(BlockStructure s)
          Update a block.
 
Methods inherited from class modhelxs.abstractsemantics.ModelOfComputationImpl
createToken, duplicateToken, getTokenValue, prep, setTokenValue, startOfSnapshot, validate, wrapup
 
Methods inherited from class modhelxs.abstractsemantics.NamedEntity
getName, getProperties, getProperty, hasProperty, removeProperty, setName, setProperties, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface modhelxs.ecore.NamedEntity
getName, getProperties, setName
 

Field Detail

tfsm_clock_

protected Clock<java.lang.Double> tfsm_clock_
The observation request clock of this MoC.


current_time_

protected java.lang.Double current_time_
The current TFSM time.


state_machine_

protected Model<java.lang.Double> state_machine_

exec_engine_

protected Engine exec_engine_

currentState_

protected Block currentState_

initialState_

protected Block initialState_

timeOfEntry_

protected java.lang.Double timeOfEntry_

tfsmEvents_

protected java.util.List<java.lang.String> tfsmEvents_

tfsmActions_

protected java.util.List<java.lang.String> tfsmActions_

firstUpdate

private boolean firstUpdate

next_time_of_update_

private double next_time_of_update_

label_of_next_transition_

private java.lang.String label_of_next_transition_
Constructor Detail

TFSMMoC

public TFSMMoC(java.lang.String name)
Method Detail

setup

public void setup(BlockStructure s)
Description copied from class: ModelOfComputation
Setup for simulation. Called after prep, before the first snapshot.

Overrides:
setup in class ModelOfComputationImpl<java.lang.Double>
Parameters:
s - the block structure of the model driven by this MoC

setInitialState

public FSMState setInitialState(FSMState init)

reset

public void reset(BlockStructure s)
Description copied from class: ModelOfComputation
Reset for a new computation of the current snapshot (called at least once at the beginning of the snapshot).

Overrides:
reset in class ModelOfComputationImpl<java.lang.Double>

setCurrentState

public void setCurrentState(Block b)

getCurrentState

public Block getCurrentState()

schedule

public void schedule(BlockStructure s)
Description copied from class: ModelOfComputation
Choose a block to be updated.

Specified by:
schedule in class ModelOfComputation<java.lang.Double>

update

public void update(BlockStructure s)
Description copied from class: ModelOfComputation
Update a block.

Specified by:
update in class ModelOfComputation<java.lang.Double>

propagate

public void propagate(BlockStructure s)
Description copied from class: ModelOfComputation
Propagate new information produced by the update of a block.

Specified by:
propagate in class ModelOfComputation<java.lang.Double>

canGoFurther

public boolean canGoFurther(BlockStructure s)
Description copied from class: ModelOfComputation
Tell if it is possible to compute more information.

Specified by:
canGoFurther in class ModelOfComputation<java.lang.Double>

startOfUpdate

public void startOfUpdate(BlockStructure s)
Description copied from class: ModelOfComputation
Called at the beginning of an update of an inner block (get partial inputs from the upper model).

Specified by:
startOfUpdate in class ModelOfComputation<java.lang.Double>

endOfUpdate

public void endOfUpdate(BlockStructure s)
Description copied from class: ModelOfComputation
Called at the end of an update of an inner block (produce partial outputs for the upper model).

Specified by:
endOfUpdate in class ModelOfComputation<java.lang.Double>

computeCurrentTime

private void computeCurrentTime()
Compute the current time by looking at the tag of the first tagged event on the tfsm clock.


directTagConversion

private static <T extends java.lang.Comparable<? super T>> java.lang.Double directTagConversion(TagRelation<T,java.lang.Double> rel)

reverseTagConversion

private static <T extends java.lang.Comparable<? super T>> java.lang.Double reverseTagConversion(TagRelation<java.lang.Double,T> rel)

getCurrentTime

public java.lang.Double getCurrentTime()
Get the current time in this MoC.

Specified by:
getCurrentTime in class ModelOfComputation<java.lang.Double>

getClock

public Clock<java.lang.Double> getClock()
Description copied from class: ModelOfComputation
Get the observation clock of this MoC.

Specified by:
getClock in class ModelOfComputation<java.lang.Double>

getIncommingEvents

private void getIncommingEvents(BlockStructure s)

getFiringTransition

public Relation getFiringTransition(BlockStructure s)

endOfSnapshot

public void endOfSnapshot(BlockStructure s)
Description copied from class: ModelOfComputation
End of the snapshot => update internal state, produce outputs.

Overrides:
endOfSnapshot in class ModelOfComputationImpl<java.lang.Double>

emitObservationRequests

public void emitObservationRequests(BlockStructure s)
Description copied from class: ModelOfComputation
Place ticks on clocks to request to be observed in future snapshots.

Overrides:
emitObservationRequests in class ModelOfComputationImpl<java.lang.Double>

getTfsmEvents

public java.util.List<java.lang.String> getTfsmEvents()