der_dispatch_app/main_app_new.py
def save_plots(self):
        """
        Save plots for comparison. Need to have OPF off run first and the OPF on for comparison.
        :return:
        """
        print("Saving plots to " + self.resFolder)
        results0 = pd.read_csv(os.path.join(self.opf_off_folder, "result.csv"), index_col='epoch time')
        results0.index = pd.to_datetime(results0.index, unit='s')
        if not os.path.exists(self.opf_off_folder):
            print('No unoptimized results to compare with')
            _log.info('No unoptimized results to compare with')
            return
        results1 = pd.read_csv(os.path.join(self.resFolder, "result.csv"), index_col='epoch time')
        results1.index = pd.to_datetime(results1.index, unit='s')
        size = (10, 10)
        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        ax.plot(results0[[u'Vmax (p.u.)']])
        ax.plot(results1[[u'Vmax (p.u.)']])
        ax.plot(results0[[u'Vavg (p.u.)']])
        ax.plot(results1[[u'Vavg (p.u.)']])
        ax.plot(results0[[u'Vmin (p.u.)']])
        ax.plot(results1[[u'Vmin (p.u.)']])
        ax.legend(
            ['Vmax (p.u.) OPF=0', 'Vmax (p.u.) OPF=1', 'Vavg (p.u.) OPF=0', 'Vavg (p.u.) OPF=1', 'Vmin (p.u.) OPF=0',
             'Vmin (p.u.) OPF=1'])
        fig.savefig(os.path.join(self.resFolder, "Vmax"), bbox_inches='tight')

        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        # ax.plot(results1[[u'solar_pct']] * 3320.0 * -1)
        ax.plot(results0[[u'PVGeneration(MW)']])
        ax.plot(results1[[u'PVGeneration(MW)']])
        ax.legend(['PV MW OPF=0', 'PV MW OPF=1'])

        # plt.show()
        fig.savefig(os.path.join(self.resFolder, "PV_Generation_MW"), bbox_inches='tight')

        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        # ax.plot(results1[[u'solar_pct']] * 3320.0 * -1)
        ax.plot(results0[[u'PVGeneration(MVAr)']])
        ax.plot(results1[[u'PVGeneration(MVAr)']])
        ax.legend(['PV MVar OPF=0', 'PV MVar OPF=1'])

        # plt.show()
        fig.savefig(os.path.join(self.resFolder, "PV_Generation_MVar"), bbox_inches='tight')

        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        ax.plot(results0[[u'Load Demand (MVAr)']])
        ax.plot(results1[[u'Load Demand (MVAr)']])
        ax.legend(['Load Demand (MVar) OPF=0', 'Load Demand (MVar) OPF=1'])
        fig.savefig(os.path.join(self.resFolder, "Load_Demand_MVar"), bbox_inches='tight')

        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        ax.plot(results0[[u'Load Demand (MW)']])
        ax.plot(results1[[u'Load Demand (MW)']])
        ax.legend(['Load Demand (MW) OPF=0', 'Load Demand (MW) OPF=1'])

        # plt.show()
        fig.savefig(os.path.join(self.resFolder, "Load_Demand_MW"), bbox_inches='tight')

        Save plots for comparison. Need to have OPF off run first and the OPF on for comparison.
        :return:
        
Save plots for comparison. Need to have OPF off run first and the OPF on for comparison.
Save plots for comparison . Need to have OPF off run first and the OPF on for comparison .
def save_plots(self):
        print("Saving plots to " + self.resFolder)
        results0 = pd.read_csv(os.path.join(self.opf_off_folder, "result.csv"), index_col='epoch time')
        results0.index = pd.to_datetime(results0.index, unit='s')
        if not os.path.exists(self.opf_off_folder):
            print('No unoptimized results to compare with')
            _log.info('No unoptimized results to compare with')
            return
        results1 = pd.read_csv(os.path.join(self.resFolder, "result.csv"), index_col='epoch time')
        results1.index = pd.to_datetime(results1.index, unit='s')
        size = (10, 10)
        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        ax.plot(results0[[u'Vmax (p.u.)']])
        ax.plot(results1[[u'Vmax (p.u.)']])
        ax.plot(results0[[u'Vavg (p.u.)']])
        ax.plot(results1[[u'Vavg (p.u.)']])
        ax.plot(results0[[u'Vmin (p.u.)']])
        ax.plot(results1[[u'Vmin (p.u.)']])
        ax.legend(
            ['Vmax (p.u.) OPF=0', 'Vmax (p.u.) OPF=1', 'Vavg (p.u.) OPF=0', 'Vavg (p.u.) OPF=1', 'Vmin (p.u.) OPF=0',
             'Vmin (p.u.) OPF=1'])
        fig.savefig(os.path.join(self.resFolder, "Vmax"), bbox_inches='tight')
        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        ax.plot(results0[[u'PVGeneration(MW)']])
        ax.plot(results1[[u'PVGeneration(MW)']])
        ax.legend(['PV MW OPF=0', 'PV MW OPF=1'])
        fig.savefig(os.path.join(self.resFolder, "PV_Generation_MW"), bbox_inches='tight')
        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        ax.plot(results0[[u'PVGeneration(MVAr)']])
        ax.plot(results1[[u'PVGeneration(MVAr)']])
        ax.legend(['PV MVar OPF=0', 'PV MVar OPF=1'])
        fig.savefig(os.path.join(self.resFolder, "PV_Generation_MVar"), bbox_inches='tight')
        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        ax.plot(results0[[u'Load Demand (MVAr)']])
        ax.plot(results1[[u'Load Demand (MVAr)']])
        ax.legend(['Load Demand (MVar) OPF=0', 'Load Demand (MVar) OPF=1'])
        fig.savefig(os.path.join(self.resFolder, "Load_Demand_MVar"), bbox_inches='tight')
        fig, ax = plt.subplots(figsize=size)
        plt.grid(True)
        ax.plot(results0[[u'Load Demand (MW)']])
        ax.plot(results1[[u'Load Demand (MW)']])
        ax.legend(['Load Demand (MW) OPF=0', 'Load Demand (MW) OPF=1'])
        fig.savefig(os.path.join(self.resFolder, "Load_Demand_MW"), bbox_inches='tight')
def save_plots ( self ) : print ( "Saving plots to " + self . resFolder ) results0 = pd . read_csv ( os . path . join ( self . opf_off_folder , "result.csv" ) , index_col = 'epoch time' ) results0 . index = pd . to_datetime ( results0 . index , unit = 's' ) if not os . path . exists ( self . opf_off_folder ) : print ( 'No unoptimized results to compare with' ) _log . info ( 'No unoptimized results to compare with' ) return results1 = pd . read_csv ( os . path . join ( self . resFolder , "result.csv" ) , index_col = 'epoch time' ) results1 . index = pd . to_datetime ( results1 . index , unit = 's' ) size = ( 10 , 10 ) fig , ax = plt . subplots ( figsize = size ) plt . grid ( True ) ax . plot ( results0 [ [ u'Vmax (p.u.)' ] ] ) ax . plot ( results1 [ [ u'Vmax (p.u.)' ] ] ) ax . plot ( results0 [ [ u'Vavg (p.u.)' ] ] ) ax . plot ( results1 [ [ u'Vavg (p.u.)' ] ] ) ax . plot ( results0 [ [ u'Vmin (p.u.)' ] ] ) ax . plot ( results1 [ [ u'Vmin (p.u.)' ] ] ) ax . legend ( [ 'Vmax (p.u.) OPF=0' , 'Vmax (p.u.) OPF=1' , 'Vavg (p.u.) OPF=0' , 'Vavg (p.u.) OPF=1' , 'Vmin (p.u.) OPF=0' , 'Vmin (p.u.) OPF=1' ] ) fig . savefig ( os . path . join ( self . resFolder , "Vmax" ) , bbox_inches = 'tight' ) fig , ax = plt . subplots ( figsize = size ) plt . grid ( True ) ax . plot ( results0 [ [ u'PVGeneration(MW)' ] ] ) ax . plot ( results1 [ [ u'PVGeneration(MW)' ] ] ) ax . legend ( [ 'PV MW OPF=0' , 'PV MW OPF=1' ] ) fig . savefig ( os . path . join ( self . resFolder , "PV_Generation_MW" ) , bbox_inches = 'tight' ) fig , ax = plt . subplots ( figsize = size ) plt . grid ( True ) ax . plot ( results0 [ [ u'PVGeneration(MVAr)' ] ] ) ax . plot ( results1 [ [ u'PVGeneration(MVAr)' ] ] ) ax . legend ( [ 'PV MVar OPF=0' , 'PV MVar OPF=1' ] ) fig . savefig ( os . path . join ( self . resFolder , "PV_Generation_MVar" ) , bbox_inches = 'tight' ) fig , ax = plt . subplots ( figsize = size ) plt . grid ( True ) ax . plot ( results0 [ [ u'Load Demand (MVAr)' ] ] ) ax . plot ( results1 [ [ u'Load Demand (MVAr)' ] ] ) ax . legend ( [ 'Load Demand (MVar) OPF=0' , 'Load Demand (MVar) OPF=1' ] ) fig . savefig ( os . path . join ( self . resFolder , "Load_Demand_MVar" ) , bbox_inches = 'tight' ) fig , ax = plt . subplots ( figsize = size ) plt . grid ( True ) ax . plot ( results0 [ [ u'Load Demand (MW)' ] ] ) ax . plot ( results1 [ [ u'Load Demand (MW)' ] ] ) ax . legend ( [ 'Load Demand (MW) OPF=0' , 'Load Demand (MW) OPF=1' ] ) fig . savefig ( os . path . join ( self . resFolder , "Load_Demand_MW" ) , bbox_inches = 'tight' )
Save plots for comparison.
Save plots for comparison .
"""
        Save plots for comparison. Need to have OPF off run first and the OPF on for comparison.
        :return:
        """ # ax.plot(results1[[u'solar_pct']] * 3320.0 * -1) # plt.show() # ax.plot(results1[[u'solar_pct']] * 3320.0 * -1) # plt.show() # plt.show()
None
self