[mod][fix] modified config to be more sane and fixed output thread

This commit is contained in:
2020-01-29 01:19:11 -06:00
parent a7817d04ec
commit 86e383922d
2 changed files with 18 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
simulation: simulation:
duration: 500 duration: 24
tickfactor: 10 tickfactor: 10
runs: 20 runs: 20
parCell: 0 parCell: 0
@@ -33,26 +33,26 @@ groundtruths:
- value: 11.0 - value: 11.0
timeline: timeline:
- start: 0 - start: 0
end: 120 end: 12
- [240, 360] - [18, 24]
delta: delta:
- name: factor - name: factor
args: {factor: 1.1} args: {factor: 1.1}
timeline: timeline:
- start: 20 - start: 10
end: 95 end: 20
- [170, randomValue, {arg: true}] - [17, randomValue, {arg: true}]
- group: humidity - group: humidity
parent: temperature parent: temperature
truth: truth:
- [0, None] - [0, None]
- [30, 0.6] - [3, 0.6]
- [50, None] - [5, None]
delta: delta:
- [10, None] - [10, None]
- [30, addValuePercent, {jitterA: 0.03, jitterB: 0.8}] - [13, addValuePercent, {jitterA: 0.03, jitterB: 0.8}]
- [50, humidFromTemp] - [15, humidFromTemp]
behaviours: behaviours:
- group: temperature - group: temperature
@@ -61,8 +61,8 @@ behaviours:
- name: randomValue - name: randomValue
args: {a: 40, b: 80} args: {a: 40, b: 80}
timeline: timeline:
- start: 44 - start: 4
end: 166 end: 6
- [100, normalValue, {v: 2}] - [10, normalValue, {v: 2}]
- [120, addValuePercent, {}] - [12, addValuePercent, {}]
- [180, normalValue, {x: 0, y: 2}] - [18, normalValue, {x: 0, y: 2}]

View File

@@ -17,28 +17,17 @@ object Main {
val simBehavirous = SimulationBehaviours(behaviours) val simBehavirous = SimulationBehaviours(behaviours)
def main(args: Array[String]): Unit = { def main(args: Array[String]): Unit = {
val config = "docs/wiki/config/config.yml" startSimulation()
val list: Map[String, Any] = yml.parse(config)
new SimulationConfigParser(list, simBehavirous).parse()
// println(printUtil.indentCollection(list.toString()).toString)
//new Test2().run()
val parlist: Map[String, Int] = Map("a" -> 1, "b" -> 1, "c" -> 1, "d" -> 1)
val v: Vector[Int] = Vector(1,2,3,4,5,6,7)
//lib.evalUtil.time("par", parlist.par.map({_ => Thread.sleep(10); 2}))
//lib.evalUtil.time("ser", parlist.map({_ => Thread.sleep(10); 2}))
//startSimulation()
} }
def startSimulation(): Unit = { def startSimulation(): Unit = {
val config = new Parser().parse("docs/wiki/config/config.yml", simBehavirous).get val config = new Parser().parse("docs/wiki/config/config.yml", simBehavirous)
val sharedMemory = config.sharedMemory val sharedMemory = config.sharedMemory
val output = new Output(sharedMemory) val output = new Output(sharedMemory)
val outputThread = new Thread(output)
val simulator = new Simulation(config) val simulator = new Simulation(config)
for(_ <- 0 to sharedMemory.config.runs) { for(_ <- 0 to sharedMemory.config.runs) {
val outputThread = new Thread(output)
outputThread.start() outputThread.start()
simulator.start() simulator.start()
outputThread.join() outputThread.join()