コード例 #1
0
    public NodeData(
        Controller parent,
        Link profileLink,
        String demandStr,
        Double knob,
        Double dpdt,
        Scenario scenario) {

      this.knob = knob;
      this.myNode = profileLink.getBegin_node();
      meas = profileLink;
      feeds = new ArrayList<Link>();
      not_feeds = new ArrayList<Link>();

      //  incoming link sets
      for (int i = 0; i < myNode.getnIn(); i++) {
        Link link = myNode.getInput_link()[i];
        if (link.isFreeway() || link.isHov()) feeds.add(link);
        else not_feeds.add(link);
      }

      // outgoing link sets
      not_meas = new ArrayList<Link>();
      for (int j = 0; j < myNode.getnOut(); j++) {
        Link link = myNode.getOutput_link()[j];
        if (meas != link) not_meas.add(link);
      }

      if (meas == null) return;

      // find the demand profile for the offramp
      measured_flow_profile_veh =
          new BeatsTimeProfileDouble(demandStr, ",", dpdt, 0d, scenario.get.simdtinseconds());
      measured_flow_profile_veh.multiplyscalar(scenario.get.simdtinseconds());

      //            alpha_tilde = new Double[myNode.nIn];

      // create the actuator
      edu.berkeley.path.beats.jaxb.Actuator jaxbA = new edu.berkeley.path.beats.jaxb.Actuator();
      edu.berkeley.path.beats.jaxb.ScenarioElement se =
          new edu.berkeley.path.beats.jaxb.ScenarioElement();
      edu.berkeley.path.beats.jaxb.ActuatorType at =
          new edu.berkeley.path.beats.jaxb.ActuatorType();
      se.setId(myNode.getId());
      se.setType("node");
      at.setId(-1);
      at.setName("cms");
      jaxbA.setId(-1);
      jaxbA.setScenarioElement(se);
      jaxbA.setActuatorType(at);
      cms = new ActuatorCMS(scenario, jaxbA, new BeatsActuatorImplementation(jaxbA, scenario));
      cms.populate(null, null);
      cms.setMyController(parent);
    }