Java Code Examples for org.matsim.api.core.v01.network.Link#getFreespeed()
The following examples show how to use
org.matsim.api.core.v01.network.Link#getFreespeed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LSDataTravelTime.java From amodeus with GNU General Public License v2.0 | 5 votes |
@Override public double getLinkTravelTime(Link link, double time, Person person, Vehicle vehicle) { double speed = link.getFreespeed(); LinkSpeedTimeSeries timeSeries = lsData.get(link); if (Objects.nonNull(timeSeries)) speed = timeSeries.getSpeedsFloor((int) time); return link.getLength() / speed; }
Example 2
Source File: DefaultTaxiTrafficData.java From amodeus with GNU General Public License v2.0 | 5 votes |
@Override public double getTrafficSpeed(Link link, double now) { LinkSpeedTimeSeries series = lsData.get(link); Double speed = link.getFreespeed(); if (Objects.nonNull(series)) { Double trafficSpeed = series.getSpeedsFloor((int) now); if (Objects.nonNull(trafficSpeed)) speed = trafficSpeed; } return speed; }
Example 3
Source File: ScheduleRoutersGtfsShapes.java From pt2matsim with GNU General Public License v2.0 | 4 votes |
@Override public double getLinkTravelTime(Link link, double time, Person person, Vehicle vehicle) { return link.getLength() / link.getFreespeed(); }
Example 4
Source File: ScheduleRoutersStandard.java From pt2matsim with GNU General Public License v2.0 | 4 votes |
@Override public double getLinkTravelTime(Link link, double time, Person person, Vehicle vehicle) { return link.getLength() / link.getFreespeed(); }
Example 5
Source File: ScheduleRoutersOsmAttributes.java From pt2matsim with GNU General Public License v2.0 | 4 votes |
@Override public double getLinkTravelTime(Link link, double time, Person person, Vehicle vehicle) { return link.getLength() / link.getFreespeed(); }
Example 6
Source File: PTMapperTools.java From pt2matsim with GNU General Public License v2.0 | 4 votes |
public static double calcTravelCost(Link link, PublicTransitMappingConfigGroup.TravelCostType travelCostType) { return (travelCostType.equals(PublicTransitMappingConfigGroup.TravelCostType.travelTime) ? link.getLength() / link.getFreespeed() : link.getLength()); }
Example 7
Source File: NetworkTools.java From pt2matsim with GNU General Public License v2.0 | 4 votes |
/** * Integrates <tt>network B</tt> into <tt>network A</tt>. Network * A contains all links and nodes of both networks * after integration. */ public static void integrateNetwork(final Network networkA, final Network networkB, boolean mergeModes) { final NetworkFactory factory = networkA.getFactory(); // Nodes for(Node node : networkB.getNodes().values()) { Id<Node> nodeId = Id.create(node.getId().toString(), Node.class); if(!networkA.getNodes().containsKey(nodeId)) { Node newNode = factory.createNode(nodeId, node.getCoord()); networkA.addNode(newNode); } } // Links double capacityFactor = networkA.getCapacityPeriod() / networkB.getCapacityPeriod(); for(Link link : networkB.getLinks().values()) { Id<Link> linkId = Id.create(link.getId().toString(), Link.class); if(!networkA.getLinks().containsKey(linkId)) { Id<Node> fromNodeId = Id.create(link.getFromNode().getId().toString(), Node.class); Id<Node> toNodeId = Id.create(link.getToNode().getId().toString(), Node.class); Link newLink = factory.createLink(linkId, networkA.getNodes().get(fromNodeId), networkA.getNodes().get(toNodeId)); newLink.setAllowedModes(link.getAllowedModes()); newLink.setCapacity(link.getCapacity() * capacityFactor); newLink.setFreespeed(link.getFreespeed()); newLink.setLength(link.getLength()); newLink.setNumberOfLanes(link.getNumberOfLanes()); networkA.addLink(newLink); } else if (mergeModes) { Link existingLink = networkA.getLinks().get(linkId); Set<String> allowedModes = new HashSet<>(); allowedModes.addAll(existingLink.getAllowedModes()); allowedModes.addAll(link.getAllowedModes()); existingLink.setAllowedModes(allowedModes); if (link.getCapacity() * capacityFactor != existingLink.getCapacity()) { throw new IllegalStateException("Capacity must be equal for integration"); } if (link.getFreespeed() != existingLink.getFreespeed()) { throw new IllegalStateException("Freespeed must be equal for integration"); } if (link.getLength() != existingLink.getLength()) { throw new IllegalStateException("Length must be equal for integration"); } if (link.getNumberOfLanes() != existingLink.getNumberOfLanes()) { throw new IllegalStateException("Number of lanes must be equal for integration"); } } } }