changed simulation time from int to long to support very long simulations
This commit is contained in:
parent
aae4b54c68
commit
37b40f99c7
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: MspMote.java,v 1.17 2008/12/04 13:14:34 fros4943 Exp $
|
||||
* $Id: MspMote.java,v 1.18 2008/12/04 14:03:41 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.mspmote;
|
||||
|
@ -296,7 +296,7 @@ public abstract class MspMote implements Mote {
|
|||
/* return false when done - e.g. true means more work to do before finished with this tick */
|
||||
|
||||
private boolean firstTick = true;
|
||||
public boolean tick(int simTime) {
|
||||
public boolean tick(long simTime) {
|
||||
if (stopNextInstruction) {
|
||||
stopNextInstruction = false;
|
||||
throw new RuntimeException("MSPSim requested simulation stop");
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: MspClock.java,v 1.5 2008/12/04 13:08:55 fros4943 Exp $
|
||||
* $Id: MspClock.java,v 1.6 2008/12/04 14:03:41 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.mspmote.interfaces;
|
||||
|
@ -56,11 +56,11 @@ public class MspClock extends Clock {
|
|||
cpu = myMote.getCPU();
|
||||
}
|
||||
|
||||
public void setTime(int newTime) {
|
||||
public void setTime(long newTime) {
|
||||
logger.fatal("Can't change emulated CPU time");
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
public long getTime() {
|
||||
int time = (int) ((cpu.cycles + myMote.cycleDrift) / MspMote.NR_CYCLES_PER_MSEC);
|
||||
return time > 0 ? time : 0;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: MspIPAddress.java,v 1.1 2008/12/03 13:11:20 fros4943 Exp $
|
||||
* $Id: MspIPAddress.java,v 1.2 2008/12/04 14:03:41 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.mspmote.interfaces;
|
||||
|
@ -57,7 +57,7 @@ public class MspIPAddress extends IPAddress {
|
|||
this.moteMem = (MspMoteMemory) mote.getMemory();
|
||||
|
||||
TimeEvent updateWhenAddressReady = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
if (getIPString().equals("0.0.0.0")) {
|
||||
MspIPAddress.this.mote.getSimulation().scheduleEvent(
|
||||
this,
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: MspMoteID.java,v 1.8 2008/10/29 08:35:38 fros4943 Exp $
|
||||
* $Id: MspMoteID.java,v 1.9 2008/12/04 14:03:41 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.mspmote.interfaces;
|
||||
|
@ -123,7 +123,7 @@ public class MspMoteID extends MoteID {
|
|||
}
|
||||
|
||||
private TimeEvent persistentSetIDEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
|
||||
if (persistentSetIDCounter-- > 0)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: SkyByteRadio.java,v 1.4 2008/11/03 12:31:33 fros4943 Exp $
|
||||
* $Id: SkyByteRadio.java,v 1.5 2008/12/04 14:03:41 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.mspmote.interfaces;
|
||||
|
@ -59,7 +59,7 @@ import se.sics.mspsim.chip.CC2420.StateListener;
|
|||
public class SkyByteRadio extends Radio implements CustomDataRadio {
|
||||
private static Logger logger = Logger.getLogger(SkyByteRadio.class);
|
||||
|
||||
private int lastEventTime = 0;
|
||||
private long lastEventTime = 0;
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class SkyByteRadio extends Radio implements CustomDataRadio {
|
|||
private byte[] crossBufferedData = null;
|
||||
|
||||
private TimeEvent receiveCrosslevelDataEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
|
||||
if (crossBufferedData == null) {
|
||||
return;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: SkySerial.java,v 1.7 2008/12/04 13:09:27 fros4943 Exp $
|
||||
* $Id: SkySerial.java,v 1.8 2008/12/04 14:03:41 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.mspmote.interfaces;
|
||||
|
@ -151,7 +151,8 @@ public class SkySerial extends Log implements SerialPort, USARTListener {
|
|||
}
|
||||
|
||||
private TimeEvent writeDataEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
/* TODO Implement MSPSim callback - better timing */
|
||||
tryWriteNextByte();
|
||||
if (!incomingData.isEmpty()) {
|
||||
mote.getSimulation().scheduleEvent(this, t+1);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: TR1001Radio.java,v 1.8 2008/12/03 13:14:07 fros4943 Exp $
|
||||
* $Id: TR1001Radio.java,v 1.9 2008/12/04 14:03:41 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.mspmote.interfaces;
|
||||
|
@ -70,7 +70,7 @@ public class TR1001Radio extends Radio implements USARTListener, CustomDataRadio
|
|||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
private int lastEventTime = 0;
|
||||
private long lastEventTime = 0;
|
||||
|
||||
private USART radioUSART = null;
|
||||
|
||||
|
@ -379,7 +379,7 @@ public class TR1001Radio extends Radio implements USARTListener, CustomDataRadio
|
|||
}
|
||||
|
||||
private TimeEvent followupTransmissionEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
|
||||
if (isTransmitting()) {
|
||||
ticksSinceLastSend++;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: MspStackWatcher.java,v 1.4 2008/10/03 15:18:48 fros4943 Exp $
|
||||
* $Id: MspStackWatcher.java,v 1.5 2008/12/04 14:03:41 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.mspmote.plugins;
|
||||
|
@ -103,7 +103,7 @@ public class MspStackWatcher extends VisPlugin {
|
|||
});
|
||||
|
||||
// Create nfi's stack viewer
|
||||
final StackUI stackUI = new StackUI(cpu, MspMote.NR_CYCLES_PER_MSEC);
|
||||
final StackUI stackUI = new StackUI(cpu, (int)MspMote.NR_CYCLES_PER_MSEC);
|
||||
|
||||
// Register as log listener
|
||||
/*if (logObserver == null && mspMote.getInterfaces().getLog() != null) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: EventQueue.java,v 1.1 2008/10/28 12:52:24 fros4943 Exp $
|
||||
* $Id: EventQueue.java,v 1.2 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja;
|
||||
|
@ -37,13 +37,13 @@ package se.sics.cooja;
|
|||
public class EventQueue {
|
||||
|
||||
private TimeEvent first;
|
||||
private int nextTime;
|
||||
private long nextTime;
|
||||
private int eventCount = 0;
|
||||
|
||||
public EventQueue() {
|
||||
}
|
||||
|
||||
public void addEvent(TimeEvent event, int time) {
|
||||
public void addEvent(TimeEvent event, long time) {
|
||||
event.time = time;
|
||||
addEvent(event);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: Mote.java,v 1.5 2008/03/31 15:22:42 fros4943 Exp $
|
||||
* $Id: Mote.java,v 1.6 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja;
|
||||
|
@ -179,7 +179,7 @@ public interface Mote {
|
|||
* New simulation time
|
||||
* @return True is mote accepts another immediate tick
|
||||
*/
|
||||
public boolean tick(int simTime);
|
||||
public boolean tick(long simTime);
|
||||
|
||||
/**
|
||||
* Returns XML elements representing the current config of this mote. This is
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: Simulation.java,v 1.33 2008/12/04 13:04:26 fros4943 Exp $
|
||||
* $Id: Simulation.java,v 1.34 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja;
|
||||
|
@ -54,7 +54,7 @@ public class Simulation extends Observable implements Runnable {
|
|||
|
||||
private int delayTime = 5;
|
||||
|
||||
private int currentSimulationTime = 0;
|
||||
private long currentSimulationTime = 0;
|
||||
|
||||
private int tickTime = 1;
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class Simulation extends Observable implements Runnable {
|
|||
* @param e Event
|
||||
* @param time Simulated time
|
||||
*/
|
||||
public void scheduleEvent(TimeEvent e, int time) {
|
||||
public void scheduleEvent(TimeEvent e, long time) {
|
||||
eventQueue.addEvent(e, time);
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class Simulation extends Observable implements Runnable {
|
|||
|
||||
private Mote[] mspMoteArray;
|
||||
private TimeEvent tickMspMotesEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
/*logger.info("MSP motes tick at: " + t);*/
|
||||
|
||||
/* Tick MSP motes */
|
||||
|
@ -147,7 +147,7 @@ public class Simulation extends Observable implements Runnable {
|
|||
|
||||
private Mote[] moteArray;
|
||||
private TimeEvent tickMotesEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
/*logger.info("Contiki motes tick at: " + t);*/
|
||||
|
||||
/* Tick Contiki motes */
|
||||
|
@ -161,7 +161,7 @@ public class Simulation extends Observable implements Runnable {
|
|||
};
|
||||
|
||||
private TimeEvent delayEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
/*logger.info("Delay at: " + t);*/
|
||||
|
||||
if (delayTime > 0) {
|
||||
|
@ -685,7 +685,7 @@ public class Simulation extends Observable implements Runnable {
|
|||
*
|
||||
* @return Simulation time (ms)
|
||||
*/
|
||||
public int getSimulationTime() {
|
||||
public long getSimulationTime() {
|
||||
return currentSimulationTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: TimeEvent.java,v 1.1 2008/10/28 12:51:22 fros4943 Exp $
|
||||
* $Id: TimeEvent.java,v 1.2 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja;
|
||||
|
@ -43,18 +43,18 @@ public abstract class TimeEvent {
|
|||
EventQueue scheduledIn = null;
|
||||
String name;
|
||||
|
||||
protected int time;
|
||||
protected long time;
|
||||
|
||||
public TimeEvent(int time) {
|
||||
public TimeEvent(long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public TimeEvent(int time, String name) {
|
||||
public TimeEvent(long time, String name) {
|
||||
this.time = time;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public final int getTime() {
|
||||
public final long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public abstract class TimeEvent {
|
|||
return false;
|
||||
}
|
||||
|
||||
public abstract void execute(int t);
|
||||
public abstract void execute(long t);
|
||||
|
||||
public String getShort() {
|
||||
return "" + time + (name != null ? ": " + name : "");
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ContikiMote.java,v 1.8 2008/10/28 12:05:30 fros4943 Exp $
|
||||
* $Id: ContikiMote.java,v 1.9 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.contikimote;
|
||||
|
@ -176,7 +176,7 @@ public class ContikiMote implements Mote {
|
|||
*
|
||||
* @param simTime Current simulation time
|
||||
*/
|
||||
public boolean tick(int simTime) {
|
||||
public boolean tick(long simTime) {
|
||||
State currentState = getState();
|
||||
|
||||
// If mote is dead, do nothing at all
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ContikiBeeper.java,v 1.7 2008/10/28 13:37:11 fros4943 Exp $
|
||||
* $Id: ContikiBeeper.java,v 1.8 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.contikimote.interfaces;
|
||||
|
@ -102,7 +102,7 @@ public class ContikiBeeper extends Beeper implements ContikiMoteInterface, Polle
|
|||
}
|
||||
|
||||
private TimeEvent stopBeepEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
myEnergyConsumption = 0.0;
|
||||
}
|
||||
};
|
||||
|
@ -135,7 +135,7 @@ public class ContikiBeeper extends Beeper implements ContikiMoteInterface, Polle
|
|||
return;
|
||||
}
|
||||
|
||||
int currentTime = mote.getSimulation().getSimulationTime();
|
||||
long currentTime = mote.getSimulation().getSimulationTime();
|
||||
statusLabel.setText("Last beep at time: " + currentTime);
|
||||
|
||||
/* Beep on speakers */
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ContikiButton.java,v 1.9 2008/10/28 13:37:11 fros4943 Exp $
|
||||
* $Id: ContikiButton.java,v 1.10 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.contikimote.interfaces;
|
||||
|
@ -85,7 +85,7 @@ public class ContikiButton extends Button implements ContikiMoteInterface {
|
|||
}
|
||||
|
||||
private TimeEvent releaseButtonEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
|
||||
/* Force mote awake when button is down */
|
||||
mote.setState(Mote.State.ACTIVE);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ContikiCFS.java,v 1.7 2008/10/28 13:37:11 fros4943 Exp $
|
||||
* $Id: ContikiCFS.java,v 1.8 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.contikimote.interfaces;
|
||||
|
@ -110,7 +110,7 @@ public class ContikiCFS extends MoteInterface implements ContikiMoteInterface, P
|
|||
}
|
||||
|
||||
private TimeEvent doneEvent = new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
myEnergyConsumption = 0.0;
|
||||
}
|
||||
};
|
||||
|
@ -203,7 +203,7 @@ public class ContikiCFS extends MoteInterface implements ContikiMoteInterface, P
|
|||
Observer observer;
|
||||
this.addObserver(observer = new Observer() {
|
||||
public void update(Observable obs, Object obj) {
|
||||
int currentTime = mote.getSimulation().getSimulationTime();
|
||||
long currentTime = mote.getSimulation().getSimulationTime();
|
||||
lastTimeLabel.setText("Last change at time: " + currentTime);
|
||||
lastReadLabel.setText("Last change read bytes: " + getLastReadCount());
|
||||
lastWrittenLabel.setText("Last change wrote bytes: " + getLastWrittenCount());
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ContikiClock.java,v 1.6 2008/10/29 08:36:40 fros4943 Exp $
|
||||
* $Id: ContikiClock.java,v 1.7 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.contikimote.interfaces;
|
||||
|
@ -80,8 +80,9 @@ public class ContikiClock extends Clock implements ContikiMoteInterface, PolledB
|
|||
return new String[]{"clock_interface"};
|
||||
}
|
||||
|
||||
public void setTime(int newTime) {
|
||||
moteMem.setIntValueOf("simCurrentTime", newTime);
|
||||
public void setTime(long newTime) {
|
||||
/* TODO: check if this is correct even if newTime > MAX_INT */
|
||||
moteMem.setIntValueOf("simCurrentTime", (int)newTime);
|
||||
}
|
||||
|
||||
public void setDrift(int timeDrift) {
|
||||
|
@ -92,13 +93,13 @@ public class ContikiClock extends Clock implements ContikiMoteInterface, PolledB
|
|||
return timeDrift;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
public long getTime() {
|
||||
return moteMem.getIntValueOf("simCurrentTime");
|
||||
}
|
||||
|
||||
public void doActionsBeforeTick() {
|
||||
/* Update time */
|
||||
int moteTime = mote.getSimulation().getSimulationTime() + timeDrift;
|
||||
long moteTime = mote.getSimulation().getSimulationTime() + timeDrift;
|
||||
|
||||
if (moteTime > 0) {
|
||||
setTime(moteTime);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ContikiRadio.java,v 1.23 2008/10/28 15:31:51 fros4943 Exp $
|
||||
* $Id: ContikiRadio.java,v 1.24 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.contikimote.interfaces;
|
||||
|
@ -121,11 +121,11 @@ public class ContikiRadio extends Radio implements ContikiMoteInterface, PolledA
|
|||
|
||||
private boolean isInterfered = false;
|
||||
|
||||
private int transmissionEndTime = -1;
|
||||
private long transmissionEndTime = -1;
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
private int lastEventTime = 0;
|
||||
private long lastEventTime = 0;
|
||||
|
||||
private int oldOutputPowerIndicator = -1;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: CreateSimDialog.java,v 1.13 2008/10/29 10:36:58 fros4943 Exp $
|
||||
* $Id: CreateSimDialog.java,v 1.14 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.dialogs;
|
||||
|
@ -127,7 +127,7 @@ public class CreateSimDialog extends JDialog {
|
|||
myDialog.delayTime.setValue(new Integer(simulationToConfigure.getDelayTime()));
|
||||
|
||||
// Set simulation time
|
||||
myDialog.simulationTime.setValue(new Integer(simulationToConfigure.getSimulationTime()));
|
||||
myDialog.simulationTime.setValue(new Long(simulationToConfigure.getSimulationTime()));
|
||||
|
||||
// Select radio medium
|
||||
if (simulationToConfigure.getRadioMedium() != null) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ApplicationRadio.java,v 1.6 2008/10/28 12:59:30 fros4943 Exp $
|
||||
* $Id: ApplicationRadio.java,v 1.7 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.interfaces;
|
||||
|
@ -59,10 +59,10 @@ public class ApplicationRadio extends Radio implements PolledBeforeActiveTicks {
|
|||
private boolean isReceiving = false;
|
||||
private boolean isInterfered = false;
|
||||
|
||||
private int transmissionEndTime = 0;
|
||||
private long transmissionEndTime = 0;
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
private int lastEventTime = 0;
|
||||
private long lastEventTime = 0;
|
||||
|
||||
private boolean outPacketExists = false;
|
||||
private RadioPacket outPacket = null;
|
||||
|
@ -126,7 +126,7 @@ public class ApplicationRadio extends Radio implements PolledBeforeActiveTicks {
|
|||
return isTransmitting;
|
||||
}
|
||||
|
||||
public int getTransmissionEndTime() {
|
||||
public long getTransmissionEndTime() {
|
||||
return transmissionEndTime;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ public class ApplicationRadio extends Radio implements PolledBeforeActiveTicks {
|
|||
}
|
||||
|
||||
public void doActionsBeforeTick() {
|
||||
int currentTime = myMote.getSimulation().getSimulationTime();
|
||||
long currentTime = myMote.getSimulation().getSimulationTime();
|
||||
|
||||
if (outPacketExists) {
|
||||
outPacketExists = false;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: Clock.java,v 1.3 2008/10/29 08:37:42 fros4943 Exp $
|
||||
* $Id: Clock.java,v 1.4 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.interfaces;
|
||||
|
@ -49,12 +49,12 @@ public abstract class Clock extends MoteInterface {
|
|||
*
|
||||
* @param newTime Time
|
||||
*/
|
||||
public abstract void setTime(int newTime);
|
||||
public abstract void setTime(long newTime);
|
||||
|
||||
/**
|
||||
* @return Current time
|
||||
*/
|
||||
public abstract int getTime();
|
||||
public abstract long getTime();
|
||||
|
||||
/**
|
||||
* Set time drift.
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: DisturberMote.java,v 1.4 2008/10/28 13:39:24 fros4943 Exp $
|
||||
* $Id: DisturberMote.java,v 1.5 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.motes;
|
||||
|
@ -141,7 +141,7 @@ public class DisturberMote implements Mote {
|
|||
this.mySim = simulation;
|
||||
}
|
||||
|
||||
public boolean tick(int simTime) {
|
||||
public boolean tick(long simTime) {
|
||||
myInterfaceHandler.doPassiveActionsBeforeTick();
|
||||
myInterfaceHandler.doActiveActionsBeforeTick();
|
||||
myInterfaceHandler.doActiveActionsAfterTick();
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: DisturberRadio.java,v 1.8 2008/10/28 13:39:24 fros4943 Exp $
|
||||
* $Id: DisturberRadio.java,v 1.9 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.motes;
|
||||
|
@ -58,11 +58,11 @@ public class DisturberRadio extends Radio {
|
|||
|
||||
private int distChannel = -1; // channel mote is disturbing
|
||||
|
||||
private int transEndTime = 0;
|
||||
private long transEndTime = 0;
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
private int lastEventTime = 0;
|
||||
private long lastEventTime = 0;
|
||||
|
||||
public static int TRANSMISSION_INTERVAL = 100;
|
||||
public static int TRANSMISSION_DURATION = 98;
|
||||
|
@ -103,7 +103,7 @@ public class DisturberRadio extends Radio {
|
|||
return transmitting;
|
||||
}
|
||||
|
||||
public int getTransmissionEndTime() {
|
||||
public long getTransmissionEndTime() {
|
||||
return transEndTime;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class DisturberRadio extends Radio {
|
|||
}
|
||||
|
||||
public void doActionsBeforeTick() {
|
||||
int currentTime = myMote.getSimulation().getSimulationTime();
|
||||
long currentTime = myMote.getSimulation().getSimulationTime();
|
||||
|
||||
if (!transmitting && currentTime % TRANSMISSION_INTERVAL == 0) {
|
||||
transmitting = true;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: DummyMote.java,v 1.5 2008/10/28 13:39:24 fros4943 Exp $
|
||||
* $Id: DummyMote.java,v 1.6 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.motes;
|
||||
|
@ -146,7 +146,7 @@ public class DummyMote implements Mote {
|
|||
this.mySim = simulation;
|
||||
}
|
||||
|
||||
public boolean tick(int simTime) {
|
||||
public boolean tick(long simTime) {
|
||||
|
||||
// Perform some dummy task
|
||||
if (myRandom.nextDouble() > 0.9) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: RadioLogger.java,v 1.13 2008/03/18 15:42:35 fros4943 Exp $
|
||||
* $Id: RadioLogger.java,v 1.14 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.plugins;
|
||||
|
@ -258,7 +258,7 @@ public class RadioLogger extends VisPlugin {
|
|||
|
||||
for (RadioConnection newConnection: newConnections) {
|
||||
Object[] data = new Object[3];
|
||||
data[DATAPOS_TIME] = new Integer(simulation.getSimulationTime());
|
||||
data[DATAPOS_TIME] = new Long(simulation.getSimulationTime());
|
||||
data[DATAPOS_CONNECTION] = newConnection;
|
||||
|
||||
data[DATAPOS_PACKET] = newConnection.getSource().getLastPacketTransmitted();
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ScriptRunnerNoGUI.java,v 1.5 2008/12/03 16:23:26 fros4943 Exp $
|
||||
* $Id: ScriptRunnerNoGUI.java,v 1.6 2008/12/04 14:03:42 joxe Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.plugins;
|
||||
|
@ -156,7 +156,7 @@ public class ScriptRunnerNoGUI implements Plugin {
|
|||
|
||||
/* Create timeout event */
|
||||
sim.scheduleEvent(new TimeEvent(0) {
|
||||
public void execute(int t) {
|
||||
public void execute(long t) {
|
||||
try {
|
||||
logWriter.write("TEST TIMEOUT");
|
||||
logWriter.flush();
|
||||
|
|
Loading…
Reference in a new issue