def run(self, file_name): """Runs the overall simulation based on settings specified when the BlackWidow object is constructed. Parameters ---------- file_name : string Name of config file containing network. Returns ------- sim_time : float The amount of time taken for the network to finish running. """ print "Parsing {0} ...".format(file_name), "\n" # Create network from file self.network = parser.config_network(file_name, self) # Initialize grapher self.grapher = CsvGrapher(self) print "Parsed network: \n" self.network.dump() # Run the network. print "\nRunning network: \n" # sim_time is the amount of time taken for the network to run sim_time = self.network.run() # Graph the data if we are not graphing in real time if not self.real_time: self.grapher.graph(int(sim_time)) return sim_time
def run_network(self, network): """Runs the overall simulation based on settings specified when the BlackWidow object is constructed. Parameters ---------- network : `Network` The network to run. Returns ------- sim_time : float The amount of time taken for the network to finish running. """ self.network = network self.grapher = CsvGrapher(self) sim_time = network.run() if not self.real_time: self.grapher.graph(int(sim_time)) return sim_time