示例#1
0
    def __init__(self, param_struct=None,
                 mld_numeric=None, mld_callable=None, mld_symbolic=None):

        param_struct = param_struct or res_demand_param_struct

        if is_all_None(mld_numeric, mld_callable, mld_symbolic):
            mld_symbolic = self.get_res_demand_mld_symbolic()

        super(ResDemandModel, self).__init__(mld_numeric=mld_numeric,
                                      mld_symbolic=mld_symbolic,
                                      mld_callable=mld_callable,
                                      param_struct=param_struct)
示例#2
0
    def __init__(self, param_struct=None, const_heat=True,
                 mld_numeric=None, mld_callable=None, mld_symbolic=None):

        param_struct = param_struct or dewh_param_struct

        if is_all_None(mld_numeric, mld_callable, mld_symbolic):
            mld_symbolic = self.get_dewh_mld_symbolic(const_heat=const_heat)

        super(DewhModel, self).__init__(mld_numeric=mld_numeric,
                                        mld_symbolic=mld_symbolic,
                                        mld_callable=mld_callable,
                                        param_struct=param_struct)
示例#3
0
    def update_models(self,
                      sim_model: MldSystemModel = ParNotSet,
                      control_model: MldSystemModel = ParNotSet):

        if is_all_None(self._sim_model, self._control_model, sim_model,
                       control_model):
            self._sim_model = MldSystemModel()
            self._control_model = None
        else:
            self._sim_model = sim_model if sim_model is not ParNotSet else self._sim_model or MldSystemModel(
            )
            self._control_model = control_model if control_model is not ParNotSet else self._control_model or None
示例#4
0
    def __init__(self, param_struct=None,
                 mld_numeric=None, mld_callable=None, mld_symbolic=None):

        param_struct = param_struct or pv_param_struct


        if is_all_None(mld_numeric, mld_callable, mld_symbolic):
            mld_symbolic = self.get_pv_mld_symbolic()

        super(PvModel, self).__init__(mld_numeric=mld_numeric,
                                      mld_symbolic=mld_symbolic,
                                      mld_callable=mld_callable,
                                      param_struct=param_struct)
示例#5
0
    def __init__(self, param_struct=None, num_devices=None,
                 mld_numeric=None, mld_callable=None, mld_symbolic=None):

        param_struct = param_struct or grid_param_struct

        num_devices = num_devices if num_devices is not None else 0

        if not np.issubdtype(type(num_devices), np.integer):
            raise ValueError("num_devices must be an integer")
        else:
            self._num_devices = num_devices

        if is_all_None(mld_numeric, mld_callable, mld_symbolic):
            mld_symbolic = self.get_grid_mld_symbolic(num_devices=num_devices)

        super(GridModel, self).__init__(mld_numeric=mld_numeric,
                                        mld_symbolic=mld_symbolic,
                                        mld_callable=mld_callable,
                                        param_struct=param_struct)
示例#6
0
    def update(self, x_k=None, omega_tilde_k=None, N_p=None, N_tilde=None,
               mld_numeric_k: MldModel = None, mld_numeric_tilde=None,
               mld_info_k: MldInfo = None, variables_k_neg1_struct=None):

        x_k_update = self._set_x_k(_disable_process_args=True,
                                   x_k=x_k,
                                   N_p=N_p, N_tilde=N_tilde,
                                   mld_numeric_k=mld_numeric_k, mld_numeric_tilde=mld_numeric_tilde,
                                   mld_info_k=mld_info_k)

        if x_k_update is not None:
            self._x_k = x_k_update

        omega_var_update = self._set_omega_var(_disable_process_args=True,
                                               omega_tilde_k=omega_tilde_k,
                                               N_p=N_p, N_tilde=N_tilde,
                                               mld_numeric_k=mld_numeric_k, mld_numeric_tilde=mld_numeric_tilde,
                                               mld_info_k=mld_info_k)

        if omega_var_update is not None:
            self._base_dict_update(omega=omega_var_update)

        if self.has_updated_version(sub_object_names=('mld_numeric_k', 'mld_numeric_tilde')):
            variables_update = (
                self.gen_optimization_vars(_disable_process_args=True,
                                           N_p=N_p, N_tilde=N_tilde,
                                           mld_numeric_k=mld_numeric_k, mld_numeric_tilde=mld_numeric_tilde,
                                           mld_info_k=mld_info_k))
            self._base_dict_update(variables_update)
            self.update_stored_version()
        else:
            variables_update = None

        if not is_all_None(x_k_update, omega_var_update, variables_update):
            state_output_vars_update = (
                self.gen_state_output_vars(_disable_process_args=True,
                                           variables=self,
                                           x_k=self.x_k, omega_tilde_k=self.omega_tilde_k,
                                           N_p=N_p, N_tilde=N_tilde,
                                           mld_numeric_k=mld_numeric_k, mld_numeric_tilde=mld_numeric_tilde,
                                           mld_info_k=mld_info_k))

            self._base_dict_update(state_output_vars_update)
        else:
            state_output_vars_update = None

        variables_k_neg1_struct_update = (
            self._set_vars_k_neg1(_disable_process_args=True,
                                  variables_k_neg1_struct=variables_k_neg1_struct,
                                  N_p=N_p, N_tilde=N_tilde,
                                  mld_numeric_k=mld_numeric_k, mld_numeric_tilde=mld_numeric_tilde,
                                  mld_info_k=mld_info_k))

        if variables_k_neg1_struct_update is not None:
            for var_name, var_k_neg1 in variables_k_neg1_struct_update.items():
                self[var_name].var_k_neg1 = var_k_neg1

        if not is_all_None(x_k_update, omega_var_update, variables_update, state_output_vars_update,
                           variables_k_neg1_struct_update):
            self.increment_version()
            self.set_build_required()

        self._update_set_with(N_p, N_tilde)