Commit eff5d429 authored by Julian Zobel's avatar Julian Zobel 🦄
Browse files

Merge branch 'master' into 'cherry-pick-7698d9d7'

# Conflicts:
#   src/de/tud/kom/p2psim/impl/analyzer/metric/output/MetricOutputDAO.java
#   src/de/tud/kom/p2psim/impl/util/db/dao/DAO.java
parents 1c7f20ec 37020b44
...@@ -28,6 +28,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled ...@@ -28,6 +28,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
...@@ -69,6 +70,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno ...@@ -69,6 +70,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
...@@ -98,6 +100,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa ...@@ -98,6 +100,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,NORMAL,LOW org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,NORMAL,LOW
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>kom-deploy</id> <id>kom-deploy</id>
<url>scp://dev.kom.e-technik.tu-darmstadt.de/srv/www/dev/htdocs/mvn</url> <url>scp://dev.kom.e-technik.tu-darmstadt.de/mvn</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
...@@ -29,42 +29,12 @@ ...@@ -29,42 +29,12 @@
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
<encoding>UTF8</encoding> <encoding>UTF8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
<extensions> <extensions>
<!-- Enabling the use of SSH --> <!-- Enabling the use of SSH -->
...@@ -78,7 +48,7 @@ ...@@ -78,7 +48,7 @@
<repositories> <repositories>
<!-- simonstrator-repository --> <!-- simonstrator-repository -->
<repository> <repository>
<id>simonstrator</id> <id>simonstrator</id>
<url>https://dev.kom.e-technik.tu-darmstadt.de/mvn/</url> <url>https://dev.kom.e-technik.tu-darmstadt.de/mvn/</url>
...@@ -89,42 +59,44 @@ ...@@ -89,42 +59,44 @@
<updatePolicy>always</updatePolicy> <updatePolicy>always</updatePolicy>
</releases> </releases>
</repository> </repository>
<!-- local kom repository -->
<!-- <repository>
<id>maven.kom</id>
<url>http://www.kom.tu-darmstadt.de/~stingl/PeerfactSim.KOM-Libraries/maven2/</url>
</repository> -->
<!-- jgrapht can be found there -->
<repository> <repository>
<id>conjars.org</id> <id>Google Maven Central</id>
<url>http://conjars.org/repo</url> <url>https://maven-central.storage.googleapis.com/repos/central/data/</url>
</repository> <snapshots>
<updatePolicy>always</updatePolicy>
<!-- uk maven central, since the local central server is slow as hell --> </snapshots>
<repository> <releases>
<id>uk.maven.org</id> <updatePolicy>always</updatePolicy>
<url>http://uk.maven.org/maven2</url> </releases>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
<!-- XML --> <!-- XML -->
<!-- https://mvnrepository.com/artifact/javax.xml/jsr173 -->
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jsr173</artifactId>
<version>1.0</version>
</dependency>
<dependency> <dependency>
<groupId>dom4j</groupId> <groupId>org.glassfish.jaxb</groupId>
<artifactId>dom4j</artifactId> <artifactId>txw2</artifactId>
<version>1.6.1</version> <version>3.0.2</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/stax/stax -->
<dependency> <dependency>
<groupId>stax</groupId> <groupId>stax</groupId>
<artifactId>utils</artifactId> <artifactId>stax</artifactId>
<version>1.0.0</version> <version>1.2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>xerces</groupId> <groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId> <artifactId>xercesImpl</artifactId>
...@@ -137,15 +109,13 @@ ...@@ -137,15 +109,13 @@
<artifactId>batik-1.5-fop</artifactId> <artifactId>batik-1.5-fop</artifactId>
<version>0.20-5</version> <version>0.20-5</version>
</dependency> </dependency>
<!-- unused? <dependency> <groupId>batik</groupId> <artifactId>batik-parser</artifactId>
<version>1.5</version> </dependency> <dependency> <groupId>batik</groupId>
<artifactId>batik-awt-util</artifactId> <version>1.5</version> </dependency> -->
<!-- Testing --> <!-- Testing -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.0</version> <version>4.13</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit-addons</groupId> <groupId>junit-addons</groupId>
...@@ -153,15 +123,22 @@ ...@@ -153,15 +123,22 @@
<version>1.4</version> <version>1.4</version>
</dependency> </dependency>
<!-- Logging -->
<!-- unused <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <!-- Logging with Log4j -->
<version>1.6.1</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<artifactId>slf4j-api</artifactId> <version>1.6.1</version> </dependency> -->
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j-core</artifactId>
<version>1.2.16</version> <version>2.15.0</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.15.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api --> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
...@@ -170,13 +147,6 @@ ...@@ -170,13 +147,6 @@
</dependency> </dependency>
<!-- Parsing, Bytecode, ... -->
<!-- Unused <dependency> <groupId>antlr</groupId> <artifactId>antlr</artifactId>
<version>2.7.6</version> </dependency> <dependency> <groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId> <version>3.2</version> </dependency>
<dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId>
<version>3.12.0.GA</version> </dependency> -->
<!-- Geometric calculations --> <!-- Geometric calculations -->
<dependency> <dependency>
<groupId>com.vividsolutions</groupId> <groupId>com.vividsolutions</groupId>
...@@ -185,15 +155,14 @@ ...@@ -185,15 +155,14 @@
</dependency> </dependency>
<!-- Graphs --> <!-- Graphs -->
<dependency> <dependency>
<groupId>thirdparty</groupId> <groupId>org.jgrapht</groupId>
<artifactId>jgrapht-jdk1.6</artifactId> <artifactId>jgrapht-core</artifactId>
<version>0.8.2</version> <version>1.5.0</version>
</dependency> </dependency>
<!-- Chart creation --> <!-- Chart creation -->
<!-- unused? <dependency> <groupId>jfree</groupId> <artifactId>jcommon</artifactId>
<version>1.0.16</version> </dependency> -->
<dependency> <dependency>
<groupId>org.jfree</groupId> <groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId> <artifactId>jfreechart</artifactId>
...@@ -213,9 +182,12 @@ ...@@ -213,9 +182,12 @@
<version>4.3.10.Final</version> <version>4.3.10.Final</version>
</dependency> </dependency>
<!-- <dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> <dependency>
<version>3.7.2</version> </dependency> --> <groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.7.2</version>
</dependency>
<!-- Glab Database --> <!-- Glab Database -->
<dependency> <dependency>
<groupId>org.hsqldb</groupId> <groupId>org.hsqldb</groupId>
...@@ -239,13 +211,7 @@ ...@@ -239,13 +211,7 @@
<artifactId>commons-math3</artifactId> <artifactId>commons-math3</artifactId>
<version>3.6.1</version> <version>3.6.1</version>
</dependency> </dependency>
<!-- OLD Math for some outdated classes -->
<!-- <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
</dependency>-->
<dependency> <dependency>
<groupId>commons-net</groupId> <groupId>commons-net</groupId>
...@@ -259,31 +225,15 @@ ...@@ -259,31 +225,15 @@
</dependency> </dependency>
<!-- SimCfg, Xtext, EMF dependencies --> <!-- SimCfg, Xtext, EMF dependencies -->
<!-- unused <dependency> <groupId>org.eclipse</groupId> <artifactId>xtext</artifactId>
<version>2.3.0</version> </dependency> <dependency> <groupId>org.eclipse</groupId>
<artifactId>xtext.util</artifactId> <version>2.3.0</version> </dependency>
<dependency> <groupId>org.eclipse.emf</groupId> <artifactId>ecore</artifactId>
<version>2.8.1</version> </dependency> <dependency> <groupId>org.eclipse.emf</groupId>
<artifactId>ecore.xmi</artifactId> <version>2.8.0</version> </dependency>
<dependency> <groupId>org.eclipse.emf</groupId> <artifactId>ecore.xmi</artifactId>
<version>2.8.0</version> </dependency> <dependency> <groupId>org.eclipse.emf</groupId>
<artifactId>common</artifactId> <version>2.8.0</version> </dependency> <dependency>
<groupId>org.eclipse</groupId> <artifactId>xtext.common.types</artifactId>
<version>2.3.0</version> </dependency> <dependency> <groupId>org.eclipse</groupId>
<artifactId>xtext.util</artifactId> <version>2.3.0</version> </dependency>
<dependency> <groupId>org.eclipse.emf</groupId> <artifactId>mwe2.runtime</artifactId>
<version>2.3.0</version> </dependency> <dependency> <groupId>org.eclipse.emf</groupId>
<artifactId>mwe.core</artifactId> <version>1.2.1</version> </dependency>
<dependency> <groupId>org.eclipse.emf</groupId> <artifactId>mwe.utils</artifactId>
<version>1.2.1</version> </dependency> -->
<!-- Math --> <!-- Math -->
<!-- https://mvnrepository.com/artifact/ca.umontreal.iro.simul/ssj -->
<dependency> <dependency>
<groupId>umontreal.iro.lecuyer</groupId> <groupId>ca.umontreal.iro.simul</groupId>
<artifactId>ssj</artifactId> <artifactId>ssj</artifactId>
<version>1.1.9</version> <version>3.3.1</version>
</dependency> </dependency>
<!-- Date & Time calculations --> <!-- Date & Time calculations -->
<dependency> <dependency>
<groupId>joda-time</groupId> <groupId>joda-time</groupId>
...@@ -297,11 +247,7 @@ ...@@ -297,11 +247,7 @@
<artifactId>javax.inject</artifactId> <artifactId>javax.inject</artifactId>
<version>1</version> <version>1</version>
</dependency> </dependency>
<!-- unused <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId>
<version>1.0.4</version> </dependency> <dependency> <groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId> <version>1.2</version> </dependency>
<dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId>
<version>2.1</version> </dependency> -->
<dependency> <dependency>
<groupId>commons-lang</groupId> <groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
...@@ -313,17 +259,6 @@ ...@@ -313,17 +259,6 @@
<version>1.4.1</version> <version>1.4.1</version>
</dependency> </dependency>
<!-- <dependency> <groupId>com.baulsupp.kolja</groupId> <artifactId>jcurses</artifactId>
<version>0.9.5.3</version> </dependency> -->
<!-- Geodemlia -->
<!-- unused <dependency> <groupId>org.swinglabs</groupId> <artifactId>jxmapviewer</artifactId>
<version>1.0</version> </dependency> <dependency> <groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId> <version>1.6.1</version> </dependency> -->
<!-- JUNG Graph Library -->
<!-- unused<dependency> <groupId>net.sf.jung</groupId> <artifactId>jung2</artifactId>
<version>2.0.1</version> <type>pom</type> </dependency> -->
<dependency> <dependency>
<groupId>net.sf.jung</groupId> <groupId>net.sf.jung</groupId>
<artifactId>jung-api</artifactId> <artifactId>jung-api</artifactId>
...@@ -344,23 +279,20 @@ ...@@ -344,23 +279,20 @@
<artifactId>jung-io</artifactId> <artifactId>jung-io</artifactId>
<version>2.0.1</version> <version>2.0.1</version>
</dependency> </dependency>
<!-- unused <dependency> <groupId>net.sf.jung</groupId> <artifactId>jung-visualization</artifactId>
<version>2.0.1</version> </dependency> <dependency> <groupId>net.sf.jung</groupId> <!-- OSM-Data for movement models -->
<artifactId>jung-samples</artifactId> <version>2.0.1</version> </dependency> --> <dependency>
<groupId>com.graphhopper</groupId>
<!-- OSM-Data for movement models --> <artifactId>graphhopper-core</artifactId>
<dependency> <version>0.13.0</version>
<groupId>com.graphhopper</groupId>
<artifactId>graphhopper</artifactId>
<version>0.7.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.graphhopper</groupId>
<artifactId>graphhopper-reader-osm</artifactId>
<version>0.13.0</version>
</dependency>
<!-- Json (used for OSM-Movement-Model) --> <!-- Json (used for OSM-Movement-Model) -->
<dependency> <dependency>
<groupId>org.json</groupId> <groupId>org.json</groupId>
...@@ -368,7 +300,6 @@ ...@@ -368,7 +300,6 @@
<version>20140107</version> <version>20140107</version>
</dependency> </dependency>
<!-- Simonstrator-Platform --> <!-- Simonstrator-Platform -->
<dependency> <dependency>
<groupId>maki</groupId> <groupId>maki</groupId>
...@@ -380,8 +311,8 @@ ...@@ -380,8 +311,8 @@
<dependency> <dependency>
<groupId>maki</groupId> <groupId>maki</groupId>
<artifactId>simonstrator-traci</artifactId> <artifactId>simonstrator-traci</artifactId>
<version>0.1-SNAPSHOT</version> <version>0.2-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -94,4 +94,5 @@ public interface SimHost extends Host { ...@@ -94,4 +94,5 @@ public interface SimHost extends Host {
* binding with other layers, as these might have been null beforehand. * binding with other layers, as these might have been null beforehand.
*/ */
public void initialize(); public void initialize();
} }
...@@ -18,7 +18,9 @@ ...@@ -18,7 +18,9 @@
* *
*/ */
package de.tud.kom.p2psim.impl.energy; package de.tud.kom.p2psim.api.energy;
/** /**
* This interface implements basic methods used by the EnergyModel to simulate a * This interface implements basic methods used by the EnergyModel to simulate a
...@@ -29,6 +31,15 @@ package de.tud.kom.p2psim.impl.energy; ...@@ -29,6 +31,15 @@ package de.tud.kom.p2psim.impl.energy;
*/ */
public interface Battery extends Cloneable { public interface Battery extends Cloneable {
public static double uJconverison = 1000000;
/**
* Returns the maximum energy level in uJ.
*
* @return the maximum capacity of the battery in uJ
*/
public double getMaximumEnergy();
/** /**
* Returns the current status of the Battery as a Percentage-Value * Returns the current status of the Battery as a Percentage-Value
* *
...@@ -41,7 +52,7 @@ public interface Battery extends Cloneable { ...@@ -41,7 +52,7 @@ public interface Battery extends Cloneable {
* *
* @return the current capacity of the battery in uJ * @return the current capacity of the battery in uJ
*/ */
public double getCurrentEnergyLevel(); public double getCurrentEnergy();
/** /**
* Returns the consumed energy in uJoule * Returns the consumed energy in uJoule
...@@ -53,7 +64,16 @@ public interface Battery extends Cloneable { ...@@ -53,7 +64,16 @@ public interface Battery extends Cloneable {
/** /**
* Resets the Battery to the initial Energy-Level * Resets the Battery to the initial Energy-Level
*/ */
public void reset(); default public void reset() {
throw new UnsupportedOperationException();
}
/**
* Resets the Battery to the maximum (full) Energy-Level
*/
default public void setToMaximumLoad() {
throw new UnsupportedOperationException();
}
/** /**
* Sets the battery to a given percentage. * Sets the battery to a given percentage.
...@@ -85,4 +105,13 @@ public interface Battery extends Cloneable { ...@@ -85,4 +105,13 @@ public interface Battery extends Cloneable {
* @return * @return
*/ */
public Battery clone(); public Battery clone();
/**
* Returns true, if the battery is fully charged.
*
* @return
*/
public boolean isFullyCharged();
public Battery copy(double initialEnergy);
} }
...@@ -52,6 +52,10 @@ public enum ComponentType { ...@@ -52,6 +52,10 @@ public enum ComponentType {
/** /**
* Other components which consume energy * Other components which consume energy
*/ */
BASIC BASIC,
/**
* Actuators, Motors, Rotors
*/
ACTUATOR
} }
...@@ -21,14 +21,15 @@ ...@@ -21,14 +21,15 @@
package de.tud.kom.p2psim.api.energy; package de.tud.kom.p2psim.api.energy;
import de.tudarmstadt.maki.simonstrator.api.EventHandler; import de.tudarmstadt.maki.simonstrator.api.EventHandler;
import de.tudarmstadt.maki.simonstrator.api.Time;
/** /**
* A component that consumes energy (ie. a radio or a GPS-receiver). * A component that consumes energy (ie. a radio or a GPS-receiver).
* State-switching is event-based in this new version of the Model to allow more * State-switching is event-based in this new version of the Model to allow more
* fine-grained analyzing. * fine-grained analyzing.
* *
* @author Bjoern Richerzhagen * @author Bjoern Richerzhagen, Julian Zobel
* @version 1.0, 21.02.2012 * @version 1.1, 20.01.2020
*/ */
public interface EnergyComponent extends EventHandler { public interface EnergyComponent extends EventHandler {
...@@ -45,7 +46,7 @@ public interface EnergyComponent extends EventHandler { ...@@ -45,7 +46,7 @@ public interface EnergyComponent extends EventHandler {
* CommunicationComponent directly. Call goOffline() on the corresponding * CommunicationComponent directly. Call goOffline() on the corresponding
* Mac-Layer instead!</b> * Mac-Layer instead!</b>
*/ */
public void turnOff(); public boolean turnOff();
/** /**
* Generic method to activate a component. <b>DO NOT use this method on a * Generic method to activate a component. <b>DO NOT use this method on a
...@@ -72,5 +73,9 @@ public interface EnergyComponent extends EventHandler { ...@@ -72,5 +73,9 @@ public interface EnergyComponent extends EventHandler {
* @param listener * @param listener
*/ */
public void setEnergyEventListener(EnergyEventListener listener); public void setEnergyEventListener(EnergyEventListener listener);
default double calculateEnergyConsumation(EnergyState state, long timeInState) {
return state.getEnergyConsumption() * ( (double) timeInState / (double) Time.SECOND);
}
} }
...@@ -21,35 +21,26 @@ ...@@ -21,35 +21,26 @@
package de.tud.kom.p2psim.api.energy; package de.tud.kom.p2psim.api.energy;
/** /**
* The {@link EnergyModel} registers via this listener with each * This listener gives {@link EnergyComponent}s access to the {@link EnergyModel}.
* {@link EnergyComponent}.
* *
* @author Bjoern Richerzhagen * @author Julian Zobel
* @version 1.0, 27.02.2012 * @version 1.0, 07.09.2018
*/ */
public interface EnergyEventListener { public interface EnergyEventListener {
// TODO
/** /**
* Notify the Model that a component switched its state * Notify the energy model that a component has consumed energy.
* *
* @param component * @param component The energy component that has consumed energy.
* @param oldState * @param consumedEnergy The amount of energy that was consumed by that component (uJ)
* @param newState
* @param timeSpentInOldState
*/ */
public void switchedState(EnergyComponent component, EnergyState oldState, public void componentConsumedEnergy(EnergyComponent component, double consumedEnergy);
EnergyState newState, long timeSpentInOldState);
/** /**
* Allows the energy model to check, if a component is able to be turned on. * Allows a component to check, if it is able to be turned on.
* Return false, if the battery is empty or there is any other reason for
* the component not to be online.
* *
* @param component * @param component The energy component that is checked to be able to go online.
* @return * @return False if there is any reason, that the component cannot be turned on; true if it can be turned on.
*/ */
public boolean turnOn(EnergyComponent component); public boolean componentCanBeActivated(EnergyComponent component);
} }
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
package de.tud.kom.p2psim.api.energy; package de.tud.kom.p2psim.api.energy;
import de.tud.kom.p2psim.impl.energy.Battery;
/** /**
* This interface is exported by the {@link EnergyModel} of a host to allow * This interface is exported by the {@link EnergyModel} of a host to allow
* access to status information of the model and the battery. Within an * access to status information of the model and the battery. Within an
......
...@@ -55,7 +55,7 @@ public interface EnergyModel extends SimHostComponent { ...@@ -55,7 +55,7 @@ public interface EnergyModel extends SimHostComponent {
* *
* @return * @return
*/ */
public EnergyInfo getInfo(); public EnergyInfo getEnergyInfo();
/** /**
* Save some casting and use this method to return all components of the * Save some casting and use this method to return all components of the
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab * Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
* *
* This file is part of PeerfactSim.KOM. * This file is part of PeerfactSim.KOM.
* *
* PeerfactSim.KOM is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* PeerfactSim.KOM is distributed in the hope that it will be useful, * PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>. * along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
* *
...@@ -31,12 +31,16 @@ import de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.N ...@@ -31,12 +31,16 @@ import de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.N
* all parameter-related stuff has to be implemented in the {@link Link}. This * all parameter-related stuff has to be implemented in the {@link Link}. This
* enum is used throughout the new {@link LinkLayer} and also on application * enum is used throughout the new {@link LinkLayer} and also on application
* level if you want to explicitly specify which component to use. * level if you want to explicitly specify which component to use.
* *
* It provides basic defaults for MTU and Drop rates in the medium, which might * It provides basic defaults for MTU and Drop rates in the medium, which might
* be used inside the MacLayer or as part of a {@link Link} * be used inside the MacLayer or as part of a {@link Link}
* *
* @author Bjoern Richerzhagen * @author Bjoern Richerzhagen
* @version 1.0, 25.02.2012 * @version 1.0, 25.02.2012
*
* @author Julian Zobel
* added LoRa PHY
*
*/ */
public enum PhyType { public enum PhyType {
...@@ -44,16 +48,16 @@ public enum PhyType { ...@@ -44,16 +48,16 @@ public enum PhyType {
* Direct wireless connections between adjacent hosts or AP-based (decided * Direct wireless connections between adjacent hosts or AP-based (decided
* by the MAC/TopologyView used). Based on * by the MAC/TopologyView used). Based on
* "WiFi in Ad Hoc Mode: A Meaurement Study" by Anastasi et al. (2004), * "WiFi in Ad Hoc Mode: A Meaurement Study" by Anastasi et al. (2004),
* *
* Assuming the following defaults: 1% drop-rate of LinkLayer-Packets * Assuming the following defaults: 1% drop-rate of LinkLayer-Packets
* (LinkLayer might add retransmission behavior as in 802.11), 5MBit/s netto * (LinkLayer might add retransmission behavior as in 802.11), 5MBit/s netto
* (802.11b) BW, 500us latency, 2,2kB MTU, Broadcast * (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), 2334, true),
/** /**
* A wired connection based on a TopologyView * A wired connection based on a TopologyView
* *
* Assuming the following defaults: 0.1% link-layer loss, 100 Mbit/s, 1ms * Assuming the following defaults: 0.1% link-layer loss, 100 Mbit/s, 1ms
* Link-Latency, 1,5kB MTU * Link-Latency, 1,5kB MTU
*/ */
...@@ -71,14 +75,31 @@ public enum PhyType { ...@@ -71,14 +75,31 @@ public enum PhyType {
500 * Simulator.MICROSECOND_UNIT, 1472, false), 500 * Simulator.MICROSECOND_UNIT, 1472, false),
/** /**
* *
* Bluetooth, short-ranged wireless transmissions between adjacent hosts * Bluetooth, short-ranged wireless transmissions between adjacent hosts
* *
* Assuming the following defaults: zero link-layer packet loss, 3Mbit/s BW, * Assuming the following defaults: zero link-layer packet loss, 3Mbit/s BW,
* 500us latency, 1kByte MTU * 500us latency, 1kByte MTU
*/ */
BLUETOOTH(NetInterfaceName.BLUETOOTH, 0.0, 3 * Rate.Mbit_s, BLUETOOTH(NetInterfaceName.BLUETOOTH, 0.0, 3 * Rate.Mbit_s,
500 * Simulator.MICROSECOND_UNIT, 1024, true); 500 * Simulator.MICROSECOND_UNIT, 1024, true),
/**
* WiFi for UAV communication
*/
WIFI_UAV_NET(NetInterfaceName.WIFI_UAV_NET, 0.01, 5 * Rate.Mbit_s,
500 * Time.MICROSECOND, 2334, true),
/**
* LoRa for LPWAN communication
*
* Assuming the following defaults: zero link-layer packet loss, 0.3 kbit/s BW,
* 500us latency, 1kByte MTU
*/
LORA(NetInterfaceName.LORA, 0, 300 * Rate.bit_s,
500 * Time.MICROSECOND, 1024, true);
private double defaultDropProbability; private double defaultDropProbability;
...@@ -101,7 +122,7 @@ public enum PhyType { ...@@ -101,7 +122,7 @@ public enum PhyType {
private NetInterfaceName netInterfaceName; private NetInterfaceName netInterfaceName;
/** /**
* *
* @param defaultDropProbability * @param defaultDropProbability
* @param defaultRawBW * @param defaultRawBW
* bw in bit/s * bw in bit/s
...@@ -133,7 +154,7 @@ public enum PhyType { ...@@ -133,7 +154,7 @@ public enum PhyType {
/** /**
* The Default BW of a link (unidirectional) in bit/s * The Default BW of a link (unidirectional) in bit/s
* *
* @return * @return
*/ */
public long getDefaultBW() { public long getDefaultBW() {
...@@ -144,7 +165,7 @@ public enum PhyType { ...@@ -144,7 +165,7 @@ public enum PhyType {
* has to return true if the medium is by its nature a broadcast medium (ie. * has to return true if the medium is by its nature a broadcast medium (ie.
* sending a message will prohibit sending for all other hosts in range). If * sending a message will prohibit sending for all other hosts in range). If
* the medium supports Multiplexing such as UMTS, set this to false. * the medium supports Multiplexing such as UMTS, set this to false.
* *
* @return * @return
*/ */
public boolean isBroadcastMedium() { public boolean isBroadcastMedium() {
...@@ -153,7 +174,7 @@ public enum PhyType { ...@@ -153,7 +174,7 @@ public enum PhyType {
/** /**
* Long-term replacement of PHY * Long-term replacement of PHY
* *
* @return * @return
*/ */
public NetInterfaceName getNetInterfaceName() { public NetInterfaceName getNetInterfaceName() {
......
...@@ -35,7 +35,11 @@ public enum NetProtocol { ...@@ -35,7 +35,11 @@ public enum NetProtocol {
/** /**
* Common known IPv4 network protocol, with a 20 byte header * Common known IPv4 network protocol, with a 20 byte header
*/ */
IPv4(20); IPv4(20),
/**
* LoRaWAN with 12 byte header
*/
LORA(12);
private final int headerSize; private final int headerSize;
......
...@@ -25,7 +25,7 @@ import de.tud.kom.p2psim.api.topology.obstacles.ObstacleModel; ...@@ -25,7 +25,7 @@ import de.tud.kom.p2psim.api.topology.obstacles.ObstacleModel;
import de.tud.kom.p2psim.api.topology.social.SocialView; import de.tud.kom.p2psim.api.topology.social.SocialView;
import de.tud.kom.p2psim.api.topology.views.TopologyView; import de.tud.kom.p2psim.api.topology.views.TopologyView;
import de.tud.kom.p2psim.api.topology.waypoints.WaypointModel; import de.tud.kom.p2psim.api.topology.waypoints.WaypointModel;
import de.tud.kom.p2psim.impl.topology.PositionVector; import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tudarmstadt.maki.simonstrator.api.component.GlobalComponent; import de.tudarmstadt.maki.simonstrator.api.component.GlobalComponent;
/** /**
......
...@@ -43,7 +43,7 @@ public interface TopologyComponent extends SimHostComponent, ...@@ -43,7 +43,7 @@ public interface TopologyComponent extends SimHostComponent,
* *
* @return * @return
* @deprecated use Binder.getComponent(Topology.class) instead! * @deprecated use Binder.getComponent(Topology.class) instead!
*/ */
@Deprecated @Deprecated
public Topology getTopology(); public Topology getTopology();
......
/*
* 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.tud.kom.p2psim.api.topology.component;
import java.util.LinkedList;
import de.tud.kom.p2psim.impl.topology.component.BaseTopologyComponent;
import de.tud.kom.p2psim.impl.topology.placement.UAVBasePlacement;
import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tudarmstadt.maki.simonstrator.api.uavsupport.Actuator;
import de.tudarmstadt.maki.simonstrator.api.uavsupport.callbacks.BaseConnectedCallback;
import de.tudarmstadt.maki.simonstrator.api.uavsupport.callbacks.BaseDisconnectedCallback;
import de.tudarmstadt.maki.simonstrator.api.uavsupport.callbacks.BatteryReplacementCallback;
import de.tudarmstadt.maki.simonstrator.api.uavsupport.callbacks.ReachedLocationCallback;
/**
* A controllable location actuator, that can be turned on and off, gives access
* to the current location and battery levels, and also receives a location for
* a target that the actuator will then approach.
*
* @author Julian Zobel
*
*/
public interface ControllableLocationActuator extends Actuator {
public boolean isActive();
public boolean activate();
public boolean deactivate();
public PositionVector getCurrentLocation();
public PositionVector getCurrentDirection();
public PositionVector getBaseLocation();
public void updateCurrentDirection(PositionVector direction);
public double getCurrentBatteryLevel();
public double getCurrentBatteryEnergy();
public double getMaximumBatteryCapacity();
public LinkedList<PositionVector> getTargetLocations();
public void setTargetLocation(PositionVector targetLocation, ReachedLocationCallback cb);
public void addTargetLocation(PositionVector targetLocation, ReachedLocationCallback cb);
public void setTargetLocationRoute(LinkedList<PositionVector> route, ReachedLocationCallback cb);
public void removeAllTargetLocations();
public void batteryReplacement(BatteryReplacementCallback cb);
public void returnToBase(ReachedLocationCallback cb);
public void connectToBase(BaseConnectedCallback cb);
public void disconnectFromBase(BaseDisconnectedCallback cb);
public void setMovementSpeed(double speed);
public double getMinMovementSpeed();
public double getMaxMovementSpeed();
public double getMovementSpeed();
public double estimatePowerConsumptionWatt(double velocity);
public double estimateFlightDistance(double velocity, double batterylevel, double batterythreshold);
}
...@@ -23,7 +23,7 @@ package de.tud.kom.p2psim.api.topology.movement; ...@@ -23,7 +23,7 @@ package de.tud.kom.p2psim.api.topology.movement;
import java.util.Set; import java.util.Set;
import de.tud.kom.p2psim.api.topology.TopologyComponent; import de.tud.kom.p2psim.api.topology.TopologyComponent;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint; import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint;
/** /**
* A movement model for a group of {@link TopologyComponent}s. The movement * A movement model for a group of {@link TopologyComponent}s. The movement
...@@ -61,7 +61,7 @@ public interface MovementModel { ...@@ -61,7 +61,7 @@ public interface MovementModel {
* @param targetAttractionPoint * @param targetAttractionPoint
*/ */
default public void changeTargetLocation(SimLocationActuator actuator, default public void changeTargetLocation(SimLocationActuator actuator,
AttractionPoint targetAttractionPoint) IAttractionPoint targetAttractionPoint)
throws UnsupportedOperationException { throws UnsupportedOperationException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
...@@ -75,7 +75,7 @@ public interface MovementModel { ...@@ -75,7 +75,7 @@ public interface MovementModel {
* @param actuator * @param actuator
* @return target AttractionPoint * @return target AttractionPoint
*/ */
default public AttractionPoint getTargetLocation( default public IAttractionPoint getTargetLocation(
SimLocationActuator actuator) throws UnsupportedOperationException { SimLocationActuator actuator) throws UnsupportedOperationException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
...@@ -86,7 +86,7 @@ public interface MovementModel { ...@@ -86,7 +86,7 @@ public interface MovementModel {
* @return * @return
* @throws UnsupportedOperationException * @throws UnsupportedOperationException
*/ */
default public Set<AttractionPoint> getAllAttractionPoints() default public Set<IAttractionPoint> getAllAttractionPoints()
throws UnsupportedOperationException { throws UnsupportedOperationException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
package de.tud.kom.p2psim.api.topology.movement; package de.tud.kom.p2psim.api.topology.movement;
import de.tud.kom.p2psim.impl.topology.PositionVector; import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationActuator; import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationActuator;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationSensor; import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationSensor;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
package de.tud.kom.p2psim.api.topology.movement; package de.tud.kom.p2psim.api.topology.movement;
import de.tud.kom.p2psim.impl.topology.PositionVector; import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationActuator; import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationActuator;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationSensor; import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationSensor;
......
/*
* 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.api.topology.movement;
import de.tud.kom.p2psim.api.topology.component.ControllableLocationActuator;
import de.tud.kom.p2psim.impl.energy.components.StatefulActuatorComponent;
import de.tud.kom.p2psim.impl.energy.components.StatelessActuatorComponent;
public interface SimUAVLocationActuator extends SimLocationActuator, ControllableLocationActuator {
public UAVMovementModel getUAVMovement();
public void setUAVMovement(UAVMovementModel uavMovement);
}
/*
* 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.api.topology.movement;
import java.util.LinkedList;
import de.tud.kom.p2psim.impl.energy.components.ActuatorComponent;
import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tudarmstadt.maki.simonstrator.api.uavsupport.callbacks.ReachedLocationCallback;
/**
* UAV Movement Models provide basic functionality for the simulation of flying UAVs.
*
* @author Julian Zobel
* @version 1.0, 20.01.2020
*/
public interface UAVMovementModel {
// NO - NO CHANGY
public final double AIRDENSITY = 1.2045; // kg/m^3
public final double GRAVITY = 9.807; // m/s^2
public void setMotorControl(ActuatorComponent motor);
/**
* Set the preferred/target speed of this UAV.
*
* @param targetVelocity
*/
public void setTargetVelocity(double targetVelocity);
public double getVerticalAscentMaxVelocity();
public double getHorizontalMaxVelocity();
public double getCurrentVelocity();
public double getHorizontalMinVelocity();
/**
* Estimate the power consumption for a given velocity
* @param velocity
* @return The power consumption in W for the given velocity.
*/
public double estimatePowerConsumptionWatt(double velocity);
public void move(long timeBetweenMovementOperations);
public void setTargetLocation(PositionVector target, ReachedLocationCallback reachedLocationCallback);
public void setTargetLocationRoute(LinkedList<PositionVector> route, ReachedLocationCallback reachedLocationCallback);
public void addTargetLocation(PositionVector target, ReachedLocationCallback reachedLocationCallback);
/**
* Returns a copy of the current target locations
*
* @return
*/
public LinkedList<PositionVector> getTargetLocations();
public void removeTargetLocations();
}
...@@ -23,7 +23,7 @@ package de.tud.kom.p2psim.api.topology.movement.local; ...@@ -23,7 +23,7 @@ package de.tud.kom.p2psim.api.topology.movement.local;
import de.tud.kom.p2psim.api.topology.movement.SimLocationActuator; import de.tud.kom.p2psim.api.topology.movement.SimLocationActuator;
import de.tud.kom.p2psim.api.topology.obstacles.ObstacleModel; import de.tud.kom.p2psim.api.topology.obstacles.ObstacleModel;
import de.tud.kom.p2psim.api.topology.waypoints.WaypointModel; import de.tud.kom.p2psim.api.topology.waypoints.WaypointModel;
import de.tud.kom.p2psim.impl.topology.PositionVector; import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tud.kom.p2psim.impl.util.Either; import de.tud.kom.p2psim.impl.util.Either;
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment