demos.semantic_adaptation
Class DE_TFSM_InterfaceBlock

java.lang.Object
  extended by modhelxs.abstractsemantics.NamedEntity
      extended by modhelxs.abstractsemantics.ObservableEntity
          extended by modhelxs.abstractsemantics.Block
              extended by modhelxs.abstractsemantics.InterfaceBlock
                  extended by modhelxs.state_management.ManagedInterfaceBlock
                      extended by demos.semantic_adaptation.DE_TFSM_InterfaceBlock
All Implemented Interfaces:
Block, InterfaceBlock, NamedEntity, ObservableEntity

public class DE_TFSM_InterfaceBlock
extends ManagedInterfaceBlock

This DE/TFSM interface block implements decoding input DE events to TFSM input symbols and encoding TFSM output symbols into DE events. The matching between DE events and TFSM symbols is described by setting relations between DE pins and TFSM pins. When a DE pin is connected to several TFSM pins, the value of a DE events on this pin is compared to the "match" property of the TFSM pins. A token is put on every TFSM pin whose "match" property is null or equals the value of the DE event. If no TFSM pin match the value, a warning is emitted. To avoid this warning, it is possible to tell which values should be ignored in the "discard" property of the DE pin (the type of this property is Object[]). The "match" property of output TFSM pins is used to set the value of the DE event produced on all the output pins of the interface block which are connected to them. Two properties "a" and "b" configure the adaptation of time scales between DE and TFSM. Time in TFSM is a*t+b if 't' is the time in DE. This means that time in TFSM runs 'a' times faster than in DE and is offset by 'b'.

Author:
boulange

Field Summary
private  TransientValue<java.lang.Boolean> incoming_event
           
private  TFSMMoC internal_moc_
           
private  Parameter<java.lang.Double> timescale_coeff
           
private  Parameter<java.lang.Double> timescale_offset
           
 
Constructor Summary
DE_TFSM_InterfaceBlock(java.lang.String name, Model<java.lang.Double> model, java.lang.Object... properties)
           
 
Method Summary
 void adaptIn()
          Adapt data, time and control from the outer model to the inner one.
 void adaptOut()
          Adapt data, time and control from the inner model to the outer one.
 void doEndOfSnapshot()
          The endOfSnapshot behavior of the interface block.
 void doGhostUpdate()
          The update behavior of the interface block when the internal model is not updated.
 void doPostUpdate()
          The update behavior of the interface block after updating the internal model.
 void doPreSetup()
          Some pre-setup behavior necessary for subclasses.
 void doPreUpdate()
          The update behavior of the interface block before updating the internal model.
 void doReset()
          The reset behavior of the interface block.
 void doSetup()
          The setup behavior of the block.
 void doStartOfSnapshot()
          The start of snapshot behavior of the block.
 Tag<java.lang.Double> getTimeOfRequest()
          Get the time tag at which the block has requested to be observed.
 boolean hasObservationRequest()
          Has this block posted an observation request?
 boolean shouldUpdateModel()
          Should the internal model be updated.
 
Methods inherited from class modhelxs.state_management.ManagedInterfaceBlock
endOfSnapshot, endOfUpdate, initFromProperties, internalWasUpdated, reset, setup, startOfSnapshot, startOfUpdate, update, wasUpdated
 
Methods inherited from class modhelxs.abstractsemantics.InterfaceBlock
connect, connectFromModel, createAdaptationRelation, emitObservationRequests, getAdaptation, getInputPins, getInternalModel, getOutputPins, prep, validate, wrapup
 
Methods inherited from class modhelxs.abstractsemantics.Block
connectFromInterfaceBlock, connectFromRegularBlock, getEngine, getMoC, getParent, getSolver, sanityCheck, setParent
 
Methods inherited from class modhelxs.abstractsemantics.ObservableEntity
addPin, getInterface, getPin
 
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.Block
getParent
 
Methods inherited from interface modhelxs.ecore.ObservableEntity
getInterface
 
Methods inherited from interface modhelxs.ecore.NamedEntity
getName, getProperties, setName
 

Field Detail

timescale_coeff

private Parameter<java.lang.Double> timescale_coeff

timescale_offset

private Parameter<java.lang.Double> timescale_offset

incoming_event

private TransientValue<java.lang.Boolean> incoming_event

internal_moc_

private final TFSMMoC internal_moc_
Constructor Detail

DE_TFSM_InterfaceBlock

public DE_TFSM_InterfaceBlock(java.lang.String name,
                              Model<java.lang.Double> model,
                              java.lang.Object... properties)
Method Detail

doStartOfSnapshot

public void doStartOfSnapshot()
Description copied from class: ManagedInterfaceBlock
The start of snapshot behavior of the block.

Specified by:
doStartOfSnapshot in class ManagedInterfaceBlock

doPreSetup

public void doPreSetup()
Description copied from class: ManagedInterfaceBlock
Some pre-setup behavior necessary for subclasses.

Specified by:
doPreSetup in class ManagedInterfaceBlock

doSetup

public void doSetup()
Description copied from class: ManagedInterfaceBlock
The setup behavior of the block.

Specified by:
doSetup in class ManagedInterfaceBlock

doReset

public void doReset()
Description copied from class: ManagedInterfaceBlock
The reset behavior of the interface block.

Specified by:
doReset in class ManagedInterfaceBlock

adaptIn

public void adaptIn()
Description copied from class: InterfaceBlock
Adapt data, time and control from the outer model to the inner one.

Specified by:
adaptIn in class InterfaceBlock

doPreUpdate

public void doPreUpdate()
Description copied from class: ManagedInterfaceBlock
The update behavior of the interface block before updating the internal model.

Specified by:
doPreUpdate in class ManagedInterfaceBlock

shouldUpdateModel

public boolean shouldUpdateModel()
Description copied from class: ManagedInterfaceBlock
Should the internal model be updated.

Specified by:
shouldUpdateModel in class ManagedInterfaceBlock

doPostUpdate

public void doPostUpdate()
Description copied from class: ManagedInterfaceBlock
The update behavior of the interface block after updating the internal model.

Specified by:
doPostUpdate in class ManagedInterfaceBlock

doGhostUpdate

public void doGhostUpdate()
Description copied from class: ManagedInterfaceBlock
The update behavior of the interface block when the internal model is not updated.

Specified by:
doGhostUpdate in class ManagedInterfaceBlock

adaptOut

public void adaptOut()
Description copied from class: InterfaceBlock
Adapt data, time and control from the inner model to the outer one.

Specified by:
adaptOut in class InterfaceBlock

doEndOfSnapshot

public void doEndOfSnapshot()
Description copied from class: ManagedInterfaceBlock
The endOfSnapshot behavior of the interface block.

Specified by:
doEndOfSnapshot in class ManagedInterfaceBlock

hasObservationRequest

public boolean hasObservationRequest()
Description copied from class: Block
Has this block posted an observation request? If yes, the block needs to be updated even if the scheduling policy of the MoC does not require it.

Overrides:
hasObservationRequest in class Block

getTimeOfRequest

public Tag<java.lang.Double> getTimeOfRequest()
Description copied from class: Block
Get the time tag at which the block has requested to be observed.

Overrides:
getTimeOfRequest in class Block