diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-26 23:08:31 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-26 23:08:31 +0000 |
| commit | 39e9eb74c011ee5351ac1796e5df529a70aa8945 (patch) | |
| tree | 599657259a17c31ff5eb089af83a3d4202c350f2 | |
| parent | 2b35beeefeccb82afae8d259f11ccecc8b218417 (diff) | |
new option: "sim.message.prob.mean"
new brainstorm.
| -rw-r--r-- | ROADMAP | 5 | ||||
| -rw-r--r-- | sources/core/VSProcess.java | 6 | ||||
| -rw-r--r-- | sources/prefs/VSDefaultPrefs.java | 5 | ||||
| -rw-r--r-- | sources/simulator/VSSimulatorCanvas.java | 8 |
4 files changed, 17 insertions, 7 deletions
@@ -1,7 +1,9 @@ +TODO: Server vs Clientvariablen? -> onClientInit und onServerInit -> VSPrefs Objekte Pruefen Nicht nur Clientanfragen, auch Serveranfragen erlauben. Im pull down menue die protokolle komplett ordnen, alles was zu einem Protokoll zu tun hat zusammenlegen -Server und Client anders benennen? +VSSimulatorEditor: DEFAULT Prozesseinsgellungen, DEFAULT Nachrichteneinstellungen + Periodische Tasks anlegen koennen Ganze simulationseinstellungen abspeichern/laden koennen TaskManager + Tasks serialisierbar machen @@ -19,7 +21,6 @@ Protocols: Namensdienste Evtl: Local deliver max/min time - Sender <-> Receiver specific deliver time calc Systemschnitte? Middleware-Schicht? Ereignisse, die Prozessvariablen aendern diff --git a/sources/core/VSProcess.java b/sources/core/VSProcess.java index 03b980f..1a7f319 100644 --- a/sources/core/VSProcess.java +++ b/sources/core/VSProcess.java @@ -584,9 +584,11 @@ public class VSProcess extends VSPrefs { * * @return the a random message outage time */ - public synchronized long getARandomMessageOutageTime(final long durationTime) { + public synchronized long getARandomMessageOutageTime(final long durationTime, VSProcess receiverProcess) { + int percentage = (int) ((getInteger("message.prob.outage") + + receiverProcess.getInteger("message.prob.outage")) / 2); /* Check if the message will have an outage or not */ - if (random.nextInt(100) < getInteger("message.prob.outage")) { + if (getRandomPercentage() <= percentage) { /* Calculate the random outage time! */ final long outageTime = globalTime + random.nextLong(durationTime+1) % simulationCanvas.getUntilTime(); return outageTime; diff --git a/sources/prefs/VSDefaultPrefs.java b/sources/prefs/VSDefaultPrefs.java index 1a25409..0de1680 100644 --- a/sources/prefs/VSDefaultPrefs.java +++ b/sources/prefs/VSDefaultPrefs.java @@ -193,7 +193,7 @@ public class VSDefaultPrefs extends VSPrefs { public void fillDefaultFloats() { /* Simulation prefs */ initFloat("process.clock.variance", 0, "Uhrabweichung"); - initFloat("sim.clock.speed", 0.5f, "Simulationsgeschwindigkeit"); + initFloat("sim.clock.speed", 0.5f, "Abspielgeschwindigkeit der Simulation"); } /** @@ -230,6 +230,7 @@ public class VSDefaultPrefs extends VSPrefs { public void fillDefaultBooleans() { //initBoolean("message.broadcast", false, "Nachrichten sind immer Broadcasts"); initBoolean("sim.mode.expert", false, "Expertenmodus aktivieren"); - initBoolean("sim.message.own.recv", false, "Eigene Nachrichten empfangen"); + initBoolean("sim.message.own.recv", false, "Prozesse empfangen eig. Nachrichten"); + initBoolean("sim.message.prob.mean", true, "Mittelwerte der Nachrichtausfallw'k. bilden"); } } diff --git a/sources/simulator/VSSimulatorCanvas.java b/sources/simulator/VSSimulatorCanvas.java index f4e2044..33a5f18 100644 --- a/sources/simulator/VSSimulatorCanvas.java +++ b/sources/simulator/VSSimulatorCanvas.java @@ -1051,7 +1051,13 @@ public class VSSimulatorCanvas extends Canvas implements Runnable, MouseMotionLi } else { durationTime = sendingProcess.getDurationTime(); deliverTime = sendingProcess.getGlobalTime() + durationTime; - outageTime = sendingProcess.getARandomMessageOutageTime(durationTime); + + if (prefs.getBoolean("sim.message.prob.mean")) + outageTime = sendingProcess.getARandomMessageOutageTime( + durationTime, receiverProcess); + else + outageTime = sendingProcess.getARandomMessageOutageTime( + durationTime, null); /* Only add a 'receiving message' task if the message will not get lost! */ if (outageTime == -1) { |
