Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Kit committed Feb 18, 2014
1 parent 221c301 commit 8e25dcf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions jdeeco-simulation-demo/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def siteCfgPath(self):
return self.baseCfgPath() + 'site.cfg'
def omnetppPath(self):
# needs to be relative path
return self.prefix() + 'omnetpp.ini'
return self.prefix() + 'omnetpp'
def name(self):
return self.prefix() + 'scenario'

Expand Down Expand Up @@ -144,7 +144,7 @@ def generate():
simulated = []
cpus = 3

command = "java"
command = "C:/Program Files (x86)/Java/jdk7/bin/java.exe"

def cleanup():
timeout_sec = 5
Expand Down
3 changes: 3 additions & 0 deletions jdeeco-simulation-demo/omnetpp.ini.templ
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ network = manet.MANET
load-libs = model oppcmdenv
ned-path = model;mixim/examples;mixim/src/base;mixim/src/modules;inet/

cmdenv-config-name = <<<configName>>>

[Config <<<configName>>>]
##########################################################
# Logging #
##########################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cz.cuni.mff.d3s.jdeeco.simulation.demo;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
Expand All @@ -15,7 +16,9 @@
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;
import java.util.UUID;

import cz.cuni.mff.d3s.deeco.DeecoProperties;
import cz.cuni.mff.d3s.deeco.annotations.processor.AnnotationProcessor;
Expand Down Expand Up @@ -142,13 +145,18 @@ public boolean gossipTo(String recipient) {
}

directRecipientSelector.initialize(ethernetEnabled, networkRegistry);
String confName = "omnetpp" + "-" + components.size() + "-" + (Boolean.getBoolean(DeecoProperties.DISABLE_BOUNDARY_CONDITIONS) ? "disabled" : "enabled");
String confName = "omnetpp";
if (args.length >= 3) {
confName = args[2];
}
Files.copy(Paths.get(OMNET_CONFIG_TEMPLATE), Paths.get(confName), StandardCopyOption.REPLACE_EXISTING);
String confFile = confName + ".ini";
Scanner scanner = new Scanner(new File(OMNET_CONFIG_TEMPLATE));
String template = scanner.useDelimiter("\\Z").next();
template = template.replace("<<<configName>>>", confName);
scanner.close();

PrintWriter out = new PrintWriter(Files.newOutputStream(Paths.get(confName), StandardOpenOption.APPEND));
PrintWriter out = new PrintWriter(Files.newOutputStream(Paths.get(confFile), StandardOpenOption.CREATE));
out.println(template);
out.println();
out.println(String.format("**.playgroundSizeX = %dm", (int) topRight.x));
out.println(String.format("**.playgroundSizeY = %dm", (int) topRight.y));
Expand All @@ -171,7 +179,7 @@ public boolean gossipTo(String recipient) {

logSimulationParameters(i);

sim.run("Cmdenv", confName);
sim.run("Cmdenv", confFile);

sim.finalize();

Expand Down

0 comments on commit 8e25dcf

Please sign in to comment.