Exemplo n.º 1
0
    def __init__(self, n_groups=1, pool_size=0.0):
        '''
        Parameters
        ----------
        n_groups: int
            Number of groups in the population.
        pool_size: float
            Upperbound on the range of the existing population groups. A random value
            from 0 to the upperbound value will be assigned to each group.

        '''

        super().__init__()

        self.port_names_expected = [
            'probation', 'adjudication', 'arrested', 'prison', 'community'
        ]
        quantities = list()
        self.ode_params = dict()

        self.initial_time = 0.0 * unit.day
        self.end_time = 100 * unit.day
        self.time_step = 0.5 * unit.day

        unit.month = 30 * unit.day
        unit.percent = 1 / 100

        # Population groups
        self.n_groups = n_groups

        # Jail population groups
        fjg_0 = np.random.random(self.n_groups) * pool_size
        fjg = Quantity(name='fjg',
                       formal_name='jail-pop-grps',
                       latex_name='$n_j^{(g)}$',
                       unit='# offenders',
                       value=fjg_0,
                       info='Jail Population Groups')
        quantities.append(fjg)

        # Model parameters: commitment coefficients

        # Jail to community
        a = 35 * unit.percent / unit.year * np.ones(self.n_groups)
        b = 40 * unit.percent / unit.year * np.ones(self.n_groups)
        cj0g_0 = (a +
                  (b - a) * np.random.random(self.n_groups)) / self.n_groups
        cj0g = Quantity(name='cj0g',
                        formal_name='commit-community-coeff-grps',
                        unit='1/s',
                        value=cj0g_0)
        self.ode_params['commit-to-community-coeff-grps'] = cj0g_0
        quantities.append(cj0g)

        # Jail to prison
        a = 60 * unit.percent / unit.year * np.ones(self.n_groups)
        b = 65 * unit.percent / unit.year * np.ones(self.n_groups)
        cjpg_0 = (a +
                  (b - a) * np.random.random(self.n_groups)) / self.n_groups
        cjpg = Quantity(name='cjpg',
                        formal_name='commit-prison-coeff-grps',
                        unit='1/s',
                        value=cjpg_0)
        self.ode_params['commit-to-prison-coeff-grps'] = cjpg_0
        quantities.append(cjpg)

        # Death term
        a = 0.5 * unit.percent / unit.year * np.ones(self.n_groups)
        b = 0.6 * unit.percent / unit.year * np.ones(self.n_groups)
        djg_0 = (a + (b - a) * np.random.random(self.n_groups)) / self.n_groups
        self.ode_params['jail-death-rates-coeff'] = djg_0

        # Phase state
        self.population_phase = Phase(self.initial_time,
                                      time_unit='s',
                                      quantities=quantities)

        self.population_phase.SetValue('fjg', fjg_0, self.initial_time)

        # Initialize inflows to zero
        self.ode_params['arrested-inflow-rates'] = np.zeros(self.n_groups)
        self.ode_params['probation-inflow-rates'] = np.zeros(self.n_groups)
        self.ode_params['adjudication-inflow-rates'] = np.zeros(self.n_groups)

        return
Exemplo n.º 2
0
    def __init__(self):
        """Constructor.

        Parameters
        ----------

        """

        super().__init__()

        self.port_names_expected = ['inflow', 'outflow', 'external-heat']

        # General attributes
        self.initial_time = 0.0*unit.second
        self.end_time = 1.0*unit.hour
        self.time_step = 10.0*unit.second

        self.show_time = (False, 10.0*unit.second)
        self.save = True

        self.log = logging.getLogger('cortix')
        self.__logit = True # flag indicating when to log

        # Domain attributes
        self.malfunction = (False, 10*unit.minute, 20*unit.minute)

        # Configuration parameters

        self.volume = 5*unit.meter**3

        # Initialization

        self.inflow_temp = (20+273)*unit.kelvin
        self.inflow_pressure = 34*unit.bar
        self.inflow_mass_flowrate = 67*unit.kg/unit.second
        self.external_heat_source_rate = 0*unit.watt # external

        self.outflow_temp = (20+273.15)*unit.kelvin
        #self.outflow_temp_ss = 422 #k
        self.outflow_pressure = 34*unit.bar
        self.outflow_mass_flowrate_normal = 67*unit.kg/unit.second
        self.outflow_mass_flowrate = self.outflow_mass_flowrate_normal

        self.outflow_mass_flowrate_malfunction = 47*unit.kg/unit.second
        self.outflow_temp_loss_malfunction = 10*unit.K

        self.heat_source_rate_needed = 25*unit.mega*unit.watt

        self.electric_heat_source_rate = 0*unit.mega*unit.watt

        self.outflow_rejected_heat_pwr = 0.0*unit.mega*unit.watt


        # Inflow phase history
        quantities = list()

        heat = Quantity(name='external-heat',
                         formal_name='qdot', unit='W',
                         value=self.external_heat_source_rate,
                         latex_name=r'$\dot{Q}$',
                         info='Water Heater External Heating Power')

        quantities.append(heat)

        self.inflow_phase = Phase(time_stamp=self.initial_time,
                                  time_unit='s', quantities=quantities)

        # Outflow phase history
        quantities = list()

        temp = Quantity(name='temp',
                        formal_name='T', unit='K',
                        value=self.outflow_temp,
                        latex_name=r'$T$',
                        info='Water Heater Outflow Temperature')

        quantities.append(temp)

        press = Quantity(name='pressure',
                         formal_name='P', unit='Pa',
                         value=self.outflow_pressure,
                         latex_name=r'$P$',
                         info='Water Heater Outflow Pressure')

        quantities.append(press)

        flowrate = Quantity(name='flowrate',
                         formal_name='m', unit='kg/s',
                         value=self.outflow_mass_flowrate,
                         latex_name=r'$\dot{m}$',
                         info='Water Heater Outflow Mass Flowrate')

        quantities.append(flowrate)

        flowrate = Quantity(name='rejected-heat',
                         formal_name='m', unit='W',
                         value=self.outflow_mass_flowrate,
                         latex_name=r'$\dot{Q}$',
                         info='Water Heater Rejected Heat')

        quantities.append(flowrate)


        self.outflow_phase = Phase(time_stamp=self.initial_time,
                                   time_unit='s', quantities=quantities)
Exemplo n.º 3
0
    def __init__(self):
        """Constructor.

        Parameters
        ----------

        """

        super().__init__()

        self.port_names_expected = ['inflow', 'outflow', 'process-heat']

        # General attributes
        self.initial_time = 0.0 * unit.second
        self.end_time = 1.0 * unit.hour
        self.time_step = 10.0 * unit.second

        self.show_time = (False, 10.0 * unit.second)
        self.save = True

        self.log = logging.getLogger('cortix')
        self.__logit = True  # flag indicating when to log

        # Domain attributes

        # Configuration parameters

        self.turbine_efficiency = 0.7784
        # Too low???
        self.vent_pressure = 0.008066866 * unit.mega * unit.pascal
        #self.vent_pressure = 1*unit.bar

        # Initialization

        self.inflow_temp = 20 + 273.15  #K
        #self.inflow_pressure = 1.0*unit.bar
        self.inflow_pressure = 34 * unit.bar
        self.inflow_mass_flowrate = 67 * unit.kg / unit.second
        self.inflow_total_heat_pwr = 0.0 * unit.watt

        self.outflow_temp = 20 + 272.15  #K
        self.outflow_pressure = self.vent_pressure
        self.outflow_mass_flowrate = 67 * unit.kg / unit.second
        self.outflow_quality = 0.0

        self.rejected_heat_pwr = 0.0 * unit.mega * unit.watt
        self.turbine_power = 0.0 * unit.mega * unit.watt

        # Outflow phase history
        quantities = list()

        flowrate = Quantity(name='flowrate',
                            formal_name='q',
                            unit='kg/s',
                            value=self.outflow_mass_flowrate,
                            latex_name=r'$q$',
                            info='Turbine Outflow Mass Flowrate')

        quantities.append(flowrate)

        temp = Quantity(name='temp',
                        formal_name='T',
                        unit='K',
                        value=self.outflow_temp,
                        latex_name=r'$T$',
                        info='Turbine Outflow Temperature')

        quantities.append(temp)

        pressure = Quantity(name='pressure',
                            formal_name='P',
                            unit='Pa',
                            value=self.vent_pressure,
                            latex_name=r'$P$',
                            info='Turbine Outflow Pressure')

        quantities.append(pressure)

        quality = Quantity(name='quality',
                           formal_name='X',
                           unit='',
                           value=self.outflow_quality,
                           latex_name=r'$X$',
                           info='Turbine Exit Steam Quality')

        quantities.append(quality)

        self.outflow_phase = Phase(time_stamp=self.initial_time,
                                   time_unit='s',
                                   quantities=quantities)

        # Turbine phase history
        quantities = list()

        power = Quantity(name='power',
                         formal_name='W_s',
                         unit='W$_e$',
                         value=0.0,
                         latex_name=r'$W_s$',
                         info='Turbine Power')

        quantities.append(power)

        rejected_heat_pwr = Quantity(name='rejected-heat',
                                     formal_name='Q',
                                     unit='W',
                                     value=0.0,
                                     latex_name=r'$\dot{Q}$',
                                     info='Turbine Rejected Heat Power')

        quantities.append(rejected_heat_pwr)

        self.state_phase = Phase(time_stamp=self.initial_time,
                                 time_unit='s',
                                 quantities=quantities)
Exemplo n.º 4
0
    def __init__(self, params):
        """Constructor.

        Parameters
        ----------
        params: dict
            All parameters for the module in the form of a dictionary.

        """

        super().__init__()

        self.params = deepcopy(params)
        self.params['entropy'] = 4.5  # Kj/Kg-K

        self.port_names_expected = ['inflow', 'outflow-1', 'outflow-2']

        self.initial_time = params['start-time']
        self.end_time = params['end-time']

        self.time_step = 10.0
        self.show_time = (False, 10.0)

        self.log = logging.getLogger('cortix')
        self.efficiency = 0.8

        # Inflow phase history
        quantities = list()

        temp = Quantity(name='temp',
                        formal_name='T_in',
                        unit='K',
                        value=params['coolant-temp'],
                        info='Turbine Steam Inflow Temperature',
                        latex_name=r'$T_i$')

        quantities.append(temp)

        self.inflow_phase = Phase(time_stamp=self.initial_time,
                                  time_unit='s',
                                  quantities=quantities)

        # Outflow phase history
        quantities = list()

        temp = Quantity(name='temp',
                        formal_name='T_o',
                        unit='K',
                        value=params['turbine-outflow-temp'],
                        info='Turbine Steam Outflow Temperature',
                        latex_name=r'$T_o$')

        quantities.append(temp)

        press = Quantity(name='pressure',
                         formal_name='P_t',
                         unit='Pa',
                         value=params['runoff-pressure'],
                         info='Turbine Steam Outflow Pressure',
                         latex_name=r'$P_t$')

        quantities.append(press)

        x = Quantity(name='quality',
                     formal_name='chi_t',
                     unit='%',
                     value=params['turbine-chi'],
                     info='Turbine Steam Outflow Quality',
                     latex_name=r'$\chi_t$')

        quantities.append(x)

        work = Quantity(name='power',
                        formal_name='P_t',
                        unit='W',
                        value=params['turbine-work'],
                        info='Turbine Power',
                        latex_name=r'$W_t$')

        quantities.append(work)

        flowrate = Quantity(name='flowrate',
                            formal_name='m',
                            unit='kg/s',
                            value=params['initial-flowrate'],
                            info='Mass Flowrate',
                            latex_name=r'$/dot m$')

        quantities.append(flowrate)

        self.outflow_phase = Phase(time_stamp=self.initial_time,
                                   time_unit='s',
                                   quantities=quantities)
Exemplo n.º 5
0
    def __init__(self, params):
        '''
        Parameters
        ----------
        params: dict
            All parameters for the module in the form of a dictionary.

        '''

        super().__init__()

        self.port_names_expected = [
            'coolant-inflow', 'coolant-outflow', 'signal-out', 'signal-in'
        ]

        self.params = params

        self.initial_time = 0.0 * unit.day
        self.end_time = 4 * unit.hour
        self.time_step = 10.0

        self.show_time = (False, 10.0)

        self.log = logging.getLogger('cortix')

        # Coolant outflow phase history
        quantities = list()

        flowrate = Quantity(name='flowrate',
                            formal_name='q_c',
                            unit='kg/s',
                            value=0.0,
                            info='Reactor Outflow Coolant Flowrate',
                            latex_name='$q_c$')

        quantities.append(flowrate)

        temp = Quantity(name='temp',
                        formal_name='T_c',
                        unit='K',
                        value=273.15,
                        info='Reactor Outflow Coolant Temperature',
                        latex_name='$T_c$')

        quantities.append(temp)

        press = Quantity(name='pressure',
                         formal_name='P_c',
                         unit='Pa',
                         value=0.0,
                         info='Reactor Outflow Coolant Pressure',
                         latex_name='$P_c$')

        quantities.append(press)

        quality = Quantity(name='steam-quality',
                           formal_name='chi_s',
                           unit='',
                           value=0.0,
                           info='Reactor STeam Quality',
                           latex_name='$\chi$')

        quantities.append(quality)

        self.coolant_outflow_phase = Phase(self.initial_time,
                                           time_unit='s',
                                           quantities=quantities)

        # Neutron phase history
        quantities = list()

        neutron_dens = Quantity(name='neutron-dens',
                                formal_name='n',
                                unit='1/m^3',
                                value=0.0,
                                info='Rel. Reactor Neutron Density',
                                latex_name='$n$')

        quantities.append(neutron_dens)

        delayed_neutrons_0 = np.zeros(6)

        delayed_neutron_cc = Quantity(name='delayed-neutrons-cc',
                                      formal_name='c_i',
                                      unit='1/m^3 ',
                                      value=delayed_neutrons_0,
                                      info='Rel. Delayed Neutron Precursors',
                                      latex_name='$c_i$')

        quantities.append(delayed_neutron_cc)

        self.neutron_phase = Phase(self.initial_time,
                                   time_unit='s',
                                   quantities=quantities)

        #reactor paramaters
        quantities = list()

        fuel_temp = Quantity(name='fuel-temp',
                             formalName='T_f',
                             unit='k',
                             value=273.15,
                             info='Reactor Nuclear Fuel Temperature',
                             latex_name='$T_f$')

        quantities.append(fuel_temp)

        reg_rod_position = Quantity(name='reg-rod-position',
                                    formal_name='reg rod position',
                                    unit='m',
                                    value=0.0,
                                    info='Reactor Regulating Rod Position',
                                    latex_name='$x_p$')

        quantities.append(reg_rod_position)

        self.reactor_phase = Phase(self.initial_time,
                                   time_unit='s',
                                   quantities=quantities)

        # Initialize inflow
        self.params['inflow-cool-temp'] = 273.15

        return
Exemplo n.º 6
0
    def __init__(self, n_groups=1, pool_size=0.0):
        '''
        Parameters
        ----------
        n_groups: int
            Number of groups in the population.
        pool_size: float
            Upperbound on the range of the existing population groups. A random value
            from 0 to the upperbound value will be assigned to each group.

        '''

        super().__init__()

        self.port_names_expected = ['parole','adjudication','jail','community']

        quantities      = list()
        self.ode_params = dict()

        self.initial_time = 0.0 * unit.day
        self.end_time     = 100 * unit.day
        self.time_step    = 0.5 * unit.day

        unit.percent = 1/100

        # Population groups
        self.n_groups = n_groups

        # Prison population groups
        fpg_0 = np.random.random(self.n_groups) * pool_size
        fpg = Quantity(name='npg', formal_name='prison-pop-grps',
                latex_name = '$n_p^{(g)}$',
                unit='# offenders', value=fpg_0, info='Prison Population Groups')
        quantities.append(fpg)

        # Model parameters: commitment coefficients 

        # Prison to community
        a = 10*unit.percent/unit.year * np.ones(self.n_groups)
        b = 15*unit.percent/unit.year * np.ones(self.n_groups)
        cp0g_0 = (a + (b-a)*np.random.random(self.n_groups)) / self.n_groups
        cp0g = Quantity(name='cp0g', formal_name='commit-community-coeff-grps',
               unit='1/s', value=cp0g_0)
        self.ode_params['commit-to-community-coeff-grps'] = cp0g_0
        quantities.append(cp0g)

        # Prison to parole  
        a = 20*unit.percent/unit.year * np.ones(self.n_groups)
        b = 25*unit.percent/unit.year * np.ones(self.n_groups)
        cpeg_0 = (a + (b-a)*np.random.random(self.n_groups)) / self.n_groups
        cpeg = Quantity(name='cpeg', formal_name='commit-parole-coeff-grps',
               unit='1/s', value=cpeg_0)
        self.ode_params['commit-to-parole-coeff-grps'] = cpeg_0
        quantities.append(cpeg)

        # Death term
        a = 0.8*unit.percent/unit.year * np.ones(self.n_groups)
        b = 0.9*unit.percent/unit.year * np.ones(self.n_groups)
        dpg_0 = (a + (b-a)*np.random.random(self.n_groups)) / self.n_groups
        self.ode_params['death-rates-coeff'] = dpg_0

        # Phase state
        self.population_phase = Phase(self.initial_time, time_unit='s',
                quantities=quantities)

        self.population_phase.SetValue('npg', fpg_0, self.initial_time)

        # Initialize inflows to zero
        self.ode_params['parole-inflow-rates']       = np.zeros(self.n_groups)
        self.ode_params['adjudication-inflow-rates'] = np.zeros(self.n_groups)
        self.ode_params['jail-inflow-rates']         = np.zeros(self.n_groups)

        return
Exemplo n.º 7
0
    def __init__(self, n_groups=1, pool_size=0.0):

        super().__init__()

        self.port_names_expected = ['prison','community']

        quantities      = list()
        self.ode_params = dict()

        self.initial_time = 0.0 * unit.day
        self.end_time     = 100 * unit.day
        self.time_step    = 0.5 * unit.day

        unit.percent = 1/100

        # Population groups
        self.n_groups = n_groups

        # Parole population groups
        feg_0 = np.random.random(self.n_groups) * pool_size
        feg = Quantity(name='feg', formal_name='parole-pop-grps',
                latex_name = '$n_e^{(g)}$',
                unit='# offenders', value=feg_0, info='Parole Population Groups')
        quantities.append(feg)

        # Model parameters: commitment coefficients

        # Parole to community
        a =  50*unit.percent/unit.year * np.ones(self.n_groups)
        b =  70*unit.percent/unit.year * np.ones(self.n_groups)
        ce0g_0 = (a + (b-a)*np.random.random(self.n_groups)) / self.n_groups
        ce0g = Quantity(name='ce0g', formal_name='commit-community-coeff-grps',
               unit='1/s', value=ce0g_0)
        self.ode_params['commit-to-community-coeff-grps'] = ce0g_0
        quantities.append(ce0g)

        # Parole to prison  
        a = 30*unit.percent/unit.year * np.ones(self.n_groups)
        b = 40*unit.percent/unit.year * np.ones(self.n_groups)
        cepg_0 = (a + (b-a)*np.random.random(self.n_groups)) / self.n_groups
        cepg = Quantity(name='cepg', formal_name='commit-prison-coeff-grps',
               unit='1/s', value=cepg_0)
        self.ode_params['commit-to-prison-coeff-grps'] = cepg_0
        quantities.append(cepg)

        # Death term
        a = 0.5*unit.percent/unit.year * np.ones(self.n_groups)
        b = 0.8*unit.percent/unit.year * np.ones(self.n_groups)
        deg_0 = (a + (b-a)*np.random.random(self.n_groups)) / self.n_groups
        self.ode_params['parole-death-rates-coeff'] = deg_0

        # Phase state
        self.population_phase = Phase(self.initial_time, time_unit='s',
                quantities=quantities)

        self.population_phase.SetValue('feg', feg_0, self.initial_time)

        # Initialize inflows to zero
        self.ode_params['prison-inflow-rates'] = np.zeros(self.n_groups)

        return
Exemplo n.º 8
0
    def __init__(self):
        """Constructor.

        Parameters
        ----------

        """

        super().__init__()

        self.port_names_expected = ['inflow', 'outflow']

        # Units

        # General attributes
        self.initial_time = 0.0*unit.second
        self.end_time = 1.0*unit.hour
        self.time_step = 10.0*unit.second

        self.show_time = (False, 10.0*unit.second)
        self.save = True

        self.log = logging.getLogger('cortix')
        self.__logit = True # flag indicating when to log

        # Domain attributes

        # Configuration parameters

        # Initialization

        self.inflow_temp = (20+273)*unit.K
        #self.inflow_pressure = 34*unit.bar
        self.inflow_pressure = 0.008066866*unit.mega*unit.pascal
        self.inflow_mass_flowrate = 67*unit.kg/unit.second

        self.outflow_temp = 50 + 273.15
        self.outflow_pressure = 34.0*unit.bar
        self.outflow_mass_flowrate = self.inflow_mass_flowrate

        # Inflow phase history
        quantities = list()

        flowrate = Quantity(name='flowrate',
                            formal_name='q_1', unit='kg/s',
                            value=self.outflow_mass_flowrate,
                            latex_name=r'$q_1$',
                            info='Condenser Inflow Mass Flowrate')

        quantities.append(flowrate)

        temp = Quantity(name='temp',
                        formal_name='T_1', unit='K',
                        value=self.outflow_temp,
                        latex_name=r'$T_1$',
                        info='Condenser Inflow Temperature')

        quantities.append(temp)

        self.inflow_phase = Phase(time_stamp=self.initial_time,
                                  time_unit='s', quantities=quantities)

        # Outflow phase history
        quantities = list()

        flowrate = Quantity(name='flowrate',
                            formal_name='q_2', unit='kg/s',
                            value=self.outflow_mass_flowrate,
                            latex_name=r'$q_2$',
                            info='Condenser Outflow Mass Flowrate')

        quantities.append(flowrate)

        temp = Quantity(name='temp',
                        formal_name='T_2', unit='K',
                        value=self.outflow_temp,
                        latex_name=r'$T_2$',
                        info='Condenser Outflow Temperature')

        quantities.append(temp)

        press = Quantity(name='pressure',
                         formal_name='P_2', unit='Pa',
                         value=self.outflow_pressure,
                         latex_name=r'$P_2$',
                         info='Condenser Outflow Pressure')

        quantities.append(press)

        self.outflow_phase = Phase(time_stamp=self.initial_time,
                                   time_unit='s', quantities=quantities)
Exemplo n.º 9
0
    def __init__(self,
                 n_groups=1,
                 non_offender_adult_population=100,
                 offender_pool_size=0.0,
                 free_offender_pool_size=0.0):
        """Constructor.

        Parameters
        ----------
        n_groups: int
            Number of groups in the population.
        non_offender_adult_population: float
            Pool of individuals reaching the adult age (SI) unit. Default: 100.
        offender_pool_size: float
            Upperbound on the range of the existing population groups. A random value
            from 0 to the upperbound value will be assigned to each group. This is
            typically a small number, say a fraction of a percent.

        """

        super().__init__()

        self.port_names_expected = [
            'probation', 'adjudication', 'jail', 'prison', 'arrested', 'parole'
        ]

        quantities = list()
        self.ode_params = dict()

        self.initial_time = 0.0 * unit.day
        self.end_time = 100 * unit.day
        self.time_step = 0.5 * unit.day
        self.show_time = (False, 10 * unit.day)
        self.log = logging.getLogger('cortix')

        unit.percent = 1 / 100

        # Population groups
        self.n_groups = n_groups

        # Community non-offender population
        n0_0 = np.array([float(non_offender_adult_population)])
        n0 = Quantity(name='n0',
                      formal_name='non-offender-adult-pop',
                      latex_name='$n_0$',
                      unit='# adults',
                      value=n0_0,
                      info='Non-Offender Adult Population')
        quantities.append(n0)

        # Community free-offender population groups
        f0g_0 = np.random.random(self.n_groups) * offender_pool_size
        f0g = Quantity(name='f0g',
                       formal_name='free-offender-pop-grps',
                       latex_name='$n_0^{(g)}$',
                       unit='# offenders',
                       value=f0g_0,
                       info='Free-Offender Population Groups')
        quantities.append(f0g)

        # Model parameters: commitment coefficients

        # Community non-offenders to offenders (arrested)
        a = 0.6 * unit.percent / unit.year * np.ones(self.n_groups)
        b = 0.8 * unit.percent / unit.year * np.ones(self.n_groups)
        c00g_0 = (a +
                  (b - a) * np.random.random(self.n_groups)) / self.n_groups
        c00g = Quantity(name='c00g',
                        formal_name='non-offenders-commit-arrested-coeff-grps',
                        unit='1/s',
                        value=c00g_0)
        self.ode_params['non-offenders-commit-to-arrested-coeff-grps'] = c00g_0
        quantities.append(c00g)

        # Community free-offenders to arrested (recidivism)
        a = 0.8 * unit.percent / unit.year * np.ones(self.n_groups)
        b = 0.9 * unit.percent / unit.year * np.ones(self.n_groups)
        c0rg_0 = (a +
                  (b - a) * np.random.random(self.n_groups)) / self.n_groups
        c0rg = Quantity(
            name='c0rg',
            formal_name='free-offenders-commit-arrested-coeff-grps',
            value=c0rg_0,
            unit='1/s')
        self.ode_params[
            'free-offenders-commit-to-arrested-coeff-grps'] = c0rg_0
        quantities.append(c0rg)

        # Death term for community offenders
        a = 0.8 * unit.percent / unit.year * np.ones(self.n_groups)
        b = 1.0 * unit.percent / unit.year * np.ones(self.n_groups)
        d0g_0 = (a + (b - a) * np.random.random(self.n_groups)) / self.n_groups
        self.ode_params['free-offenders-death-rates-coeff'] = d0g_0

        # Death term for community non-offenders
        a = 0.5 * unit.percent / unit.year
        b = 1.0 * unit.percent / unit.year
        d0_0 = a + (b - a) * np.random.random()
        self.ode_params['non-offenders-death-rate-coeff'] = d0_0

        # Maturity term for community non-offenders
        a = 1.5 * unit.percent / unit.year
        b = 2.5 * unit.percent / unit.year
        s0_0 = a + (b - a) * np.random.random()
        self.ode_params['non-offenders-maturity-rate-coeff'] = s0_0
        self.ode_params[
            'non_offender_adult_population'] = non_offender_adult_population

        # Phase state
        self.population_phase = Phase(self.initial_time,
                                      time_unit='s',
                                      quantities=quantities)

        self.population_phase.SetValue('n0', n0_0, self.initial_time)
        self.population_phase.SetValue('f0g', f0g_0, self.initial_time)

        # Initialize inflows to zero
        self.ode_params['prison-inflow-rates'] = np.zeros(self.n_groups)
        self.ode_params['parole-inflow-rates'] = np.zeros(self.n_groups)
        self.ode_params['arrested-inflow-rates'] = np.zeros(self.n_groups)
        self.ode_params['jail-inflow-rates'] = np.zeros(self.n_groups)
        self.ode_params['adjudication-inflow-rates'] = np.zeros(self.n_groups)
        self.ode_params['probation-inflow-rates'] = np.zeros(self.n_groups)
Exemplo n.º 10
0
    def __init__(self):
        """Constructor.

        Parameters
        ----------
        None

        Notes
        -----

        VFdA: as of now both turbines are supposed to send the same information
              to the condenser. This is to be changed in the future to handle
              different turbine steam conditions outflow.

        Ports:

         + `inflow-1`: individual inflow from a turbine module.
         + `inflow-2`: individual inflow from a turbine module.
         + `outflow`: combined outflow from condenser.

        Attributes:

         + inflow_state: dict
            ['quality']: 0-1 quality of steam; 1 dew point steam;
                         >1 super heated; 0 bubble boint; <0 subcooled liquid.
            ['temp']: Runoff temperature from the turbine. Indicates how much
                      superheat must be removed before condensation can begin.
            ['pressure']: Not used.
            ['flowrate']: Half the amount of liquid (kg/s) that the condenser
                          must process each second.
            ['time']:     Current simulation time in seconds.

        """

        super().__init__()

        self.port_names_expected = ['inflow-1', 'inflow-2', 'outflow']

        # Units
        self.meter = Condenser.meter
        self.second = Condenser.second
        self.m_per_s = Condenser.m_per_s
        self.kg_per_s = Condenser.kg_per_s

        # General attributes
        self.initial_time = 0.0 * self.second
        self.end_time = 0.0 * self.second

        self.show_time = (False, 10.0)
        self.time_step = 10.0
        self.log = logging.getLogger('cortix')

        # Domain attributes
        self.inflow_state = None
        self.pipe_diameter = 0.1 * self.meter
        self.liquid_velocity = 10.0 * self.m_per_s
        self.cooling_water_flowrate = 100000.0 * self.kg_per_s
        self.heat_transfer_area = 10200.0  # m2, or 500 4m long, 0.1m diameter pipes
        self.condensation_ht_coeff = 5000.0  # w/m-k
        self.subcooling_ht_coeff = 1000.0  # w/m-k
        self.ss_temp = 287.15  # Initial and ending temperature of the condenser
        self.inlet_pressure = 0.005  #MPa, the runoff pressure from the LPT
        self.coolant_inflow_temp = 287.15  #K, condenser coolant inflow temp
        # Outflow phase history
        quantities = list()

        flowrate = Quantity(name='condenser-runoff-flowrate',
                            formal_name='Condenser Runoff Flowrate',
                            unit='kg/s',
                            value=0.0,
                            info='Condenser Outflow Flowrate',
                            latex_name=r'$Q$')

        quantities.append(flowrate)

        temp = Quantity(name='temp',
                        formal_name='Condenser Runoff Temp.',
                        unit='K',
                        value=0.0,
                        info='Condenser Outflow Temperature',
                        latex_name=r'$T_o$')

        quantities.append(temp)

        self.outflow_phase = Phase(time_stamp=self.initial_time,
                                   time_unit='s',
                                   quantities=quantities)
Exemplo n.º 11
0
    def __init__(self, primary_inflow_temp=20+273.15, secondary_inflow_temp=20+273.15):
        """Constructor.

        Parameters
        ----------

        """

        super().__init__()

        self.port_names_expected = ['primary-inflow', 'primary-outflow',
                                    'secondary-inflow', 'secondary-outflow']

        # General attributes
        self.initial_time = 0.0*unit.second
        self.end_time = 1.0*unit.hour
        self.time_step = 10.0*unit.second

        self.show_time = (False, 10.0*unit.second)
        self.save = True

        self.log = logging.getLogger('cortix')
        self.__logit = True # flag indicating when to log

        # Domain attributes

        # Configuration parameters
        self.discard_tau_recording_before = 2*unit.minute
        self.heat_transfer_area = 1665.57*unit.meter**2

        self.helicoil_outer_radius = 16/2*unit.milli*unit.meter
        self.helicoil_tube_wall = 0.9*unit.milli*unit.meter
        self.helicoil_inner_radius = self.helicoil_outer_radius - self.helicoil_tube_wall
        self.helicoil_length = 22.3*unit.meter
        self.n_helicoil_tubes = 1380

        self.wall_temp_delta_primary = 1.5*unit.K
        self.wall_temp_delta_secondary = 1.5*unit.K

        self.iconel690_k = 12.1*unit.watt/unit.meter/unit.kelvin

        self.helix_to_cylinder = 1./.928

        self.secondary_volume = math.pi * self.helicoil_inner_radius**2 * \
                                self.helicoil_length * self.n_helicoil_tubes *\
                                self.helix_to_cylinder

        self.primary_volume = 0.5 * self.secondary_volume

        # Ratio of the tube bundle pithc transverse to flow to parallel to flow
        self.tube_bundle_pitch_ratio = 1.5  # st/sl

        # Initialization
        self.primary_inflow_temp = primary_inflow_temp

        self.primary_pressure = 127.6*unit.bar

        self.primary_mass_flowrate = 4.66e6*unit.lb/unit.hour

        self.primary_outflow_temp = self.primary_inflow_temp #- 2*unit.K

        self.secondary_inflow_temp = secondary_inflow_temp

        self.secondary_pressure = 34*unit.bar
        self.secondary_mass_flowrate = 67*unit.kg/unit.second

        self.secondary_outflow_temp = self.secondary_inflow_temp #- 2*unit.K

        self.secondary_outflow_quality = 0 # running value of quality

        # Derived quantities
        self.rho_p = 0.0
        self.cp_p = 0.0
        self.mu_p = 0.0
        self.k_p = 0.0
        self.prtl_p = 0.0
        self.rey_p = 0.0
        self.nusselt_p = 0.0

        self.rho_s = 0.0
        self.cp_s = 0.0
        self.mu_s = 0.0
        self.k_s = 0.0
        self.prtl_s = 0.0
        self.rey_s = 0.0
        self.nusselt_s = 0.0

        self.heat_sink_pwr = 0.0

        # Primary outflow phase history
        quantities = list()

        temp = Quantity(name='temp',
                        formal_name='T_1', unit='K',
                        value=self.primary_outflow_temp,
                        latex_name=r'$T_1$',
                        info='Steamer Primary Outflow Temperature')

        quantities.append(temp)

        flowrate = Quantity(name='flowrate',
                        formal_name='mdot', unit='kg/s',
                        value=self.primary_mass_flowrate,
                        latex_name=r'$\dot{m}_1$',
                        info='Steamer Primary Mass Flowrate')

        quantities.append(flowrate)

        self.primary_outflow_phase = Phase(time_stamp=self.initial_time,
                                           time_unit='s', quantities=quantities)

        # Secondary inflow phase history
        quantities = list()

        flowrate = Quantity(name='flowrate',
                            formal_name='m2i', unit='kg/s',
                            value=self.secondary_mass_flowrate,
                            latex_name=r'$\dot{m}_{2,in}$',
                            info='Steamer Secondary Inflow Mass Flowrate')

        quantities.append(flowrate)

        temp = Quantity(name='temp',
                        formal_name='T2i', unit='K',
                        value=self.secondary_inflow_temp,
                        latex_name=r'$T_{2,in}$',
                        info='Steamer Secondary Inflow Temperature')

        quantities.append(temp)

        self.secondary_inflow_phase = Phase(time_stamp=self.initial_time,
                                            time_unit='s', quantities=quantities)

        # Secondary outflow phase history
        quantities = list()

        flowrate = Quantity(name='flowrate',
                            formal_name='m_2', unit='kg/s',
                            value=self.secondary_mass_flowrate,
                            latex_name=r'$\dot{m}_2$',
                            info='Steamer Secondary Outflow Mass Flowrate')

        quantities.append(flowrate)

        temp = Quantity(name='temp',
                        formal_name='T_2', unit='K',
                        value=self.secondary_outflow_temp,
                        latex_name=r'$T_2$',
                        info='Steamer Secondary Outflow Temperature')

        quantities.append(temp)

        press = Quantity(name='pressure',
                         formal_name='P_2', unit='Pa',
                         value=self.secondary_pressure,
                         latex_name=r'$P_2$',
                         info='Steamer Secondary Outflow Pressure')

        quantities.append(press)

        quality = Quantity(name='quality',
                         formal_name='X', unit='',
                         value=self.secondary_outflow_quality,
                         latex_name=r'$\chi$',
                         info='Steamer Secondary Outflow Quality')

        quantities.append(quality)

        self.secondary_outflow_phase = Phase(time_stamp=self.initial_time,
                                             time_unit='s', quantities=quantities)

        # State phase history
        quantities = list()

        tau_p = Quantity(name='tau_p',
                        formal_name='Tau_p', unit='s',
                        value=0.0,
                        latex_name=r'$\tau_{p}$',
                        info='Steamer Primary Residence Time')

        quantities.append(tau_p)

        tau_s = Quantity(name='tau_s',
                        formal_name='Tau_s', unit='s',
                        value=0.0,
                        latex_name=r'$\tau_{s}$',
                        info='Steamer Secondary Residence Time')

        quantities.append(tau_s)

        heatflux = Quantity(name='heatflux',
                        formal_name="q''", unit='W/m$^2$',
                        value=0.0,
                        latex_name=r"$q''$",
                        info='Steamer Heat Flux')

        quantities.append(heatflux)

        nusselt_p = Quantity(name='nusselt_p',
                        formal_name='Nu_p', unit='',
                        value=0.0,
                        latex_name=r'$Nu_p$',
                        info='Steamer Primary Nusselt Number')

        quantities.append(nusselt_p)

        nusselt_s = Quantity(name='nusselt_s',
                        formal_name='Nu_s', unit='',
                        value=0.0,
                        latex_name=r'$Nu_s$',
                        info='Steamer Secondary Nusselt Number')

        quantities.append(nusselt_s)

        self.state_phase = Phase(time_stamp=self.initial_time,
                                 time_unit='s', quantities=quantities)
Exemplo n.º 12
0
    def __init__(self):
        '''
        Parameters
        ----------
        params: dict
            All parameters for the module in the form of a dictionary.

        '''

        super().__init__()

        self.port_names_expected = [
            'coolant-inflow', 'coolant-outflow', 'signal-out', 'signal-in'
        ]

        unit.kg = unit.kilo * unit.gram
        unit.meter = 1.0
        unit.second = 1.0
        unit.pascal = 1.0
        unit.joule = 1.0
        unit.kj = unit.kilo * unit.joule
        unit.kelvin = 1.0
        unit.watt = 1.0
        unit.barn = 1.0e-28 * unit.meter**2

        self.initial_time = 0.0 * unit.day
        self.end_time = 4 * unit.hour
        self.time_step = 10.0 * unit.second
        self.show_time = (False, 10.0)

        self.log = logging.getLogger('cortix')

        self.params = dict()

        # General parameters

        #self.params['gen-time'] = 1.0e-4  # s
        self.params['gen-time'] = 6.5e-5  # s
        #self.params['beta']     = 6.5e-3  #
        self.params['beta'] = 7.8e-3  #
        #self.params['species-decay']     = [0.0124, 0.0305, 0.111, 0.301, 1.14, 3.01] # 1/sec
        self.params['species-decay'] = [
            0.0127, 0.0317, 0.1160, 0.3111, 1.4003, 3.8708
        ]  # 1/sec
        #self.params['species_rel_yield'] = [0.033, 0.219, 0.196, 0.395, 0.115, 0.042]
        self.params['xi'] = [
            0.00026, 0.00146, 0.00129, 0.00279, 0.0008, 0.00018
        ]
        beta_i = xi * beta / sum(xi)

        self.params['alpha_n'] = -5e-4  # control rod reactivity worth
        self.params['alpha_n'] = -5e-5  # control rod reactivity worth
        self.params['alpha_tn_fake'] = -1e-4 / 20  # -1.0e-6

        self.params['n_dens_ss_operation'] = 1e15 * 1e4 / 2200  # neutrons/m^2

        self.params['fis_energy'] = 180 * 1.602e-13 * unit.joule  # per fission
        self.params['sigma_f_o'] = 586.2 * unit.barn
        self.params['temp_o'] = unit.convert_temperature(20, 'C', 'K')
        self.params['temp_c_ss_operation'] = unit.convert_temperature(
            550, 'C', 'K')  # desired ss operation temp of coolant
        self.params['temp_f_safe_max'] = unit.convert_temperature(
            1100, 'C', 'K')
        self.params['thermal_neutron_velo'] = 2200 * unit.meter / unit.second
        self.params[
            'fis_nuclide_num_dens_fake'] = 1e17 / 40 * 1.0e+6  # (fissile nuclei)/m3

        self.params['fuel_dens'] = 2500 * unit.kg / unit.meter**3
        self.params['cp_fuel'] = 720 * unit.joule / unit.kg / unit.kelvin
        #self.params['fuel_volume'] = 1.5  * unit.meter**3
        self.params['fuel_volume'] = 1.5 * unit.meter**3

        self.params['coolant_dens'] = 0.1786 * unit.kg / unit.meter**3
        self.params[
            'cp_coolant'] = 20.78 / 4e-3 * unit.joule / unit.kg / unit.kelvin
        self.params['coolant_volume'] = 0.8 * unit.meter**3

        self.params['ht_coeff'] = 800 * unit.watt / unit.kelvin

        self.params['strict'] = True  # apply strict testing to some quantities

        self.params['shutdown'] = False
        self.params['shutdown_time'] = 0.0  # s
        self.params['rho_shutdown'] = 0.0  # s

        self.params[
            'coolant_flowrate_forced'] = 1650.0 * unit.gallon / unit.minute

        # Initial data parameters

        gen_time = self.params['gen-time']  # retrieve neutron generation time
        self.params['q_0'] = 1 / gen_time  # pulse at t = 0
        self.params['n_ss'] = 0.0  # neutronless steady state before start up
        self.params['n_dens_ref'] = 1.0
        rho_0_over_beta = 0.5  # $
        beta = self.params['beta']  # retrieve the delayed neutron fraction
        self.params[
            'reactivity'] = rho_0_over_beta * beta  # "rho/beta = 10 cents"
        self.params['temp_0'] = self.params['temp_o']
        self.params['tau_fake'] = .025  # s residence time

        # Setup steady state initial conditions

        n_species = len(self.params['species-decay'])

        assert len(self.params['species_rel_yield']) == n_species

        c_vec_0 = np.zeros(n_species,
                           dtype=np.float64)  # initialize conentration vector

        species_decay = self.params[
            'species-decay']  # retrieve list of decay constants
        lambda_vec = np.array(species_decay)  # create a numpy vector

        species_rel_yield = self.params['species_rel_yield']
        beta = self.params['beta']
        beta_vec = np.array(
            species_rel_yield) * beta  # create the beta_i's vector

        gen_time = self.params['gen-time']  # retrieve neutron generation time

        n_ss = self.params['n_ss']
        c_vec_ss = beta_vec / lambda_vec / gen_time * n_ss  # compute the steady state precursors number density

        self.params['c_vec_ss'] = c_vec_ss

        # setup initial condition for variables
        self.params['n_0'] = n_ss
        self.params['c_vec_0'] = c_vec_ss
        self.params['rho_0'] = self.params['reactivity']

        self.params['temp_f_0'] = self.params[
            'temp_0'] + 10.0  # helps startup integration
        self.params['temp_c_0'] = self.params['temp_0']

        # Reactor phase history
        quantities = list()

        neutron_dens = Quantity(name='neutron-dens',
                                formal_name='n',
                                unit='1/m^3',
                                value=self.params['n_0'],
                                info='Reactor Neutron Density',
                                latex_name='$n$')

        quantities.append(neutron_dens)

        delayed_neutron_cc = Quantity(name='delayed-neutrons-cc',
                                      formal_name='c_i',
                                      unit='1/m^3',
                                      value=self.params['c_vec_0'],
                                      info='Delayed Neutron Precursors',
                                      latex_name='$c_i$')

        quantities.append(delayed_neutron_cc)

        fuel_temp = Quantity(name='fuel-temp',
                             formal_name='T_f',
                             unit='K',
                             value=self.params['temp_f_0'],
                             info='Reactor Nuclear Fuel Temperature',
                             latex_name='$T_f$')

        quantities.append(fuel_temp)

        temp_in = self.params['temp_c_0']
        pwr_0 = self.params['coolant_volume']/self.params['tau_fake'] * \
                self.params['coolant_dens'] * self.params['cp_coolant'] * \
                (self.params['temp_c_0'] - temp_in)

        power = Quantity(name='power',
                         formal_name='Pwr',
                         unit='W',
                         value=pwr_0,
                         info='Reactor Power',
                         latex_name='$\mathrm{Prw}$')

        quantities.append(power)

        self.reactor_phase = Phase(self.initial_time,
                                   time_unit='s',
                                   quantities=quantities)

        # Coolant outflow phase history
        quantities = list()

        flowrate = Quantity(name='flowrate',
                            formal_name='q_c',
                            unit='kg/s',
                            value=0.0,
                            info='Reactor Outflow Coolant Flowrate',
                            latex_name='$q_c$')

        quantities.append(flowrate)

        temp = Quantity(name='temp',
                        formal_name='T_c',
                        unit='K',
                        value=self.params['temp_c_0'],
                        info='Reactor Outflow Coolant Temperature',
                        latex_name='$T_c$')

        quantities.append(temp)

        self.coolant_phase = Phase(self.initial_time,
                                   time_unit='s',
                                   quantities=quantities)

        # Initialize inflow
        self.params['inflow-cool-temp'] = self.params['temp_c_0']

        self.__logit = False  # flag for when to log throughout the code

        return
Exemplo n.º 13
0
    def __init__(self, params):
        """Constructor.

        Parameters
        ----------
        params: dict
            All parameters for the module in the form of a dictionary.

        """

        super().__init__()

        self.port_names_expected = ['coolant-inflow', 'coolant-outflow',
                                    'RCIS-inflow', 'RCIS-outflow']

        self.params = params

        self.initial_time = params['start-time']
        self.end_time = params['end-time']
        self.time_step = 10.0

        self.show_time = (False, 10.0)

        self.log = logging.getLogger('cortix')
        self.__logit = False

        #Data pertaining to one-group energy neutron balance
        self.gen_time = 1.0e-4  # s
        self.beta = 6.5e-3  # params['k_infty'] = 1.3447
        # geometric buckling; B = (pi/R)^2 + (2.405/H)^2
        self.buckling = (math.pi/237.5)**2.0 + (2.405/410)**2.0
        self.q_0 = 5000
        # fuel macroscopic absorption cross section, cm^-1
        self.fuel_macro_a = 1.34226126162
        # moderator microscopic absorption cross section, cm^2
        self.mod_micro_a = 0.332 * unit.zepto * unit.milli
        #number density of the fuel, atoms/cm^3
        self.n_fuel = 1.9577906e+21
        #resonance integral, I (dimensionless)
        self.I = 40.9870483 * unit.zepto * unit.milli
        # moderator microscopic scattering cross section, cm^2
        self.mod_micro_s = 20 * unit.zepto * unit.milli
        self.xi = 1 # average logarithmic energy decrement for light water
        # energy of a neutron produced by fissioning, in electron volts
        self.E0 = 2 * unit.mega
        self.mod_mu0 = 0.71 # migration and diffusion area constants
        self.eta = 1.03 # fast fission factor
        self.epsilon = 2.05 # neutron multiplecation factor
        self.mod_molar_mass = 18 # g/mol
        
        # Delayed neutron emission
        self.species_decay = [0.0124, 0.0305, 0.111, 0.301, 1.14, 3.01] # 1/sec
        self.species_rel_yield = [0.033, 0.219, 0.196, 0.395, 0.115, 0.042]

        # Data pertaining to two-temperature heat balances
        self.fis_energy = 180 * 1.602e-13 # J/fission
        self.enrich = 4.3/100.
        self.fuel_mat_mass_dens = 10.5 # g/cc
        #params['moderator_fuel_ratio'] = 387 # atomic number concentration ratio
        self.sigma_f_o = 586.2 * 100 * 1e-30 # m2
        self.temp_o = 20 + 273.15 # K
        self.thermal_neutron_velo = 2200 # m/s

        self.fis_nuclide_num_dens = 9.84e26 # (fissile nuclei)/m3

        self.q_c = 303 # volumetric flow rate

        self.fuel_dens = 10500 # kg/m3
        self.cp_fuel = 175 # J/(kg K)
        self.fuel_volume = 7.25  # m3

        self.steam_flowrate = 1820 # kg/s
        self.coolant_dens = 1000 #  kg/m3
        self.cp_coolant = 3500# J/(mol K) - > J/(kg K)
        self.coolant_volume = 7 #m3

        self.ht_coeff = 45000000

        # J/(fission sec) 1.26 t^-1.2 (t in seconds)
        self.fis_beta_energy = 1.26 * 1.602e-13
        # J/(fission sec) 1.40 t^-1.2 (t in seconds)
        self.fis_alpha_energy = 1.40 * 1.602e-13
        # % subcooling based on the % subcooling that exists at steady state
        self.subcooling_percent = 1 #(1 -(steam_table._Region4(7, 0)["h"]  - steam_table._Region1(493.15, 7)["h"])/(steam_table._Region4(7,0)["h"]))
        self.shutdown_temp_reached = False
        self.q_source_status = 'in' # is q_source inserted (in) or withdrawn (out)

        gen_time = self.gen_time # retrieve neutron generation time
        self.q_0 = 0.1

        self.n_ss = 0 # neutronless steady state before start up

        rho_0_over_beta = 0.25 # $
        beta = self.beta

        # control rod reactivity worth; enough to cancel out the negative
        self.alpha_n = 0

        self.reactivity = rho_0_over_beta * beta # "rho/beta = 10 cents"

        self.temp_o = self.temp_o

        self.tau = 1 # s
        self.malfunction_subcooling = 0.75
        self.alpha_n_malfunction = 0
        n_species = len(self.species_decay)

        assert len(self.species_rel_yield) == n_species

        # initialize concentration vector
        c_vec_0 = np.zeros(n_species, dtype=np.float64)
        # retrieve list of decay constants
        species_decay = self.species_decay
        lambda_vec = np.array(species_decay) # create a numpy vector
        beta = self.beta
        species_rel_yield = self.species_rel_yield
        # create the beta_i's vector
        beta_vec = np.array(species_rel_yield) * beta
        gen_time = self.gen_time # retrieve neutron generation time
        n_ss = self.n_ss
        # compute the steady state precursors number density
        c_vec_ss = beta_vec/lambda_vec/gen_time * n_ss
        self.c_vec_ss = c_vec_ss
        # setup initial condition for variables
        self.n_0 = n_ss
        self.c_vec_0 = c_vec_ss
        self.rho_0 = self.reactivity

        self.RCIS_operating_mode = 'offline'

        # Coolant outflow phase history
        quantities = list()

        flowrate = Quantity(name='flowrate', formal_name='q_c', unit='kg/s', value=0.0,
                            info='Reactor Outflow Coolant Flowrate', latex_name=r'$q_c$')

        quantities.append(flowrate)

        temp = Quantity(name='temp', formal_name='T_c', unit='K', value=params['coolant-temp'],
                        info='Reactor Outflow Coolant Temperature', latex_name=r'$T_c$')

        quantities.append(temp)

        press = Quantity(name='pressure', formal_name='P_c', unit='Pa', value=0.0,
                         info='Reactor Outflow Coolant Pressure', latex_name=r'$P_c$')

        quantities.append(press)

        quality = Quantity(name='steam-quality', formal_name='chi_s', unit='', value=0.0,
                           info='Reactor Steam Quality', latex_name=r'$\chi$')
        quantities.append(quality)

        self.coolant_outflow_phase = Phase(time_stamp=self.initial_time, time_unit='s', quantities=quantities)

        # Neutron phase history
        quantities = list()

        neutron_dens = Quantity(name='neutron-dens', formal_name='n', unit='1/m^3',
                                value=params['n-dens'], info='Rel. Reactor Neutron Density', latex_name=r'$n$')

        quantities.append(neutron_dens)

        delayed_neutron_cc = Quantity(name='delayed-neutrons-cc', formal_name='c_i',
                                      unit='1/m^3 ', value=params['delayed-neutron-cc'],
                                      info='Rel. Delayed Neutron Precursors', latex_name=r'$c_i$')
        quantities.append(delayed_neutron_cc)

        self.neutron_phase = Phase(time_stamp=self.initial_time, time_unit='s',
                                   quantities=quantities)

        # Reactor phase
        quantities = list()

        fuel_temp = Quantity(name='fuel-temp', formalName='T_f', unit='K',
                             value=params['fuel-temp'], info='Reactor Nuclear Fuel Temperature',
                             latex_name=r'$T_f$')

        quantities.append(fuel_temp)

        reg_rod_position = Quantity(name='reg-rod-position',
                                    formal_name='reg rod position', unit='m', value=0.0,
                                    info='Reactor Regulating Rod Position', latex_name=r'$x_p$')

        quantities.append(reg_rod_position)

        self.reactor_phase = Phase(time_stamp=self.initial_time, time_unit='s',
                                   quantities=quantities)

        # Initialize inflow
        self.params['inflow-cool-temp'] = params['condenser-runoff-temp']

        self.params['decay-heat-0'] = 0
        # Set up initial decay heat value
        if self.params['shutdown-mode']:
            temp = params['fuel-temp']
            n_dens = params['n-dens']
            decay_heat = self.__nuclear_pwr_dens_func(999, temp, n_dens, params)
            decay_heat *= 0.0622 # assume decay heat at 6.5% total power
            self.params['decay-heat-0'] = decay_heat