from pyomo.environ import * from pyomo.dae import * from binary_fitting_result import vapor_oxygen_composition, liquid_oxygen_composition, liquid_nitrogen_enthalpy, liquid_oxygen_enthalpy, vapor_nitrogen_enthalpy, vapor_oxygen_enthalpy from binary_fitting_gradient import liquid_nitrogen_enthalpy_DT, liquid_oxygen_enthalpy_DT, liquid_oxygen_composition_DP, liquid_oxygen_composition_DT from binary_fitting_density import liquid_density import tools import load_initials model = ConcreteModel() disc = tools.TimeDiscretilizer(nfe=5, ncp=3, bounds=(0, 10)) disc.set_fe_point([2, 4, 6, 8]) #----------单位----------- # 温度:℃, # 时间:h # 温差:K # 压力:kPa # 物质的量:kmol # 流量:kmol/h # 摩尔焓:kJ/kmol #---------------时间定义--------------- # model.time = ContinuousSet(bounds=(0,10)) disc.initialize_time(model, 'time') #---------------物质组分----------- model.Component = Set(initialize=['Oxygen', 'Nitrogen']) #-------------参数时间------------------ pe_list = disc.get_para_time() model.ParaTime = Set(initialize=pe_list) #---------------------------------------- ### # Specification
#!/usr/bin/env python #-*- coding:utf-8 -*- from pyomo.environ import * from pyomo.dae import * import matplotlib.pyplot as plt import tools model = ConcreteModel() disc = tools.TimeDiscretilizer(nfe=100, ncp=3, bounds=(0, 20)) disc.set_fe_point(list=None) disc.initialize_time(model, 'time') #------------------------------- # Deficition of Sets #------------------------------- pe_list = disc.get_para_time() model.ParaTime = Set(initialize=pe_list) model.StateSet = Set(initialize=[0, 1, 2, 3]) model.InputSet = Set(initialize=[0, 1]) model.OutputSet = Set(initialize=[0, 1]) #------------------------------- # Math Model #------------------------------- A = [[0, 1, 0, 0], [-15, -0.75, 5, 0.25], [0, 0, 0, 1], [10, 0.5, -10, -0.5]] B = [[0, 0], [0.025, 0], [0, 0], [0, 0.05]] C = [[1, 0, 0, 0], [0, 0, 1, 0]] D = [[0, 0], [0, 0]] #-------------------------------- # Parameters #--------------------------------