Package model.devs

Examples of model.devs.ICoupledModel


  @Override
  public void instrumentModel(IModel model,
      IComputationTaskConfiguration simConfig) {

    ICoupledModel m = (ICoupledModel) model;

    AbstractState mapState = ((IAtomicModel<?>) m.getModel("Map")).getState();

    mapState.setMediator(new Mediator());

    // System.out.println("Instrumenting the model");
View Full Code Here


   */
  protected Map<IBasicDEVSModel, Object> getImminents() {
    // search for the atomic model to b executed by calling all select methods
    // on its path
    IBasicDEVSModel imminent = null;
    ICoupledModel cm = getModel();

    // imminent can't be null in the end, there is always at least one imminent
    // model or the simulation run will terminate before
    while (imminent == null) {
      // get all potentially imminent children
      Collection<IBasicDEVSModel> imminentsSel = events.get(cm).dequeueAll();
      // select one of these using the responsible select method
      imminent = cm.select(new ArrayList<>(imminentsSel));
      // if the selected one is a coupled model we need to look in
      if (imminent instanceof IBasicCoupledModel) {
        cm = (ICoupledModel) imminent;
        imminent = null;
      }
View Full Code Here

   * @return time of next internal event (tonie)
   */
  @Override
  public double doRemainder(Double time) {

    ICoupledModel cm = getModel();
    imminents.remove(cm);

    // the models which get influenced by one of the imminent ones
    HashMap<IBasicAtomicModel<? extends AbstractState>, Object> influencees =
        new HashMap<>();

    HashMap<IBasicCoupledModel, Object> influencedCM =
        new HashMap<>();

    copyHandler.copyValues(cm.getEICIterator(), cm, influencees, influencedCM);

    imminents.putAll(influencees);
    imminents.putAll(influencedCM);

    for (IBasicDEVSModel model : imminents.keySet()) {
View Full Code Here

   */
  @Override
  public void getOutputs() {
    // call getOutputs imminent child

    ICoupledModel cm = getModel();

    // System.out.println(getTime()+" -- "+subProcessors.size()+" --- "+
    // events.size());

    // while (events.size() > 0)
    // System.out.println(events.getMin()+" "+ events.dequeue());

    Collection<IBasicDEVSModel> imminentsSel = events.dequeueAll();
   
    // execute the select method
    IBasicDEVSModel imminent = cm.select(new HashSet<>(imminentsSel));

    imminents.put(imminent, null);

    // now lets place all not imminent models back into the queue
    for (IBasicDEVSModel m: imminentsSel) {
      if (m != imminent) {
        events.enqueue(m, getTime());
      }
    }

    // the models which get influenced by one the imminent one
    HashMap<IBasicAtomicModel<? extends AbstractState>, Object> influencees =
        new HashMap<>();

    HashMap<IBasicCoupledModel, Object> influencedCM =
        new HashMap<>();

    // System.out.println(((DEVSProcessorState) getState()).getTonie()+":

    // propagate the messages ...

    // Calling getOutputs for the model "+model);
    subProcessors.get(imminent).getOutputs();
    copyHandler.copyValues(cm.getICIterator(imminent), cm, influencees,
        influencedCM);
    copyHandler.copyValues(cm.getEOCIterator(imminent), cm, influencees,
        influencedCM);
    imminent.clearOutPorts();

    imminents.putAll(influencees);
    imminents.putAll(influencedCM);
View Full Code Here

TOP

Related Classes of model.devs.ICoupledModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.