diff --git a/bin/BiathlonSymulation/Run.class b/bin/BiathlonSymulation/Run.class new file mode 100644 index 0000000..42bcca4 Binary files /dev/null and b/bin/BiathlonSymulation/Run.class differ diff --git a/bin/BiathlonSymulation/Runner.class b/bin/BiathlonSymulation/Runner.class new file mode 100644 index 0000000..0a7554b Binary files /dev/null and b/bin/BiathlonSymulation/Runner.class differ diff --git a/bin/BiathlonSymulation/SR.class b/bin/BiathlonSymulation/SR.class new file mode 100644 index 0000000..d8c6526 Binary files /dev/null and b/bin/BiathlonSymulation/SR.class differ diff --git a/bin/BiathlonSymulation/Stage.class b/bin/BiathlonSymulation/Stage.class new file mode 100644 index 0000000..e52cbbd Binary files /dev/null and b/bin/BiathlonSymulation/Stage.class differ diff --git a/src/biathlon/Process.java b/src/biathlon/Process.java index 60ab85e..33510a3 100644 --- a/src/biathlon/Process.java +++ b/src/biathlon/Process.java @@ -7,16 +7,37 @@ import desmoj.core.dist.*; public class Process extends Model { - private desmoj.core.dist.ContDistUniform runnerAverageSpeed; - private desmoj.core.dist.ContDistNormal serviceTimeProne; - private desmoj.core.dist.ContDistNormal serviceTimeStanding; + protected final static int NUM_SR = 4; + protected final static int NUM_CONTENDER = 30; + + private desmoj.core.dist.ContDistUniform runnerAverageSpeed; + + private desmoj.core.dist.ContDistNormal serviceTimeProne; + + private desmoj.core.dist.ContDistNormal serviceTimeStanding; + + protected desmoj.core.simulator.ProcessQueue penaltyQueue; + + protected desmoj.core.simulator.ProcessQueue RunnerQueue; + + protected desmoj.core.simulator.ProcessQueue idleSRQueue; + + protected desmoj.core.simulator.ProcessQueue penaltyCircuits; + + /** + * @param args + */ public static void main(String[] args) { Process model = new Process(null, "Biathlon simulation", true, true); Experiment exp = new Experiment("Biatholon_simulation", "output"); - model.connectToExperiment(exp); + model.connectToExperiment(exp); + exp.setShowProgressBar(true); + exp.stop(new TimeInstant(40,TimeUnit.MINUTES)); + + exp.tracePeriod(new TimeInstant(0), new TimeInstant(40,TimeUnit.MINUTES)); exp.start(); exp.report(); @@ -35,27 +56,27 @@ public class Process extends Model { @Override public void doInitialSchedules() { + ShotingRangeGenerator sRG=new ShotingRangeGenerator(this, "Shoting range generator", false, NUM_SR); + RunnerGenerator runnerGenerator = new RunnerGenerator(this, "Runner generator", false, NUM_CONTENDER); + sRG.activate(new TimeSpan(0)); + runnerGenerator.activate(new TimeSpan(0)); - RunnerGenerator runnerGenerator = new RunnerGenerator(this, "Runner generator", false, RUNNERS_NUM); - runnerGenerator.activate(); } @Override public void init() { - serviceTimeProne = new ContDistNormal(this, "ServiceTimeStand", 30.0, 4.0, true, false); - serviceTimeStanding = new ContDistNormal(this, "ServiceTimeProne", 25.0 ,3.0, true, false); - runnerAverageSpeed = new ContDistUniform(this, "runnerAverageSpeed", 25.0, 1.0, true, false); + serviceTimeProne = new ContDistNormal(this, "ServiceTimeStand", 30.0, + 4.0, true, false); + serviceTimeStanding = new ContDistNormal(this, "ServiceTimeProne", + 25.0 ,3.0, true, false); + runnerAverageSpeed = new ContDistUniform(this, "runnerAverageSpeed", + 25.0, 1.0, true, false); - Stage_1_Queue = new ProcessQueue(this, "Stage 1 queue", true, true); - Stage_2_Queue = new ProcessQueue(this, "Stage 1 queue", true, true); - Stage_3_Queue = new ProcessQueue(this, "Stage 1 queue", true, true); - Stage_4_Queue = new ProcessQueue(this, "Stage 1 queue", true, true); - - SR_1_Queue = new ProcessQueue(this, "SR 1 queue", true, true); - SR_2_Queue = new ProcessQueue(this, "SR 1 queue", true, true); - SR_3_Queue = new ProcessQueue(this, "SR 1 queue", true, true); - SR_4_Queue = new ProcessQueue(this, "SR 1 queue", true, true); + RunnerQueue = new ProcessQueue(this, "Runner Queue", true, true); + idleSRQueue = new ProcessQueue(this, "idle SR Queue", + true, true); + } public desmoj.core.dist.ContDistUniform getRunnerArrivalTime() { @@ -70,58 +91,6 @@ public class Process extends Model { return serviceTimeStanding; } -// public void checkEnd() { -// if(ACTIVE_RUNNERS_NUM == 0) { -// System.out.println("Koniec"); -// this.getExperiment().stop(); -// } -// else { -// System.out.println("Pozostało:" + ACTIVE_RUNNERS_NUM); -// } -// } - - public void QueueRunner(Runner runner) { - Stage_1_Queue.insert(runner); - System.out.println("Queue runner:" +runner.getNumber()); - ACTIVE_RUNNERS_NUM++; - } - - public void StageRunner(Runner runner) { - if(Stage_1_Queue.contains(runner)) { - Stage_1_Queue.remove(runner); - SR_1_Queue.insert(runner); - - - return; - } - else if(Stage_2_Queue.contains(runner)) { - Stage_2_Queue.remove(runner); - ACTIVE_RUNNERS_NUM--; - } - - if(ACTIVE_RUNNERS_NUM == 0) { - System.out.println("Koniec"); - this.getExperiment().stop(); - } - } - - // ------------------------------------------------------------------------ - protected final static int RUNNERS_NUM = 30; - protected static int ACTIVE_RUNNERS_NUM; - - protected final static int STAGE_1_DIST = 3000; - protected final static int STAGE_2_DIST = 4000; - protected final static int STAGE_3_DIST = 4000; - protected final static int STAGE_4_DIST = 4000; - - protected desmoj.core.simulator.ProcessQueue Stage_1_Queue; - protected desmoj.core.simulator.ProcessQueue Stage_2_Queue; - protected desmoj.core.simulator.ProcessQueue Stage_3_Queue; - protected desmoj.core.simulator.ProcessQueue Stage_4_Queue; - - protected desmoj.core.simulator.ProcessQueue SR_1_Queue; - protected desmoj.core.simulator.ProcessQueue SR_2_Queue; - protected desmoj.core.simulator.ProcessQueue SR_3_Queue; - protected desmoj.core.simulator.ProcessQueue SR_4_Queue; -} + +} \ No newline at end of file