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
API
Commits
6daa3597
Commit
6daa3597
authored
Oct 09, 2019
by
Tobias Meuser
Browse files
Update for diss
parent
b473db0c
Changes
22
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/Oracle.java
View file @
6daa3597
...
...
@@ -59,6 +59,11 @@ public final class Oracle {
public
List
<
Host
>
getAllHosts
()
{
return
null
;
}
@Override
public
Host
getHostByID
(
long
pValue
)
{
return
null
;
}
};
}
}
...
...
@@ -94,12 +99,7 @@ public final class Oracle {
* @return
*/
public
static
Host
getHostByID
(
INodeID
nodeId
)
{
for
(
Host
host
:
getAllHosts
())
{
if
(
host
.
getId
().
equals
(
nodeId
))
{
return
host
;
}
}
return
null
;
return
getOracle
().
getHostByID
(
nodeId
.
value
());
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/core/OracleComponent.java
View file @
6daa3597
...
...
@@ -43,6 +43,8 @@ public interface OracleComponent extends GlobalComponent {
*/
public
List
<
Host
>
getAllHosts
();
public
Host
getHostByID
(
long
pValue
);
/**
* Allows Overlays and Components to distinguish between real-world
* implementations and simulations - could be nifty for performance reasons
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/pubsub/
Cos
tBasedPubSubComponent.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/pubsub/
Impac
tBasedPubSubComponent.java
View file @
6daa3597
...
...
@@ -25,12 +25,15 @@ import java.util.List;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Attribute
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
public
interface
Cos
tBasedPubSubComponent
extends
PubSubComponent
{
public
interface
Impac
tBasedPubSubComponent
extends
PubSubComponent
{
public
Subscription
createSubscription
(
Topic
topic
,
Filter
filter
,
double
costs
);
public
Subscription
createSubscription
(
Topic
topic
,
Filter
filter
,
double
impact
);
public
Subscription
createSubscription
(
Topic
topic
,
Filter
filter
,
double
[]
costs
);
public
Subscription
createSubscription
(
Topic
topic
,
Filter
filter
,
double
[]
impact
);
public
Subscription
createSubscription
(
Topic
topic
,
Filter
filter
,
double
[]
impact
,
double
bandwidth
);
public
Notification
createNotification
(
Topic
topic
,
List
<
Attribute
<?>>
attributes
,
double
costs
,
byte
[]
payload
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/relevance/path/RoadNetworkPathComperator.java
View file @
6daa3597
...
...
@@ -9,6 +9,10 @@ public class RoadNetworkPathComperator implements Comparator<StatisticalRoadNetw
@Override
public
int
compare
(
StatisticalRoadNetworkRoute
pPath0
,
StatisticalRoadNetworkRoute
pPath1
)
{
return
-
Double
.
compare
(
pPath0
.
getProbability
(),
pPath1
.
getProbability
());
int
compare
=
Integer
.
compare
(
pPath0
.
getPath
().
getRoute
().
size
(),
pPath1
.
getPath
().
getRoute
().
size
());
if
(
compare
==
0
)
{
compare
=
-
Double
.
compare
(
pPath0
.
getProbability
(),
pPath1
.
getProbability
());
}
return
compare
;
}
}
\ No newline at end of file
src/de/tudarmstadt/maki/simonstrator/api/component/relevance/vehicular/VehicularRelevanceCalculationComponent.java
View file @
6daa3597
...
...
@@ -41,8 +41,8 @@ public interface VehicularRelevanceCalculationComponent extends HostComponent, R
PositionRepresentation
getPositionRepresentation
();
/**
* This method calculates the relevance of an event for a vehicle, combining
*
the
temporal and the geographical relevance.
* This method calculates the relevance of an event for a vehicle, combining
the
* temporal and the geographical relevance.
*
* @param pVehiclePosition
* The vehicle's position
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/costs/DefaultVehicularPropertyImpactEstimator.java
View file @
6daa3597
...
...
@@ -29,6 +29,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.pr
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RainProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.TrafficSignProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.VehicleProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.EnvironmentInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.RoadInformation
;
...
...
@@ -46,6 +47,8 @@ public class DefaultVehicularPropertyImpactEstimator implements VehicularPropert
return
Math
.
pow
(
10
,
3
);
}
else
if
(
pProperty
.
equals
(
TrafficSignProperty
.
class
))
{
return
10
;
}
else
if
(
pProperty
.
equals
(
VehicleProperty
.
class
))
{
return
0
;
}
return
10
;
}
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/jam/EventInformationContainer.java
View file @
6daa3597
...
...
@@ -25,6 +25,7 @@ import java.util.HashMap;
import
java.util.Map
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.generator.lifetime.LifetimeDistribution
;
/**
* @author Tobias Meuser (tobias.meuser@kom.tu-darmstadt.de)
...
...
@@ -33,6 +34,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.pr
*/
public
class
EventInformationContainer
{
private
static
Map
<
Class
<?
extends
RoadProperty
>,
Long
>
durations
=
new
HashMap
<>();
private
static
Map
<
Class
<?
extends
RoadProperty
>,
LifetimeDistribution
>
lifetimeDistribution
=
new
HashMap
<>();
private
static
Map
<
Class
<?
extends
RoadProperty
>,
Double
>
disseminationRange
=
new
HashMap
<>();
public
static
void
registerEventDuration
(
Class
<?
extends
RoadProperty
>
pClass
,
long
pDuration
)
{
...
...
@@ -51,6 +53,15 @@ public class EventInformationContainer {
}
}
public
static
void
registerEventLifetimeDistribution
(
Class
<?
extends
RoadProperty
>
pClass
,
LifetimeDistribution
pLifetimeDistribution
)
{
if
(!
lifetimeDistribution
.
containsKey
(
pClass
))
{
lifetimeDistribution
.
put
(
pClass
,
pLifetimeDistribution
);
}
else
{
throw
new
AssertionError
(
pClass
+
" has already been registered!"
);
}
}
public
static
long
getEventDuration
(
Class
<?
extends
RoadProperty
>
pClass
)
{
if
(
durations
.
containsKey
(
pClass
))
{
return
durations
.
get
(
pClass
);
...
...
@@ -64,4 +75,11 @@ public class EventInformationContainer {
}
return
Double
.
POSITIVE_INFINITY
;
}
public
static
LifetimeDistribution
getEventLifetimeDistribution
(
Class
<?
extends
RoadProperty
>
pClass
)
{
if
(
lifetimeDistribution
.
containsKey
(
pClass
))
{
return
lifetimeDistribution
.
get
(
pClass
);
}
return
null
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/BumpProperty.java
View file @
6daa3597
...
...
@@ -54,7 +54,10 @@ public class BumpProperty extends AbstractRoadProperty {
@Override
public
BumpProperty
clone
()
{
return
new
BumpProperty
(
getLocation
(),
getEdge
(),
_bump
);
BumpProperty
property
=
new
BumpProperty
(
getLocation
(),
getEdge
(),
_bump
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/FogProperty.java
View file @
6daa3597
...
...
@@ -54,6 +54,9 @@ public class FogProperty extends AbstractRoadProperty {
@Override
public
FogProperty
clone
()
{
return
new
FogProperty
(
getLocation
(),
getEdge
(),
_fog
);
FogProperty
property
=
new
FogProperty
(
getLocation
(),
getEdge
(),
_fog
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/HazardProperty.java
View file @
6daa3597
...
...
@@ -59,7 +59,10 @@ public class HazardProperty extends AbstractRoadProperty {
@Override
public
HazardProperty
clone
()
{
return
new
HazardProperty
(
getLocation
(),
getEdge
(),
_hazard
);
HazardProperty
property
=
new
HazardProperty
(
getLocation
(),
getEdge
(),
_hazard
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/RainProperty.java
View file @
6daa3597
...
...
@@ -54,6 +54,9 @@ public class RainProperty extends AbstractRoadProperty {
@Override
public
RainProperty
clone
()
{
return
new
RainProperty
(
getLocation
(),
getEdge
(),
_rain
);
RainProperty
property
=
new
RainProperty
(
getLocation
(),
getEdge
(),
_rain
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/TrafficSignProperty.java
View file @
6daa3597
...
...
@@ -54,6 +54,9 @@ public class TrafficSignProperty extends AbstractRoadProperty {
@Override
public
TrafficSignProperty
clone
()
{
return
new
TrafficSignProperty
(
getLocation
(),
getEdge
(),
_sign
);
TrafficSignProperty
property
=
new
TrafficSignProperty
(
getLocation
(),
getEdge
(),
_sign
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/vectoral/VectoralJamProperty.java
View file @
6daa3597
...
...
@@ -82,6 +82,7 @@ public class VectoralJamProperty extends NumericVectoralProperty {
VectoralJamProperty
vectoralJamProperty
=
new
VectoralJamProperty
(
getLocation
(),
getEdge
());
vectoralJamProperty
.
setProbabilities
(
Arrays
.
copyOf
(
getValueProbabilities
(),
getValueProbabilities
().
length
));
vectoralJamProperty
.
setDetectionDate
(
getDetectionDate
());
vectoralJamProperty
.
setDuration
(
getDuration
());
return
vectoralJamProperty
;
}
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/roadcondition/RoadConditionProperty.java
View file @
6daa3597
...
...
@@ -64,7 +64,10 @@ public class RoadConditionProperty extends AbstractRoadProperty {
@Override
public
RoadConditionProperty
clone
()
{
return
new
RoadConditionProperty
(
getLocation
(),
getEdge
(),
_roadCondition
);
RoadConditionProperty
property
=
new
RoadConditionProperty
(
getLocation
(),
getEdge
(),
_roadCondition
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/roadcondition/VectoralRoadConditionProperty.java
View file @
6daa3597
...
...
@@ -71,6 +71,7 @@ public class VectoralRoadConditionProperty extends VectoralProperty {
VectoralRoadConditionProperty
vectoralJamProperty
=
new
VectoralRoadConditionProperty
(
getLocation
(),
getEdge
());
vectoralJamProperty
.
setProbabilities
(
Arrays
.
copyOf
(
getValueProbabilities
(),
getValueProbabilities
().
length
));
vectoralJamProperty
.
setDetectionDate
(
getDetectionDate
());
vectoralJamProperty
.
setDuration
(
getDuration
());
return
vectoralJamProperty
;
}
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/generator/lifetime/DeterministicExponentialLifetimeDistribution.java
View file @
6daa3597
...
...
@@ -56,4 +56,9 @@ public class DeterministicExponentialLifetimeDistribution implements LifetimeDis
public
long
getAverageLifetime
()
{
return
_averageEventDuration
;
}
@Override
public
double
getProbabilityForLifetime
(
long
pLifetime
)
{
return
Math
.
pow
(
_existProbability
,
pLifetime
/
Time
.
SECOND
);
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/generator/lifetime/ExponentialLifetimeDistribution.java
View file @
6daa3597
...
...
@@ -57,4 +57,9 @@ public class ExponentialLifetimeDistribution implements LifetimeDistribution {
public
long
getAverageLifetime
()
{
return
_averageEventDuration
;
}
@Override
public
double
getProbabilityForLifetime
(
long
pLifetime
)
{
return
Math
.
pow
(
_existProbability
,
pLifetime
/
_granularity
);
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/generator/lifetime/GaussianLifetimeDistribution.java
View file @
6daa3597
...
...
@@ -22,6 +22,8 @@ package de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.genera
import
java.util.Random
;
import
org.apache.commons.math3.special.Erf
;
import
de.tudarmstadt.maki.simonstrator.api.Randoms
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
...
...
@@ -49,4 +51,14 @@ public class GaussianLifetimeDistribution implements LifetimeDistribution {
public
long
getAverageLifetime
()
{
return
_averageEventDuration
;
}
@Override
public
double
getProbabilityForLifetime
(
long
pLifetime
)
{
double
average
=
_averageEventDuration
/
(
double
)
Time
.
SECOND
;
double
standardDeviation
=
_standardDeviationEventDuration
/
(
double
)
Time
.
SECOND
;
double
age
=
pLifetime
/
(
double
)
Time
.
SECOND
;
double
parameter
=
(
average
-
age
)
/
(
Math
.
sqrt
(
2
)
*
standardDeviation
);
return
1
-
0.5
*
Erf
.
erfc
(
parameter
);
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/generator/lifetime/LifetimeDistribution.java
View file @
6daa3597
...
...
@@ -24,4 +24,6 @@ public interface LifetimeDistribution {
long
getLifetime
();
long
getAverageLifetime
();
double
getProbabilityForLifetime
(
long
pLifetime
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/information/AvailableInformationAttributes.java
View file @
6daa3597
...
...
@@ -30,7 +30,8 @@ public enum AvailableInformationAttributes {
"edge"
,
RoadNetworkEdge
.
class
),
TTL
(
"ttl"
,
Long
.
class
),
EXPECTED_DURATION
(
"duration"
,
Long
.
class
),
STANDARD_DEVIATION_DURATION
(
"sd_duration"
),
TYPE
(
"type"
,
SiSType
.
class
),
COST
(
"cost"
,
Double
.
class
);
"sd_duration"
),
TYPE
(
"type"
,
SiSType
.
class
),
COST
(
"cost"
,
Double
.
class
),
FORWARDER
(
"forwarder"
,
INodeID
.
class
);
private
final
String
attributeID
;
private
final
Class
<?
extends
Object
>
clazz
;
...
...
Prev
1
2
Next
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