Esempio n. 1
0
  @Override
  public void recordstate(double time, boolean exportflows, int outsteps) throws SiriusException {
    success = false;
    double min = Math.floor(time / 60);
    double hrs = Math.floor(min / 60);
    ts.set(Calendar.HOUR_OF_DAY, (int) hrs);
    ts.set(Calendar.MINUTE, (int) (min - hrs * 60));
    ts.set(Calendar.SECOND, (int) (time - min * 60));
    OutputParameters params =
        new OutputParameters(
            exportflows,
            0 == scenario.clock.getCurrentstep() ? 1 : outsteps,
            scenario.getSimDtInSeconds() * outsteps);

    for (com.relteq.sirius.jaxb.Network network : scenario.getNetworkList().getNetwork()) {
      for (com.relteq.sirius.jaxb.Link link : network.getLinkList().getLink()) {
        Link _link = (Link) link;
        try {
          LinkDataTotal db_ldt = fill_total(_link, params);
          fill_detailed(_link, params, db_ldt.getSpeed());
        } catch (Exception exc) {
          throw new SiriusException(exc);
        } finally {
          _link.reset_cumulative();
        }
      }
    }
    success = true;
  }
Esempio n. 2
0
 private com.relteq.sirius.jaxb.Network restoreNetwork(Networks db_net) throws TorqueException {
   com.relteq.sirius.jaxb.Network net = factory.createNetwork();
   net.setId(id2str(db_net.getId()));
   net.setName(db_net.getName());
   net.setDescription(db_net.getDescription());
   // TODO net.setPosition();
   net.setDt(new BigDecimal(1)); // TODO change this when the DB schema is updated
   net.setLocked(db_net.getLocked());
   net.setNodeList(restoreNodeList(db_net));
   net.setLinkList(restoreLinkList(db_net));
   return net;
 }