예제 #1
0
    builder.set_odes_rule(rule_odes)

    #Add time points where feed as discrete jump should take place:
    feed_times = [101.035, 400., 303.126]
    builder.add_feed_times(feed_times)

    model = builder.create_pyomo_model(0, 600)

    #=========================================================================
    #USER INPUT SECTION - FE Factory
    #=========================================================================

    # call FESimulator
    # FESimulator re-constructs the current TemplateBuilder into fe_factory syntax
    # there is no need to call PyomoSimulator any more as FESimulator is a child class
    sim = FESimulator(model)

    # defines the discrete points wanted in the concentration profile
    sim.apply_discretization('dae.collocation',
                             nfe=50,
                             ncp=3,
                             scheme='LAGRANGE-RADAU')

    #Since the model cannot discriminate inputs from other algebraic elements, we still
    #need to define the inputs as inputs_sub
    inputs_sub = {}
    inputs_sub['Y'] = ['5', 'Temp']
    sim.fix_from_trajectory(
        'Y', 'Temp', fixed_Ttraj
    )  # def fix_from_trajectory(self,variable_name,variable_index,trajectories):
예제 #2
0
    model = builder.create_pyomo_model(0, 10)
    
    builder.add_absorption_data(S_frame)
    write_absorption_data_to_txt('Sij_multexp1.txt', S_frame)

    model = builder.create_pyomo_model(0., 10.) 

    #=========================================================================
    #USER INPUT SECTION - FE Factory
    #=========================================================================
     
    # call FESimulator
    # FESimulator re-constructs the current TemplateBuilder into fe_factory syntax
    # there is no need to call PyomoSimulator any more as FESimulator is a child class 
    sim = FESimulator(model)
    
    # defines the discrete points wanted in the concentration profile
    sim.apply_discretization('dae.collocation', nfe=100, ncp=3, scheme='LAGRANGE-RADAU')
    '''
    #Since the model cannot discriminate inputs from other algebraic elements, we still
    #need to define the inputs as inputs_sub
    inputs_sub = {}
    inputs_sub['Y'] = ['5']
    
    fixedy = True
    yfix={}
    yfix['Y']=['5']#needed in case of different input fixes
    #since these are inputs we need to fix this
    for key in sim.model.time.value:
        sim.model.Y[key, '5'].set_value(key)
예제 #3
0
    builder.set_odes_rule(rule_odes)
    
    #Add time points where feed as discrete jump should take place:
    feed_times=[100.]
    builder.add_feed_times(feed_times)

    model = builder.create_pyomo_model(0, 600)

    #=========================================================================
    #USER INPUT SECTION - FE Factory
    #=========================================================================
     
    # call FESimulator
    # FESimulator re-constructs the current TemplateBuilder into fe_factory syntax
    # there is no need to call PyomoSimulator any more as FESimulator is a child class 
    sim = FESimulator(model)
    
    # defines the discrete points wanted in the concentration profile
    sim.apply_discretization('dae.collocation', nfe=50, ncp=3, scheme='LAGRANGE-RADAU')

    #Since the model cannot discriminate inputs from other algebraic elements, we still
    #need to define the inputs as inputs_sub
    inputs_sub = {}
    inputs_sub['Y'] = [5]

    #since these are inputs we need to fix this
    for key in sim.model.time.value:
        sim.model.Y[key, 5].set_value(key)
        sim.model.Y[key, 5].fix()

    #this will allow for the fe_factory to run the element by element march forward along 
예제 #4
0
        exprs['Masa'] = 180.157 * V * m.Y[t, 'r5']
        exprs['Msa'] = -138.121 * V * m.Y[t, 'r4']
        return exprs

    builder.set_odes_rule(rule_odes)

    model = builder.create_pyomo_model(0.0, 210.5257)
    #=========================================================================
    #USER INPUT SECTION - FE Factory
    #=========================================================================

    fe_x_list = [ii for ii in range(1, nfe_x + 1)]
    model.fe_x_i = Set(initialize=fe_x_list)

    sim = FESimulator(model)

    # defines the discrete points wanted in the concentration profile(nfe_x)
    sim.apply_discretization('dae.collocation',
                             nfe=200,
                             ncp=3,
                             scheme='LAGRANGE-RADAU')
    fe_l = sim.model.time.get_finite_elements()
    fe_list = [fe_l[i + 1] - fe_l[i] for i in range(0, len(fe_l) - 1)]
    nfe = len(fe_list)  #: Create a list with the step-size
    print(nfe)

    for i in sim.model.X.itervalues():
        idx = i.index()
        if idx[1] in ['Msa']:
            i.setlb(0)
예제 #5
0
            inspect.currentframe() ) ) ), 'data_sets'))
    filename =  os.path.join(dataDirectory,'Dij.txt')
    D_frame = read_spectral_data_from_txt(filename)
    
    builder.add_spectral_data(D_frame)
       
    opt_model = builder.create_pyomo_model(0.0,10.0)
    
    #=========================================================================
    #USER INPUT SECTION - FE Factory
    #=========================================================================

    # call FESimulator
    # FESimulator re-constructs the current TemplateBuilder into fe_factory syntax
    # there is no need to call PyomoSimulator any more as FESimulator is a child class
    sim = FESimulator(opt_model)

    # defines the discrete points wanted in the concentration profile
    sim.apply_discretization('dae.collocation', nfe=50, ncp=3, scheme='LAGRANGE-RADAU')

    #Since the model cannot discriminate inputs from other algebraic elements, we still
    #need to define the inputs as inputs_sub
    inputs_sub = {}
    inputs_sub['Y'] = ['3','Temp']
    sim.fix_from_trajectory('Y', 'Temp', fixed_Ttraj)
    
    trajs = dict()
    trajs[('Y', 'Temp')] = fixed_Ttraj

    fixedy = True  # instead of things above
    fixedtraj = True