Package model.devscore

Examples of model.devscore.IBasicDEVSModel


    System.out.println("running the simulation");
    // run the model
    launcher.executeModel();

    Iterator<IBasicDEVSModel> it = forestFire.getSubModelIterator();
    IBasicDEVSModel m = null;

    // while (!(m instanceof GridElement))
    // m = it.next();
    //
    // it = ((CoupledModel) m).getSubModelIterator();
View Full Code Here


    c = 0;
    for (int i = 0; i < height; i++) {
      for (int j = 0; j < width; j++) {
        String modelname = new String(i + "/" + j);

        IBasicDEVSModel model = getModel(modelname);

        // couple every element with the map
        addInternalCoupling(model,
            getModelOutPort(modelname, FireModule.OutMap), getModel("Map"),
            getModelInPort("Map", "In"));
View Full Code Here

   * @return the imminents
   */
  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) {
View Full Code Here

    events.put(model, queue);

    // iterate and initialize all sub-models
    Iterator<IBasicDEVSModel> it = model.getSubModelIterator();
    while (it.hasNext()) {
      IBasicDEVSModel m = it.next();
      if (m instanceof IBasicCoupledModel) {
        internalInit((IBasicCoupledModel) m, time);
      } else {
        Double d =
            ((IBasicAtomicModel<? extends AbstractState>) m).timeAdvanceSim();
        if (!events.containsKey(m.getParent())) {
          events.put(m.getParent(),
              eqFactory.<IBasicDEVSModel> createDirect(null));

        }
        events.get(m.getParent()).enqueue(m, time + d);
        toles.put(m, time);
      }
    }
  }
View Full Code Here

    // 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

    ((DEVSProcessorState) getState()).setTole(time);
    Iterator<IBasicDEVSModel> modelIt =
        ((ICoupledModel) getModel()).getSubModelIterator();

    while (modelIt.hasNext()) {
      IBasicDEVSModel model = modelIt.next();

      IAbstractSequentialProcessor proc;
      if (model instanceof ICoupledModel) {
        proc = new Coordinator((ICoupledModel) model, eqf);
View Full Code Here

  @Override
  public List<IBasicDEVSModel> getModels(Class<?> classOfModelsToGet) {
    Iterator<IBasicDEVSModel> it = models.iterator();
    List<IBasicDEVSModel> result = new ArrayList<>();
    while (it.hasNext()) {
      IBasicDEVSModel m = it.next();
      if (m.getClass().isInstance(classOfModelsToGet)) {
        result.add(m);
      }
    }
    return result;
  }
View Full Code Here

  @Override
  public void removeModel(String name) {
    Iterator<IBasicDEVSModel> it = models.iterator();
    while (it.hasNext()) {
      IBasicDEVSModel m = it.next();
      if (m.getFullName().compareTo(name) == 0) {
        it.remove();
        break;
      }
    }
View Full Code Here

  public void modifyModel(IDynamicCoupledModel theModel) {
    if (isAddRequest()) {
      theModel.addModel(getModel());
    } else {
      // remove the model from the coupled model it belongs to
      IBasicDEVSModel modelToBeRemoved = getModel();
      // Test whether the model has to be looked up
      if (theModel instanceof BasicCoupledModel) {
        if (modelToBeRemoved == null) {
          modelToBeRemoved = ((BasicCoupledModel) theModel).getModel(modelName);
        }
      } else {
        SimSystem
            .report(
                Level.WARNING,
                "Cannot remove the model as the model which shall contain the model to be removed is not a coupled devs model!");
      }

      theModel.removeCompleteModel(modelToBeRemoved);
      // a removed model has no parent!!!
      modelToBeRemoved.setParent(null);
    }

  }
View Full Code Here

  @Override
  public void removeModel(String name) {
    Iterator<IBasicDEVSModel> it = getVelements().iterator();
    while (it.hasNext()) {
      IBasicDEVSModel m = it.next();
      if (m.getName().compareTo(name) == 0) {
        it.remove();
        break;
      }
    }
    setElementIterator(null);
View Full Code Here

TOP

Related Classes of model.devscore.IBasicDEVSModel

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.