def main(): cd.init() defineflow() nr = cd.NodeRegistry() nr.addNativePlugin("nodes") sr = cd.SimulationRegistry() sr.addNativePlugin("nodes") register_python_nodes(nr, 'testnodes') sim = sr.createSimulation("OrderedPipeSimulation") model = cd.Model() setup_test_model(model, nr, sim) sim.start(0)
self.n = 10 self.addParameters() def f(self, time, dt): print "f" print self.x return dt def init(self, start, end, dt): print "init" print self.x pass pycd3.init() fd = pycd3.FlowDefinition() fd['Q'] = pycd3.CalculationUnit.flow fd['C0'] = pycd3.CalculationUnit.concentration fd['C1'] = pycd3.CalculationUnit.concentration pycd3.Flow.define(fd) n = TestNode() pycd3.test_node(n) f = pycd3.Flow() print "len of of f == %s" % (len(f)) f[0] = 3.142 print "getith %s" % f.getIth(pycd3.CalculationUnit.flow, 0) print f[0] print "the flows names are: %s" % pycd3.Flow.names()
self.d = 1.0 self.n = 10 self.addParameters() def f(self, time, dt): print "f" print self.x return dt def init(self, start, end, dt): print "init" print self.x pass pycd3.init() fd = pycd3.FlowDefinition() fd["Q"] = pycd3.CalculationUnit.flow fd["C0"] = pycd3.CalculationUnit.concentration fd["C1"] = pycd3.CalculationUnit.concentration pycd3.Flow.define(fd) n = TestNode() pycd3.test_node(n) f = pycd3.Flow() print "len of of f == %s" % (len(f)) f[0] = 3.142 print "getith %s" % f.getIth(pycd3.CalculationUnit.flow, 0) print f[0] print "the flows names are: %s" % pycd3.Flow.names()