Пример #1
0
    def start(self,
              visualization=False,
              robots=10,
              comment="",
              model="C:\\SAP 2000\\template.sdb"):
        '''
    This starts up the SAP 2000 Program and hides it. 
      visualization = should we display the simulation as it occurs?
      robots = number of robots in simulation
      comment = a comment attached to the name of the folder
      model = location of a file which contains a starting model
    '''
        outputfolder = ''
        if self.started:
            print("Simulation has already been started")
        else:
            outputfolder = self.makeOutputFolder(comment)
            outputfilename = "tower.sdb"
            self.SapProgram, self.SapModel = commandline.run(
                model, outputfolder + outputfilename)
            self.SapProgram.hide()
            self.started = True

        # Make python structure and start up the colony
        self.Structure = Structure(visualization)
        self.Swarm = SmartSwarm(robots, self.Structure, self.SapProgram)

        # If we started with a previous model, we have to add all of the beams
        # to our own model in python
        if model != "":
            ret = self.Structure.load_model(self.SapProgram)
            assert ret == 0

        self.folder = outputfolder