Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
8e78f5af
Commit
8e78f5af
authored
Mar 15, 2019
by
Tobias Meuser
Browse files
Finshed offlaoding
parent
863a0954
Changes
9
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/api/linklayer/mac/PhyType.java
View file @
8e78f5af
...
...
@@ -49,7 +49,7 @@ public enum PhyType {
* (LinkLayer might add retransmission behavior as in 802.11), 5MBit/s netto
* (802.11b) BW, 500us latency, 2,2kB MTU, Broadcast
*/
WIFI
(
NetInterfaceName
.
WIFI
,
0.01
,
5
*
Rate
.
Mbit_s
,
500
*
Time
.
MICROSECOND
,
WIFI
(
NetInterfaceName
.
WIFI
,
0.01
,
12
*
Rate
.
Mbit_s
,
500
*
Time
.
MICROSECOND
,
2334
,
true
),
/**
* A wired connection based on a TopologyView
...
...
src/de/tud/kom/p2psim/impl/linklayer/mac/AbstractMacLayer.java
View file @
8e78f5af
src/de/tud/kom/p2psim/impl/linklayer/mac/EnqueuingMac.java
View file @
8e78f5af
src/de/tud/kom/p2psim/impl/scenario/DefaultConfigurator.java
View file @
8e78f5af
...
...
@@ -145,6 +145,8 @@ public class DefaultConfigurator implements Configurator {
private
Map
<
String
,
String
>
variables
=
new
LinkedHashMap
<
String
,
String
>();
private
boolean
_parseOnly
=
false
;
/**
* Create new configurator instance with the configuration data in the given
* XML file.
...
...
@@ -199,6 +201,13 @@ public class DefaultConfigurator implements Configurator {
}
}
public
Map
<
String
,
String
>
parseAllDefaults
()
throws
ConfigurationException
{
_parseOnly
=
true
;
configureAll
();
_parseOnly
=
false
;
return
getVariables
();
}
/**
* Configure all components of the simulator. The single components are
* either registered via the <code>register(name, component)</code> method
...
...
@@ -273,10 +282,12 @@ public class DefaultConfigurator implements Configurator {
}
else
if
(
elem
.
getName
().
equals
(
Configurator
.
DEFAULT_TAG
))
{
configureDefaults
(
elem
);
}
else
{
if
(!
_parseOnly
)
{
configureComponent
(
elem
);
}
}
}
}
/**
* Processes a <code><Default></code> Tag by setting the respective
...
...
src/de/tud/kom/p2psim/impl/vehicular/caching/DefaultCachingComponent.java
View file @
8e78f5af
...
...
@@ -416,8 +416,11 @@ public class DefaultCachingComponent implements CachingComponent, ConnectivityLi
@Override
public
String
getNodeDescription
()
{
if
(
getHost
().
getId
().
value
()
>
47
)
{
return
" "
+
getHost
().
getId
();
}
return
""
;
}
@Override
public
int
getNodeColorDimensions
()
{
...
...
src/de/tud/kom/p2psim/impl/vehicular/decision/AbstractVehicleDecisionComponent.java
View file @
8e78f5af
...
...
@@ -20,6 +20,8 @@
package
de.tud.kom.p2psim.impl.vehicular.decision
;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.Event
;
import
de.tudarmstadt.maki.simonstrator.api.EventHandler
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
...
...
@@ -27,6 +29,8 @@ import de.tudarmstadt.maki.simonstrator.api.Monitor;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.ComponentNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.core.MonitorComponent.AnalyzerNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.EnvironmentSensor
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.Environment
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.VehicleDecisionComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.VehicleInformationComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.caching.CachingComponent
;
...
...
@@ -45,6 +49,8 @@ public abstract class AbstractVehicleDecisionComponent implements VehicleDecisio
private
boolean
_routeAnalyzerInit
=
false
;
private
VehicleRouteAnalyzer
_routeAnalyzer
=
null
;
private
EnvironmentSensor
_sensors
;
public
AbstractVehicleDecisionComponent
(
Host
pHost
)
{
_host
=
pHost
;
}
...
...
@@ -53,6 +59,7 @@ public abstract class AbstractVehicleDecisionComponent implements VehicleDecisio
public
void
initialize
()
{
try
{
_cache
=
getHost
().
getComponent
(
CachingComponent
.
class
);
_sensors
=
getHost
().
getComponent
(
EnvironmentSensor
.
class
);
}
catch
(
ComponentNotAvailableException
e
)
{
throw
new
AssertionError
(
e
);
}
...
...
@@ -90,11 +97,11 @@ public abstract class AbstractVehicleDecisionComponent implements VehicleDecisio
case
EVENT_DECISION_MAKING_CYCLE:
RoadNetworkRoute
currentRoute
=
getVehicleInformation
().
getCurrentRoute
();
if
(
currentRoute
!=
null
&&
currentRoute
.
getRoute
().
size
()
>
2
)
{
if
(
currentRoute
!=
null
)
{
boolean
changed
=
false
;
if
(
currentRoute
.
getRoute
().
size
()
>
2
)
{
BenefitBasedRoute
optimalRouteWithBenefit
=
getOptimalRoute
(
currentRoute
,
_cache
.
getDecidedCacheEntries
(
RoadInformation
.
class
));
_cache
.
getDecidedCacheEntries
(
RoadInformation
.
class
)
,
_sensors
.
getEnvironment
()
);
if
(
optimalRouteWithBenefit
!=
null
)
{
RoadNetworkRoute
optimalRoute
=
optimalRouteWithBenefit
.
getRoute
();
if
(
optimalRouteWithBenefit
.
getRoute
().
getRoute
().
size
()
>
1
)
{
...
...
@@ -107,11 +114,9 @@ public abstract class AbstractVehicleDecisionComponent implements VehicleDecisio
}
}
}
if
(!
changed
)
{
if
(
hasRouteAnalyzer
())
{
getRouteAnalyzer
().
routeUnchanged
(
getHost
().
getId
(),
currentRoute
);
}
if
(!
changed
&&
hasRouteAnalyzer
())
{
getRouteAnalyzer
().
routeUnchanged
(
getHost
().
getId
(),
currentRoute
);
}
}
...
...
src/de/tud/kom/p2psim/impl/vehicular/decision/DefaultVehicleDecisionComponent.java
View file @
8e78f5af
...
...
@@ -23,6 +23,7 @@ package de.tud.kom.p2psim.impl.vehicular.decision;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.RoadInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute
;
...
...
src/de/tud/kom/p2psim/impl/vehicular/decision/LatestPossibleVehicleDecisionComponent.java
0 → 100755
View file @
8e78f5af
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tud.kom.p2psim.impl.vehicular.decision
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.RoadInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetwork
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.routing.DijkstraAlgorithm
;
public
class
LatestPossibleVehicleDecisionComponent
extends
AbstractVehicleDecisionComponent
{
public
LatestPossibleVehicleDecisionComponent
(
Host
pHost
)
{
super
(
pHost
);
}
@Override
public
BenefitBasedRoute
getOptimalRoute
(
RoadNetworkRoute
pInvestigatedRoute
,
List
<
RoadInformation
>
knownInformation
)
{
List
<
RoadInformation
>
actualKnownInformation
=
new
ArrayList
<>();
if
(
getVehicleInformation
().
isValid
()
&&
knownInformation
!=
null
)
{
for
(
RoadInformation
roadInformation
:
knownInformation
)
{
RoadProperty
property
=
roadInformation
.
getValue
();
if
(!
property
.
getValue
().
equals
(
property
.
getDefaultProperty
().
getValue
()))
{
if
(
pInvestigatedRoute
.
getStart
().
getAccessibleEdges
().
contains
(
roadInformation
.
getEdge
()))
{
actualKnownInformation
.
add
(
roadInformation
);
}
}
}
DijkstraAlgorithm
dijkstraAlgorithm
=
new
DijkstraAlgorithm
();
List
<
RoadNetworkEdge
>
blocked
=
new
ArrayList
<>();
for
(
RoadInformation
roadInformation
:
actualKnownInformation
)
{
if
(!
blocked
.
contains
(
roadInformation
.
getEdge
()))
{
blocked
.
add
(
roadInformation
.
getEdge
());
}
}
RoadNetworkRoute
route
=
dijkstraAlgorithm
.
findRoute
(
RoadNetwork
.
CURRENT_ROAD_NETWORK
,
getVehicleInformation
().
getCurrentRoute
().
getStart
(),
getVehicleInformation
().
getCurrentRoute
().
getDestination
(),
Collections
.
emptyList
(),
blocked
);
if
(
route
!=
null
)
{
double
oldCosts
=
0
;
for
(
RoadNetworkEdge
edge
:
pInvestigatedRoute
.
getRoute
())
{
oldCosts
+=
edge
.
calculateStandardEdgeCosts
();
if
(
knownInformation
!=
null
)
{
for
(
RoadInformation
roadInformation
:
actualKnownInformation
)
{
oldCosts
+=
edge
.
calculateAdditionalCostIfKnown
(
roadInformation
.
getValue
());
}
}
}
double
newCosts
=
0
;
for
(
RoadNetworkEdge
edge
:
route
.
getRoute
())
{
newCosts
+=
edge
.
calculateStandardEdgeCosts
();
if
(
knownInformation
!=
null
)
{
for
(
RoadInformation
roadInformation
:
actualKnownInformation
)
{
newCosts
+=
edge
.
calculateAdditionalCostIfKnown
(
roadInformation
.
getValue
());
}
}
}
if
(
oldCosts
>
newCosts
)
{
return
new
BenefitBasedRoute
(
oldCosts
-
newCosts
,
route
);
}
}
return
new
BenefitBasedRoute
(
0
,
pInvestigatedRoute
);
}
return
null
;
}
}
src/de/tud/kom/p2psim/impl/vehicular/decision/VisionBasedVehicleDecisionComponent.java
View file @
8e78f5af
...
...
@@ -25,6 +25,7 @@ import java.util.Collections;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.Environment
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.RoadInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetwork
;
...
...
@@ -39,24 +40,34 @@ public class VisionBasedVehicleDecisionComponent extends AbstractVehicleDecision
}
@Override
public
BenefitBasedRoute
getOptimalRoute
(
RoadNetworkRoute
pInvestigatedRoute
,
List
<
RoadInformation
>
knownInformation
)
{
List
<
RoadInformation
>
actualKnownInformation
=
new
ArrayList
<>();
public
BenefitBasedRoute
getOptimalRoute
(
RoadNetworkRoute
pInvestigatedRoute
,
List
<
RoadInformation
>
pKnownInformation
)
{
return
new
BenefitBasedRoute
(
0
,
pInvestigatedRoute
);
}
@Override
public
BenefitBasedRoute
getOptimalRoute
(
RoadNetworkRoute
pInvestigatedRoute
,
List
<
RoadInformation
>
knownInformation
,
Environment
pEnvironment
)
{
List
<
RoadProperty
>
actualKnownInformation
=
new
ArrayList
<>();
if
(
getVehicleInformation
().
isValid
()
&&
knownInformation
!=
null
)
{
if
(
getVehicleInformation
().
isValid
())
{
if
(
knownInformation
!=
null
)
{
for
(
RoadInformation
roadInformation
:
knownInformation
)
{
RoadProperty
property
=
roadInformation
.
getValue
();
if
(!
property
.
getValue
().
equals
(
property
.
getDefaultProperty
().
getValue
()))
{
if
(
pInvestigatedRoute
.
getStart
().
getAccessibleEdges
().
contains
(
roadInformation
.
getEdge
()))
{
actualKnownInformation
.
add
(
roadInformation
);
actualKnownInformation
.
add
(
roadInformation
.
getValue
());
}
}
}
}
actualKnownInformation
.
addAll
(
pEnvironment
.
getProperties
(
RoadProperty
.
class
));
DijkstraAlgorithm
dijkstraAlgorithm
=
new
DijkstraAlgorithm
();
List
<
RoadNetworkEdge
>
blocked
=
new
ArrayList
<>();
for
(
Road
Information
roadInformation
:
actualKnownInformation
)
{
if
(!
blocked
.
contains
(
roadInformation
.
getEdge
()))
{
for
(
Road
Property
roadInformation
:
actualKnownInformation
)
{
if
(!
blocked
.
contains
(
roadInformation
.
getEdge
())
&&
roadInformation
.
getEdge
().
isActive
()
)
{
blocked
.
add
(
roadInformation
.
getEdge
());
}
}
...
...
@@ -66,20 +77,16 @@ public class VisionBasedVehicleDecisionComponent extends AbstractVehicleDecision
double
oldCosts
=
0
;
for
(
RoadNetworkEdge
edge
:
pInvestigatedRoute
.
getRoute
())
{
oldCosts
+=
edge
.
calculateStandardEdgeCosts
();
if
(
knownInformation
!=
null
)
{
for
(
RoadInformation
roadInformation
:
actualKnownInformation
)
{
oldCosts
+=
edge
.
calculateAdditionalCostIfKnown
(
roadInformation
.
getValue
());
}
for
(
RoadProperty
roadInformation
:
actualKnownInformation
)
{
oldCosts
+=
edge
.
calculateAdditionalCostIfKnown
(
roadInformation
);
}
}
double
newCosts
=
0
;
for
(
RoadNetworkEdge
edge
:
route
.
getRoute
())
{
newCosts
+=
edge
.
calculateStandardEdgeCosts
();
if
(
knownInformation
!=
null
)
{
for
(
RoadInformation
roadInformation
:
actualKnownInformation
)
{
newCosts
+=
edge
.
calculateAdditionalCostIfKnown
(
roadInformation
.
getValue
());
}
for
(
RoadProperty
roadInformation
:
actualKnownInformation
)
{
newCosts
+=
edge
.
calculateAdditionalCostIfKnown
(
roadInformation
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment