예제 #1
0
 def __init__(self, x=0, y=0, z=0, parent=None, name=None):
     #
     self.setGraph(parent, name)  # set parent graph and node name
     self.modelType = nodeModelTypes.MODEL_NONE  # Model type
     self.modelName = ""  # name of node model
     self.calcCount = 0
     self.altInput = None
     self.vis = True  # whether or not to display node
     self.seq = True  # whether or not to include in calcualtion order
     self.x = x  # coordinate for drawing graph
     self.y = y  # coordinate for drawing graph
     self.z = z  # coordinate for drawing graph
     self.calcError = -1  # error code, 0 = good
     ## node calculations
     self.scriptMode = "post"
     self.pythonCode = ""
     ## Node/Model Options
     self.options = optionList()
     ## Turbine stuff
     self.turbSession = 0  # turbine session id
     self.turbJobID = None  # turbine job id
     self.turbApp = None  # application that runs model
     self.turbineMessages = ""
     ## Python Plugin Stuff
     self.pyModel = None
     ##
     self.running = False
     self.synced = True
예제 #2
0
    def __init__(self, dat):
        threading.Thread.__init__(self)
        self.stop = threading.Event()
        self.daemon = True
        self.clear()
        self.dat = dat
        self.options = optionList()
        self.setData(dat)
        self.driverFile = ""
        # self.directCopy is a list of attributes that can be
        # copied with copy.deepcopy and can be understood by
        # the json module.  This saves some work saving the
        # object to a dictionary that can be turned into a json
        # string.  Some things may not fit this and you may need
        # to overload the saveDict and loadDict functions.
        self.directCopy = ["input", "output", "inputOptions", "outputOptions"]
        self.msgQueue = queue.Queue()  # queue for messages to print
        self.resQueue = queue.Queue()  # a queue for plots and monitoring
        self.inputOptions = dict()
        self.outputOptions = dict()
        self.inputCols = []
        self.outputCols = []
        self.minInputs = 1
        self.maxInputs = 1000
        self.minOutputs = 1
        self.maxOutputs = 1000

        self.inputVarButtons = ()
        self.outputVarButtons = ()
예제 #3
0
 def loadDict(self, sd):
     '''
         Read the node attributes fro a dictionary created by
         saveDict().
     '''
     self.modelType = sd.get("modelType", nodeModelTypes.MODEL_NONE)
     self.x = sd.get("x", 0)
     self.y = sd.get("y", 0)
     self.z = sd.get("z", 0)
     self.synced = sd.get("synced", False)
     self.modelName = sd.get("modelName", "")
     self.modelType = sd.get("modelType", nodeModelTypes.MODEL_NONE)
     self.scriptMode = sd.get("scriptMode", "post")
     self.pythonCode = sd.get("pythonCode", "")
     self.calcError = sd.get("calcError", -1)
     self.turbApp = sd.get("turbApp", None)
     self.turbSession = sd.get("turbSession", 0)
     self.options = optionList()
     o = sd.get("options", None)
     if o:
         self.options.loadDict(o)
     if self.modelType == nodeModelTypes.MODEL_TURBINE:
         self.addTurbineOptions()
     # Below is just to maintain compatibility with older session files
     # It may be deleted at some point in the future
     if 'inVars' in sd:
         for vkey, var in sd["inVars"].iteritems():
             v = self.gr.input.addVariable(self.name, vkey)
             v.loadDict(var)
     if 'outVars' in sd:
         for vkey, var in sd["outVars"].iteritems():
             v = self.gr.output.addVariable(self.name, vkey)
             v.loadDict(var)
예제 #4
0
 def __init__(self, dat=None):
     """
     Initialize CMA-ES optimization module
     """
     threading.Thread.__init__(self)
     self.stop = threading.Event()
     self.daemon = True
     self.setData(dat)
     self.options = optionList()
     self.name = "Optimization Base"
     self.description = "Optimization Base Class"
     self.mp = True
     self.mobj = False
     self.requireScaling = True
     self.minVars = 1
     self.maxVars = 100
     self.msgQueue = queue.Queue()  # queue for messages to print
     self.resQueue = queue.Queue()  # a queue for plots and monitoring
     self.ex = None
     self.updateGraph = False