示例#1
0
def test_get_fc_list_vobcid_3():
    df = vobcDA.get_fault_list('2015-01-01T10:00', '2015-01-01T20:00', 248, -1,
                               None, 1, 1)
    assert df is not None
    assert df['loggedAt'].count() > 0
    dfSet = df['faultCodeSet'].unique()
    assert len(dfSet) > 1
    def add_vobc_fault(self, i, L = False):
        df_fc = vobcfault_m.get_fault_list(self.start,self.end,self.vobc_id[i])
        if (df_fc is None or df_fc.empty):
            return

        df_fault = df_fc[df_fc['faultCodeSet'] == 1]    
        df_rectify = df_fc[df_fc['faultCodeSet'] == 0]    

        self.fig.add_trace(go.Scatter(x=df_fault['loggedAt'], y=df_fault['velocity'], 
                name="Vobc Fault",
                #hover_name = "faultCode",
                text='Fault = ' + df_fault['faultName'],
                showlegend=L, 
                mode='markers', marker=dict(size=7, 
                                            line=dict(width=1, color = list(map(cfg.get_fault_color, df_fault['faultCode']))),
                                            symbol='x',
                                            color=list(map(cfg.get_fault_color, df_fault['faultCode']))
                                            )
                ),row=i+1, col=1)

        self.fig.add_trace(go.Scatter(x=df_rectify['loggedAt'], y=df_rectify['velocity'], 
                name="Vobc Fault Rectified",
                #hover_name = "faultCode",
                text='Fault = ' + df_rectify['faultName'],
                showlegend=L, 
                mode='markers', marker=dict(size=7, 
                                            line=dict(width=1, color = 'darkgreen'),
                                            symbol='circle',
                                            color='darkgreen'
                                            )
                ),row=i+1, col=1)
示例#3
0
 def __read_base_data(self):
     df = vobcfault_m.get_fault_list(self.start_date, self.end_date,
                                     self.vobc_id, self.fault_code,
                                     self.location, self.velocity_dropdown,
                                     self.apstatus)
     if len(df.index) != 0:
         #df.loggedAt = pd.DatetimeIndex(df.loggedAt).strftime("%Y-%m-%d")
         self.fc_df = df[df['faultCodeSet'] == 1]
     else:
         self.fc_df = df
示例#4
0
def test_get_fc_list_faultcode_nullvobc():
    df = vobcDA.get_fault_list('2015-01-01T10:00', '2015-01-01T20:00', None, 3)

    assert df['loggedAt'].count() > 0
    dfSet = df['faultCodeSet'].unique()
    assert util.IsInMemoryTrue(len(dfSet) == 2)
    dfFC = df['faultCode'].unique()
    assert util.IsInMemoryTrue(len(dfFC) == 1)
    assert util.IsInMemoryTrue(dfFC[0] == 3)

    dfVobc = df['vobcid'].unique()
    assert len(dfVobc) > 1
示例#5
0
def test_get_fc_list_vobcid_2():
    df = vobcDA.get_fault_list('2015-01-01T10:00', '2015-01-01T20:00', 248, -1,
                               None, 0, 0)
    assert df is not None
示例#6
0
def test_get_fc_list_nullvobc_nullfc():
    df = vobcDA.get_fault_list('2015-01-01T10:00', '2015-01-01T20:00')

    assert df['loggedAt'].count() > 0
    dfSet = df['faultCodeSet'].unique()
    assert len(dfSet) > 1