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
90029522
Commit
90029522
authored
Jun 12, 2018
by
Tobias Meuser
Browse files
Current version
parent
ce5b0342
Changes
22
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/BumpProperty.java
View file @
90029522
...
...
@@ -47,6 +47,11 @@ public class BumpProperty extends AbstractRoadProperty {
return
new
BumpProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasBump
();
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
instanceof
BumpProperty
)
{
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/FogProperty.java
View file @
90029522
...
...
@@ -47,6 +47,11 @@ public class FogProperty extends AbstractRoadProperty {
return
new
FogProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasFog
();
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
instanceof
FogProperty
)
{
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/HazardProperty.java
View file @
90029522
...
...
@@ -47,6 +47,11 @@ public class HazardProperty extends AbstractRoadProperty {
return
new
HazardProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasHazard
();
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
instanceof
HazardProperty
)
{
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/RainProperty.java
View file @
90029522
...
...
@@ -47,6 +47,11 @@ public class RainProperty extends AbstractRoadProperty {
return
new
RainProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasRain
();
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
instanceof
RainProperty
)
{
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/RoadProperty.java
View file @
90029522
...
...
@@ -37,5 +37,7 @@ public interface RoadProperty extends LocationBasedEnvironmentProperty, Aggregat
long
getDetectionDate
();
Object
getValue
();
boolean
equalLocation
(
RoadProperty
pRoadProperty
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/TrafficSignProperty.java
View file @
90029522
...
...
@@ -47,6 +47,11 @@ public class TrafficSignProperty extends AbstractRoadProperty {
return
new
TrafficSignProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasSign
();
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
instanceof
TrafficSignProperty
)
{
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/VectoralProperty.java
View file @
90029522
...
...
@@ -307,6 +307,11 @@ public abstract class VectoralProperty extends AbstractRoadProperty implements C
}
}
@Override
public
Object
getValue
()
{
return
getMostProbableValue
();
}
@Override
public
String
toString
()
{
return
Arrays
.
toString
(
_valueProbabilities
);
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/VehicleProperty.java
View file @
90029522
...
...
@@ -48,6 +48,11 @@ public class VehicleProperty extends AbstractRoadProperty {
return
_speed
;
}
@Override
public
Object
getValue
()
{
return
getSpeed
();
}
@Override
public
EnvironmentProperty
getDefaultProperty
()
{
return
null
;
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/jam/JamProperty.java
View file @
90029522
...
...
@@ -86,6 +86,11 @@ public class JamProperty extends AbstractRoadProperty {
return
false
;
}
@Override
public
Object
getValue
()
{
return
getAverageSpeed
();
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
instanceof
JamProperty
)
{
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/jam/VectoralJamProperty.java
View file @
90029522
...
...
@@ -37,7 +37,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
*
*/
public
class
VectoralJamProperty
extends
NumericVectoralProperty
{
public
static
final
double
SCALING
=
6
;
public
static
final
double
SCALING
=
3
;
private
static
final
int
DIMENSIONS
=
15
;
// private static Map<Double, Double> _requiredStandardDeviation = new
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/roadcondition/RoadConditionProperty.java
View file @
90029522
...
...
@@ -52,6 +52,11 @@ public class RoadConditionProperty extends AbstractRoadProperty {
_roadCondition
=
pRoadCondition
;
}
@Override
public
Object
getValue
()
{
return
getRoadCondition
();
}
@Override
public
EnvironmentProperty
getDefaultProperty
()
{
return
new
RoadConditionProperty
(
getLocation
(),
getEdge
(),
RoadCondition
.
DRY
);
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/caching/CacheStateListener.java
0 → 100755
View file @
90029522
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.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.tudarmstadt.maki.simonstrator.api.component.vehicular.caching
;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
public
interface
CacheStateListener
{
void
entryStored
(
PointInformation
<?>
pEntry
);
void
entriesRemoved
(
List
<
PointInformation
>
pRemovedValues
,
PointInformation
pAggregate
);
}
\ No newline at end of file
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/caching/CachingComponent.java
View file @
90029522
...
...
@@ -57,8 +57,12 @@ public interface CachingComponent extends HostComponent, NodeInformation {
<
T
extends
PointInformation
>
void
partialClear
(
Class
<
T
>
pCacheEntryClass
,
Class
<?>
pCacheValueClass
,
RoadNetworkEdge
pEdge
);
void
performDecisionTransition
(
Class
<?
extends
CacheDecisionStrategy
>
pCacheDecisionStrategy
);
void
performDecisionTransition
(
Class
<?
extends
Object
>
pInformationClass
,
Class
<?
extends
CacheDecisionStrategy
>
pCacheDecisionStrategy
);
void
adjustCacheSizePerEntry
(
int
pMaxCacheSizePerEntry
);
void
adjustCacheSizePerEntry
(
Class
<?
extends
Object
>
pInformationClass
,
int
pMaxCacheSizePerEntry
);
void
setMaxSize
(
int
pMaxCacheSize
);
void
registerCacheStateListener
(
CacheStateListener
pListener
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/caching/decision/AbstractCacheDecisionStrategy.java
View file @
90029522
/*
* Copyright (c) 2005-2010 KOM Multimedia Communications Lab
* Copyright (c) 2005-2010 KOM
�
Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
...
...
@@ -52,4 +52,5 @@ public abstract class AbstractCacheDecisionStrategy implements CacheDecisionStra
}
}
public
abstract
CacheDecisionStrategy
clone
();
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/caching/decision/CacheDecisionStrategy.java
View file @
90029522
...
...
@@ -25,7 +25,7 @@ import java.util.List;
import
de.tudarmstadt.maki.simonstrator.api.component.transition.TransitionEnabled
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
public
interface
CacheDecisionStrategy
extends
TransitionEnabled
{
public
interface
CacheDecisionStrategy
extends
TransitionEnabled
,
Cloneable
{
<
T
extends
PointInformation
>
T
decideOnCorrectInformation
(
List
<
T
>
pSimilarPointInformation
);
@Override
...
...
@@ -37,4 +37,6 @@ public interface CacheDecisionStrategy extends TransitionEnabled {
default
void
stopMechanism
(
Callback
pCb
)
{
pCb
.
finished
(
true
);
}
CacheDecisionStrategy
clone
();
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/caching/decision/CacheSizeAwareCacheDecisionStrategy.java
View file @
90029522
...
...
@@ -20,8 +20,11 @@
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.caching.decision
;
import
de.tudarmstadt.maki.simonstrator.api.component.transition.MechanismState
;
public
interface
CacheSizeAwareCacheDecisionStrategy
extends
CacheDecisionStrategy
{
@MechanismState
(
value
=
"CacheSize"
)
void
setCacheSize
(
int
pCacheSize
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/caching/replacement/SimilarInformationReplacementStrategy.java
View file @
90029522
...
...
@@ -29,9 +29,6 @@ public class SimilarInformationReplacementStrategy implements CacheReplacementSt
@Override
public
boolean
replaceInformation
(
PointInformation
<?>
pCachedInformation
,
PointInformation
<?>
pSensedInformation
)
{
// if (Time.getCurrentTime() >= 195500000) {
// System.out.println();
// }
if
(
pCachedInformation
instanceof
AggregatedInformation
&&
pSensedInformation
instanceof
AggregatedInformation
)
{
AggregatedInformation
cachedAggregate
=
((
AggregatedInformation
)
pCachedInformation
);
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/relevance/impl/AbstractQoIBasedImpactFunction.java
View file @
90029522
...
...
@@ -26,6 +26,7 @@ import java.util.List;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.VectoralProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.AggregatedInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.AvailableInformationAttributes
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.relevance.ImpactFunction
;
...
...
@@ -78,6 +79,14 @@ public abstract class AbstractQoIBasedImpactFunction<T extends PointInformation>
if
(
timestamp
>
maxTimestamp
)
{
maxTimestamp
=
timestamp
;
}
if
(
pInformation
instanceof
AggregatedInformation
)
{
if
(((
AggregatedInformation
)
pInformation
).
isAggregated
())
{
long
temp
=
((
AggregatedInformation
)
pInformation
).
getAggregationInformation
().
getMinTimestamp
();
if
(
temp
<
minTimestamp
)
{
minTimestamp
=
temp
;
}
}
}
Object
currentValue
=
t
.
getValue
();
if
(
currentValue
instanceof
VectoralProperty
)
{
...
...
@@ -98,10 +107,19 @@ public abstract class AbstractQoIBasedImpactFunction<T extends PointInformation>
long
difference
=
maxTimestamp
-
minTimestamp
;
rate
=
difference
/
((
double
)
(
pInformation
.
size
()
-
1
)
*
SCALING
);
int
amount
=
0
;
for
(
T
t
:
pInformation
)
{
if
(
t
instanceof
AggregatedInformation
&&
((
AggregatedInformation
)
t
).
isAggregated
())
{
amount
+=
((
AggregatedInformation
)
t
).
getAggregationInformation
().
getNumberOfIndiviualMeasurements
();
}
else
{
amount
++;
}
}
ttl
=
getTTL
(
pInformation
.
get
(
0
));
numberOfMessages
=
ttl
/
rate
+
1
;
numberOfMessages
=
amount
*
ttl
/
(
difference
+
Time
.
SECOND
);
rate
=
ttl
/
(
double
)
numberOfMessages
;
List
<
Double
>
bValues
=
new
ArrayList
<>();
for
(
Object
possibleValue
:
possibleValues
)
{
...
...
@@ -175,6 +193,8 @@ public abstract class AbstractQoIBasedImpactFunction<T extends PointInformation>
}
else
{
return
0
;
}
}
else
if
(
b
==
Double
.
POSITIVE_INFINITY
)
{
return
1
;
}
return
(
1
-
errorProbability
)
*
(
Math
.
exp
(
b
*
age
)
-
Math
.
exp
(
b
*
pNumberOfMessages
))
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/relevance/impl/VectoralQoIBasedImpactFunction.java
View file @
90029522
...
...
@@ -68,6 +68,10 @@ public class VectoralQoIBasedImpactFunction<T extends PointInformation> extends
int
optimalAmount
=
getOptimalMessageAmountForSwitch
(
p_c
,
errorProbability
,
costSlow
,
costFast
);
if
(
maxCacheSize
<=
optimalAmount
)
{
return
Double
.
POSITIVE_INFINITY
;
}
if
((
int
)
pNumberOfMessages
<=
optimalAmount
)
{
return
Double
.
POSITIVE_INFINITY
;
}
...
...
@@ -168,7 +172,7 @@ public class VectoralQoIBasedImpactFunction<T extends PointInformation> extends
}
}
for
(
int
a
=
0
;
a
<=
Math
.
min
(
optimalMessageAmount
,
maxCacheSize
)
;
a
++)
{
for
(
int
a
=
0
;
a
<=
optimalMessageAmount
;
a
++)
{
VectoralProperty
jamProperty
=
pTemplate
.
clone
();
jamProperty
.
setGaussianWithAccuracy
(
pNewValue
,
accuracy
);
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/roadnetwork/RoadNetwork.java
View file @
90029522
...
...
@@ -22,13 +22,16 @@ package de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.api.EdgeController
;
public
class
RoadNetwork
{
public
class
RoadNetwork
implements
RoadNetworkEdgeListener
{
public
static
RoadNetwork
CURRENT_ROAD_NETWORK
;
private
Map
<
String
,
RoadNetworkEdge
>
_roadNetwork
;
...
...
@@ -37,10 +40,14 @@ public class RoadNetwork {
private
List
<
RoadNetworkEdge
>
_visibleEdges
=
null
;
private
Set
<
RoadNetworkEdge
>
_allEverActiveEdges
=
new
HashSet
<>();
public
RoadNetwork
(
SerializableRoadNetwork
pRoadNetwork
,
EdgeController
pEdgeController
)
{
_roadNetwork
=
new
HashMap
<>();
for
(
SerializableRoadNetworkEdge
edge
:
pRoadNetwork
.
getAvailableEdges
())
{
_roadNetwork
.
put
(
edge
.
getEdgeID
(),
new
RoadNetworkEdge
(
edge
,
pEdgeController
));
RoadNetworkEdge
roadNetworkEdge
=
new
RoadNetworkEdge
(
edge
,
pEdgeController
);
roadNetworkEdge
.
registerEdgeListener
(
this
);
_roadNetwork
.
put
(
edge
.
getEdgeID
(),
roadNetworkEdge
);
}
for
(
SerializableRoadNetworkEdge
edge
:
pRoadNetwork
.
getAvailableEdges
())
{
...
...
@@ -98,6 +105,10 @@ public class RoadNetwork {
return
_visibleEdges
;
}
public
Set
<
RoadNetworkEdge
>
getAllEverActiveEdges
()
{
return
_allEverActiveEdges
;
}
public
RoadNetworkEdge
getEdge
(
String
pEdge
)
{
return
_roadNetwork
.
get
(
pEdge
);
}
...
...
@@ -108,4 +119,14 @@ public class RoadNetwork {
public
boolean
hasChanged
()
{
return
_changed
;
}
@Override
public
void
edgeActivated
(
RoadNetworkEdge
pEdge
,
RoadProperty
pProperty
)
{
_allEverActiveEdges
.
add
(
pEdge
);
}
@Override
public
void
edgeDeactivated
(
RoadNetworkEdge
pEdge
,
RoadProperty
pProperty
)
{
}
}
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