Exemplo n.º 1
0
    def plt(self):
        if self.value_name is None:
            self.value_name = [str(i) for i in range(self.size)]

        if self.size == 0:
            return
        if len(self.value_name) != self.size:
            raise ValueError('size of value_name and size are not match')
        para = copy.deepcopy(self.para)
        fig = plt.figure(**para)
        for pic_id in range(self.size):
            legend_name = []

            def color_list():
                for col in ['y', 'purple', 'blue', 'red']:
                    yield col
            color_generator = color_list()
            for (key, values) in self.data.items():
                values_array = np.array(values)
                legend_name.append(key)
                line_color = 'k' if key=='set point' else next(color_generator)
                x_array = np.arange(0, values_array.shape[0], 1)

                if line_color is 'k':
                    plt.plot(x_array/3, values_array[:, pic_id], c=line_color,linewidth=4)
                else:
                    plt.plot(x_array/3, values_array[:, pic_id], c=line_color, linewidth=1)

            if not self.value_name[pic_id] == 'Concentration(In)' \
                    and not self.value_name[pic_id] == 'pulp speed(Feed In)':
                plt.legend(legend_name)

            plt.title(self.value_name[pic_id])
            plt.xlabel('time(minute)')
            from Control_Exp1001.demo.thickener.common import exp_name
            img_root = os.path.join('../images/', exp_name.get_exp_name()) +'/'
            img_name = str(self.value_name[pic_id])+'_'.join(legend_name)
            img_name = img_name.replace(' ', '_')
            plt.savefig(img_root + img_name + '.png', dpi=300)
            plt.show()
Exemplo n.º 2
0
    #"weight_matrix": [0, 0.002],
    "weight_matrix": [0, 0.004],
    "S": [0.0001, 0.0008],
    #"S": [0.0003, 0.0024],
    #"S": [0.0000, 0.000],
}
thickner_para = {
    "dt": 1,
    "noise_in": False,
    "noise_p": 0.002,
    "noise_type": 3,
    'time_length': 20,  # 浓密机每次仿真20秒
}
from Control_Exp1001.demo.thickener.common import exp_name
exp_name.set_exp_name('VIandHDP')
EXP_NAME = exp_name.get_exp_name()
img_path = os.path.join('../images', EXP_NAME)
if not os.path.exists(img_path):
    os.mkdir(img_path)


def new_vi():
    capacity = 2
    predict_round = 3000
    u_optim = 'sgd'
    gamma = 0.6
    replay_vi = ReplayBuffer(capacity=capacity)
    env_VI = Thickener(
        noise_p=0.03,
        noise_in=True,
    )