Explorar el Código

下行控制增加均衡控制功能

qingfeng hace 2 años
padre
commit
f5a1c351bf

BIN
LIB/BACKEND/__pycache__/DBManager.cpython-38.pyc


+ 53 - 41
USER/SPF/alibaba/08BatCrtl/BatParam.py

@@ -91,47 +91,53 @@ class BatParam:
 
             self.TrwVoltRate=-1
 
-        elif celltype==2: #中恒+华庭18650
-            self.Capacity = 2*9
-            self.CellVoltNums= 68
-            self.CellTempNums= 40
-            self.CellFullChrgVolt=4.2
-            self.CellFullChrgCrnt=-self.Capacity/2
-            self.FullChrgSoc=100
-            self.PackCrntDec=1
-            self.BalCurrent=0.015
-            self.LookTab_SOC = [0,	     5,	    10,	    15,	    20,	    25,	    30,	    35,	    40,	    45,	    50,	    55,	    60,	    65,	    70,	    75,	    80,	    85,	    90,	    95,	    100]
-            self.LookTab_OCV = [2.929,	3.2902,	3.3888,	3.425,	3.4846,	3.5382,	3.577,	3.6083,	3.638,	3.6786,	3.7127,	3.7596,	3.7853,	3.8371,	3.9081,	3.9127,	4.0097,	4.0314,	4.0463,	4.0969,	4.174]
-
-            self.CellOvLv1=4.04
-            self.CellOvLv2=4.05
-            self.CellUvLv1=2.99
-            self.CellUvLv2=2.950
-            self.CellVoltDiffLv1=0.35
-            self.CellVoltDiffLv2=0.4
-            self.PackVoltOvLv1=self.CellOvLv1*self.CellVoltNums
-            self.PackVoltOvLv2=self.CellOvLv2*self.CellVoltNums
-            self.PackVoltUvLv1=self.CellUvLv1*self.CellVoltNums
-            self.PackVoltUvLv2=self.CellUvLv2*self.CellVoltNums
-
-            self.CellTempUpLmt=119
-            self.CellTempLwLmt=-39
-            self.CellTempHighLv1=45
-            self.CellTempHighLv2=50
-            self.CellTempLowLv1=0
-            self.CellTempLowLv2=-5
-            self.CellTempDiffLv1=10
-            self.CellTempDiffLv2=15
-            self.CellTempRate=5
-
-            self.PackChgOc=-45
-            self.PackDisOc=200
-
-            self.LeakCurrentLv1=-10
-            self.LeakCurrentLv2=-15
-            self.LeakCurrentLv3=-50
-
-            self.TrwVoltRate=-1
+            #下行控制参数
+            self.CellDscVolt=3
+            self.DscPackSoc=15
+            self.BalGroup=8
+            self.BalNums=16
+
+        # elif celltype==2: #中恒+华庭18650
+        #     self.Capacity = 2*9
+        #     self.CellVoltNums= 68
+        #     self.CellTempNums= 40
+        #     self.CellFullChrgVolt=4.2
+        #     self.CellFullChrgCrnt=-self.Capacity/2
+        #     self.FullChrgSoc=100
+        #     self.PackCrntDec=1
+        #     self.BalCurrent=0.015
+        #     self.LookTab_SOC = [0,	     5,	    10,	    15,	    20,	    25,	    30,	    35,	    40,	    45,	    50,	    55,	    60,	    65,	    70,	    75,	    80,	    85,	    90,	    95,	    100]
+        #     self.LookTab_OCV = [2.929,	3.2902,	3.3888,	3.425,	3.4846,	3.5382,	3.577,	3.6083,	3.638,	3.6786,	3.7127,	3.7596,	3.7853,	3.8371,	3.9081,	3.9127,	4.0097,	4.0314,	4.0463,	4.0969,	4.174]
+
+        #     self.CellOvLv1=4.04
+        #     self.CellOvLv2=4.05
+        #     self.CellUvLv1=2.99
+        #     self.CellUvLv2=2.950
+        #     self.CellVoltDiffLv1=0.35
+        #     self.CellVoltDiffLv2=0.4
+        #     self.PackVoltOvLv1=self.CellOvLv1*self.CellVoltNums
+        #     self.PackVoltOvLv2=self.CellOvLv2*self.CellVoltNums
+        #     self.PackVoltUvLv1=self.CellUvLv1*self.CellVoltNums
+        #     self.PackVoltUvLv2=self.CellUvLv2*self.CellVoltNums
+
+        #     self.CellTempUpLmt=119
+        #     self.CellTempLwLmt=-39
+        #     self.CellTempHighLv1=45
+        #     self.CellTempHighLv2=50
+        #     self.CellTempLowLv1=0
+        #     self.CellTempLowLv2=-5
+        #     self.CellTempDiffLv1=10
+        #     self.CellTempDiffLv2=15
+        #     self.CellTempRate=5
+
+        #     self.PackChgOc=-45
+        #     self.PackDisOc=200
+
+        #     self.LeakCurrentLv1=-10
+        #     self.LeakCurrentLv2=-15
+        #     self.LeakCurrentLv3=-50
+
+        #     self.TrwVoltRate=-1
 
         elif celltype==99:   #永联+力神
             self.Capacity = 40
@@ -192,6 +198,12 @@ class BatParam:
 
             self.TrwVoltRate=-8  
             self.mk_slope=-0.8
+
+            #下行控制参数
+            self.CellDscVolt=2.5
+            self.DscPackSoc=20
+            self.BalGroups=8 #均衡分组数
+            self.BalNums=9  #每组均衡个数
         
 
         else:

+ 65 - 32
USER/SPF/alibaba/08BatCrtl/CBMSBatCtrl.py

@@ -1,24 +1,22 @@
+from types import CellType
 import pandas as pd
 import numpy as np
-import datetime
+import datetime,time
 import pika
 import json
 import BatParam
 
 class BatCrtl():
-    def __init__(self,host,port,df_statectrl_ram,df_rlyctrl_ram,df_balctrl_ram,df_diag,df_bms,sn_list):  #参数初始化
+    def __init__(self,host,port,df_statectrl_ram,df_rlyctrl_ram,df_diag,df_bms,sn_list):  #参数初始化
 
-        celltype=1
         self.host=host
         self.port=port
         self.sn_list=sn_list
-        self.param=BatParam.BatParam(celltype)
         
         df_bms['time']=pd.to_datetime(df_bms['time'], format='%Y-%m-%d %H:%M:%S')
         self.df_bms=df_bms
         self.df_statectrl_ram=df_statectrl_ram.copy()
         self.df_rlyctrl_ram=df_rlyctrl_ram.copy()
-        self.df_balctrl_ram=df_balctrl_ram.copy()
         self.df_diag1=df_diag[(df_diag['fault_code']==110) | (df_diag['fault_code']==119) | (df_diag['fault_code']==12) | (df_diag['fault_code']==18)]
         self.df_diag2=df_diag[df_diag['fault_code']==100]
         
@@ -27,8 +25,6 @@ class BatCrtl():
         # self.bms_soc=df_bms['PackSOC']
         # self.bms_soh=df_bms['PackSOH']
         # self.bmsstat=df_bms['BMSStat']
-        self.cellvolt_name=['CellVolt'+str(x) for x in range(1,self.param.CellVoltNums+1)]
-        self.celltemp_name=['CellTemp'+str(x) for x in range(1,self.param.CellTempNums+1)]
 
     #主调用函数........................................................................
     def bat_crtl(self):
@@ -48,12 +44,22 @@ class BatCrtl():
         channel.queue_declare(queue='cmdQueue',durable=True)
         channel.basic_publish(exchange='cmdExchange',routing_key='CmdDirectRouting',body=json.dumps(dict_send)) # 消息内容
         connection.close()
+    
+    def _parameter(self,sn):
+        if 'KPD' in sn:
+            celltype=1
+        else:
+            celltype=99
+        
+        self.param=BatParam.BatParam(celltype)
+        self.cellvolt_name=['CellVolt'+str(x) for x in range(1,self.param.CellVoltNums+1)]
+        self.celltemp_name=['CellTemp'+str(x) for x in range(1,self.param.CellTempNums+1)]
 
     #电池继电器下行控制.........................................................................................................................
     def _bat_rlycrtl(self):
         time_now=datetime.datetime.now()
-        factory=self.df_bms.iloc[0]['factory'] 
         for sn in self.sn_list:
+            factory=self.df_bms.loc[self.df_bms[self.df_bms['sn']==sn].index[0], 'factory']
             if sn in list(self.df_diag1['sn']):  #该sn发生4级或5级故障
                 if sn in list(self.df_rlyctrl_ram['sn']): #ram是否包含该sn
                     if self.df_rlyctrl_ram.loc[self.df_rlyctrl_ram[self.df_rlyctrl_ram['sn']==sn].index[0], 'batrlyctrl']==0:
@@ -88,8 +94,8 @@ class BatCrtl():
 
     #电池充放电下行控制.........................................................................................................................
     def _bat_statecrtl(self):
-        time_now=datetime.datetime.now()
-        factory=self.df_bms.iloc[0]['factory']
+        time_now=datetime.datetime.now()    
+
         #对完成充放电循环,且超过10天的,done_flg置0
         if not self.df_statectrl_ram.empty:
             for i in range(len(self.df_statectrl_ram)):
@@ -103,11 +109,13 @@ class BatCrtl():
         #存在电池正在放电-------------------------------
         if 3 in list(self.df_statectrl_ram['batstatectrl']):    
             sn=self.df_statectrl_ram.loc[self.df_statectrl_ram[self.df_statectrl_ram['batstatectrl']==3].index[0], 'sn']
+            factory=self.df_bms.loc[self.df_bms[self.df_bms['sn']==sn].index[0], 'factory']
+            self._parameter(sn)
             bms_index=self.df_bms[self.df_bms['sn']==sn].index[0]
             packsoc=self.df_bms.loc[bms_index,'PackSOC']
             cellvolt = self.df_bms.loc[bms_index,self.cellvolt_name]
             time_now=self.df_bms.loc[bms_index,'time']
-            if packsoc<10 or 1<min(cellvolt)<3:   #结束放电
+            if packsoc<self.param.DscPackSoc or 1<min(cellvolt)<self.param.CellDscVolt:   #结束放电
                 self.df_statectrl_ram.loc[self.df_statectrl_ram[self.df_statectrl_ram['sn']==sn].index[0], 'time']=time_now
                 self.df_statectrl_ram.loc[self.df_statectrl_ram[self.df_statectrl_ram['sn']==sn].index[0], 'batstatectrl']=2
                 dict_send={"cmd_type":2,"factory":factory,"sn":sn,"batstatectrl":2,"dischrg_volt":272}
@@ -118,12 +126,14 @@ class BatCrtl():
         #存在电池正在静置---------------------------------
         elif 2 in list(self.df_statectrl_ram['batstatectrl']):    
             sn=self.df_statectrl_ram.loc[self.df_statectrl_ram[self.df_statectrl_ram['batstatectrl']==2].index[0], 'sn']
+            factory=self.df_bms.loc[self.df_bms[self.df_bms['sn']==sn].index[0], 'factory']
+            self._parameter(sn)
             bms_index=self.df_bms[self.df_bms['sn']==sn].index[0]
             packcrnt=self.df_bms.loc[bms_index,'PackCrnt']
             packsoc=self.df_bms.loc[bms_index,'PackSOC']
             cellvolt = self.df_bms.loc[bms_index,self.cellvolt_name]
             time_now=self.df_bms.loc[bms_index,'time']
-            if packsoc>25 or min(cellvolt)>3.5:
+            if packsoc>self.param.DscPackSoc+5 or self.param.CellDscVolt+0.5<min(cellvolt)<4.5:
                 self.df_statectrl_ram.loc[self.df_statectrl_ram[self.df_statectrl_ram['sn']==sn].index[0], 'time']=time_now
                 self.df_statectrl_ram.loc[self.df_statectrl_ram[self.df_statectrl_ram['sn']==sn].index[0], 'batstatectrl']=3
                 dict_send={"cmd_type":2,"factory":factory,"sn":sn,"batstatectrl":3,"dischrg_volt":272}
@@ -148,6 +158,8 @@ class BatCrtl():
         #存在电池正在充电------------------------------------
         elif 1 in list(self.df_statectrl_ram['batstatectrl']):    
             sn=self.df_statectrl_ram.loc[self.df_statectrl_ram[self.df_statectrl_ram['batstatectrl']==1].index[0], 'sn']
+            factory=self.df_bms.loc[self.df_bms[self.df_bms['sn']==sn].index[0], 'factory']
+            self._parameter(sn)
             bms_index=self.df_bms[self.df_bms['sn']==sn].index[0]
             packsoc=self.df_bms.loc[bms_index,'PackSOC']
             cellvolt = self.df_bms.loc[bms_index,self.cellvolt_name]
@@ -164,13 +176,15 @@ class BatCrtl():
         #当前电池均不在充放电循环过程中,则接下来判断是否存在100故障---------------------------------
         else:   
             for sn in self.sn_list:
+                factory=self.df_bms.loc[self.df_bms[self.df_bms['sn']==sn].index[0], 'factory']
+                self._parameter(sn)
                 if sn in list(self.df_diag2['sn']):  #该sn发生100长时间未标定故障
                     if sn in list(self.df_bms['sn']):
                         bms_index=self.df_bms[self.df_bms['sn']==sn].index[0]
                         packsoc=self.df_bms.loc[bms_index,'PackSOC']
                         cellvolt = self.df_bms.loc[bms_index,self.cellvolt_name]
                         time_now=self.df_bms.loc[bms_index,'time']
-                        if packsoc>20 or min(cellvolt)>3.5:
+                        if packsoc>self.param.DscPackSoc+5 or self.param.CellDscVolt+0.5<min(cellvolt)<4.5:
                             if sn in list(self.df_statectrl_ram['sn']): #该sn的ram不为空
                                 if self.df_statectrl_ram.loc[self.df_statectrl_ram[self.df_statectrl_ram['sn']==sn].index[0], 'done_flg']==0:
                                     self.df_statectrl_ram.loc[self.df_statectrl_ram[self.df_statectrl_ram['sn']==sn].index[0], 'time']=time_now
@@ -221,10 +235,13 @@ class BatCrtl():
 
     #电池均衡下行控制————————————————————————————————————————————————————————————————————————————————————————————————————————
     def _bat_balcrtl(self):
-        time_now=datetime.datetime.now()
-        factory=self.df_bms.iloc[0]['factory']
         
         for sn in self.sn_list:
+            sn_index=self.df_bms[self.df_bms['sn']==sn].index[0]
+            factory=self.df_bms.loc[sn_index, 'factory']    #获取厂家名称
+            bms_balstate=self.df_bms.loc[sn_index, 'balstate']  #获取BMS均衡状态
+            bms_balstate=list(map(int,bms_balstate.split(',')))
+            self._parameter(sn)
             bms_index=self.df_bms[self.df_bms['sn']==sn].index[0]
             packsoc=self.df_bms.loc[bms_index,'PackSOC']
             cellvolt = self.df_bms.loc[bms_index,self.cellvolt_name]
@@ -234,29 +251,45 @@ class BatCrtl():
 
             voltdiff=np.interp(packsoc,self.param.LookTab_SOC,self.param.LookTab_DiffVolt)
 
-            if min(cellvolt)>2 and max(cellvolt)<4.5 and packsoc>15 and max(cellvolt)-min(cellvolt)>voltdiff:   #满足均衡开启条件
+            #满足均衡开启条件————————————————————————————————————————————————————————————————————————————————————
+            if min(cellvolt)>2 and max(cellvolt)<4.5 and packsoc>20 and max(cellvolt)-min(cellvolt)>voltdiff:   
                 #寻找并判断最大电压是否在均衡
                 cellmax_index=list(cellvolt).index(max(cellvolt))+1
-                bal_num=cellmax_index//16
-                bal_index=cellmax_index%16
+                bal_group = cellmax_index // self.param.BalGroups  #取整
+                bal_index = cellmax_index % self.param.BalGroups   #取余
                 if bal_index==0:
-                    bal_index=16
+                    bal_index=self.param.BalNums
                 else:
                     pass
+                
+                #获取BMS当前最大电芯电压的均衡状态
+                bmscellmax_balgroup=bms_balstate[bal_group]
+                bmscellmax_balgroup >> bal_index-1
+                bmscellmax_balstate=bmscellmax_balgroup & 1
 
-                cellmax_balstate='balstate'+str(bal_num)
-                cellmax_balstate >> bal_index-1
-                cellmax_balstate=cellmax_balstate & 1
-
-                if cellmax_balstate==1: #最大电压在均衡
+                if bmscellmax_balstate==1: #最大电压在均衡
                     pass
                 else:   #最大电芯不在均衡
-                    
-
-
-
-
+                    cellvoltdiff=cellvolt-min(cellvolt)
+                    cellvoltdiff=cellvoltdiff[cellvoltdiff>voltdiff]=1  #压差>阈值的赋1
+                    cellvoltdiff=cellvoltdiff[cellvoltdiff<=voltdiff]=0 #压差<=阈值的赋0
+                    cellvoltdiff=list(map(int,cellvoltdiff))
 
-
-        
-                
+                    #均衡状态按照分组赋值————————————————————————————————————————————————
+                    limsbalctrl=[]
+                    for i in range(self.param.BalGroups):
+                        balstate=0
+                        cellvoltdiff_group=cellvoltdiff[self.param.BalNums*i : self.param.BalNums*(i+1)]
+                        for j in range(self.param.BalNums): #计算每一个分组的均衡状态
+                            balstate=balstate+cellvoltdiff_group[j]*2**j
+                        limsbalctrl.append(balstate)
+                    dict_send={"cmd_type":3,"factory":factory,"sn":sn,"batbalctrl":limsbalctrl}
+                    self._rabbit_send(dict_send)
+                    time.sleep(0.1)
+            
+            #不满足均衡开启条件————————————————————————————————————————————————————————————————————————————————————
+            else:
+                limsbalctrl=[0]*self.param.BalGroups    #所有电芯均衡关闭
+                dict_send={"cmd_type":3,"factory":factory,"sn":sn,"batbalctrl":limsbalctrl}
+                self._rabbit_send(dict_send)
+                time.sleep(0.1)

+ 2 - 1
USER/SPF/alibaba/08BatCrtl/main.py

@@ -28,7 +28,8 @@ def ctrl_cal():
     mylog=log.Mylog('log_ctrl.txt','error')
     mylog.logcfg()
 
-    sn_list=['KPD001','KPD002','KPD003']
+    sn_list=['KPD001','KPD002','KPD003','LS001','LS002']
+    #celltype=1康普盾 99力神
 
     try:
         #读取所有康普盾电池包原始数据库最后一条数据...........................................................................

+ 48 - 145
USER/test.ipynb

@@ -164,20 +164,9 @@
     "df=pd.DataFrame({'a':[1,2,3],'b':[4,5,6]})\n",
     "sm=df.sum()\n",
     "lst=sm[sm<7].index\n",
-    "lst[0]\n",
-    "\n",
-    "\n",
-    "\n",
-    "\n"
+    "lst[0]\n"
    ]
   },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
   {
    "cell_type": "code",
    "execution_count": 13,
@@ -224,177 +213,91 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 13,
+   "execution_count": 2,
    "metadata": {},
-   "outputs": [
-    {
-     "ename": "ValueError",
-     "evalue": "negative shift count",
-     "output_type": "error",
-     "traceback": [
-      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
-      "\u001b[1;32md:\\01WorkSpace\\python\\data_analyze_platform\\USER\\test.ipynb Cell 7'\u001b[0m in \u001b[0;36m<cell line: 2>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      <a href='vscode-notebook-cell:/d%3A/01WorkSpace/python/data_analyze_platform/USER/test.ipynb#ch0000006?line=0'>1</a>\u001b[0m x\u001b[39m=\u001b[39m\u001b[39m16\u001b[39m\n\u001b[1;32m----> <a href='vscode-notebook-cell:/d%3A/01WorkSpace/python/data_analyze_platform/USER/test.ipynb#ch0000006?line=1'>2</a>\u001b[0m x \u001b[39m>>\u001b[39m\u001b[39m=\u001b[39m \u001b[39m-\u001b[39m\u001b[39m1\u001b[39m\n\u001b[0;32m      <a href='vscode-notebook-cell:/d%3A/01WorkSpace/python/data_analyze_platform/USER/test.ipynb#ch0000006?line=2'>3</a>\u001b[0m x\n",
-      "\u001b[1;31mValueError\u001b[0m: negative shift count"
-     ]
-    }
-   ],
+   "outputs": [],
    "source": [
-    "x=16\n",
-    "x >>= -1\n",
-    "x"
+    "import pika\n",
+    "import json\n",
+    "dict_send={\"cmd_type\":1,\"factory\":'力神',\"sn\":'LS001',\"batrlyctrl\":1}\n",
+    "host='120.25.223.1'\n",
+    "port=4902\n",
+    "credentials = pika.PlainCredentials('admin', 'admin')\n",
+    "connection = pika.BlockingConnection(pika.ConnectionParameters(host,port,credentials=credentials))\n",
+    "# 声明一个管道,在管道里发消息\n",
+    "channel = connection.channel()\n",
+    "# 在管道里声明queue\n",
+    "channel.queue_declare(queue='cmdQueue',durable=True)\n",
+    "channel.basic_publish(exchange='cmdExchange',routing_key='CmdDirectRouting',body=json.dumps(dict_send)) # 消息内容\n",
+    "connection.close()"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 26,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "{'a': 0}"
+       "'0b10000000'"
       ]
      },
-     "execution_count": 8,
+     "execution_count": 26,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 17,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "0    1.5\n",
-       "1    3.0\n",
-       "2    3.5\n",
-       "3    4.5\n",
-       "dtype: float64"
-      ]
-     },
-     "execution_count": 17,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "metadata": {},
-   "outputs": [],
    "source": [
-    "import pika\n",
-    "import json\n",
-    "dict_send={\"cmd_type\":1,\"factory\":'力神',\"sn\":'LS001',\"batrlyctrl\":1}\n",
-    "host='120.25.223.1'\n",
-    "port=4902\n",
-    "credentials = pika.PlainCredentials('admin', 'admin')\n",
-    "connection = pika.BlockingConnection(pika.ConnectionParameters(host,port,credentials=credentials))\n",
-    "# 声明一个管道,在管道里发消息\n",
-    "channel = connection.channel()\n",
-    "# 在管道里声明queue\n",
-    "channel.queue_declare(queue='cmdQueue',durable=True)\n",
-    "channel.basic_publish(exchange='cmdExchange',routing_key='CmdDirectRouting',body=json.dumps(dict_send)) # 消息内容\n",
-    "connection.close()"
+    "import pandas as pd\n",
+    "a=pd.DataFrame({'a':[0.1,0.1],'b':[0.8,0.8]})\n",
+    "b=a.loc[0,['a','b']]\n",
+    "b[b>0.5]=1\n",
+    "b[b<=0.5]=0\n",
+    "b=list(map(int,b))\n",
+    "bin(2**7)\n"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 18,
+   "execution_count": 1,
    "metadata": {},
    "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "0b1001\n",
+      "0b100\n"
+     ]
+    },
     {
      "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>a</th>\n",
-       "      <th>b</th>\n",
-       "      <th>c</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>0</th>\n",
-       "      <td>-0.707107</td>\n",
-       "      <td>0.707107</td>\n",
-       "      <td>6</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>-0.707107</td>\n",
-       "      <td>0.707107</td>\n",
-       "      <td>2</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2</th>\n",
-       "      <td>-0.707107</td>\n",
-       "      <td>0.707107</td>\n",
-       "      <td>7</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>3</th>\n",
-       "      <td>0.707107</td>\n",
-       "      <td>-0.707107</td>\n",
-       "      <td>1</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "</div>"
-      ],
       "text/plain": [
-       "          a         b  c\n",
-       "0 -0.707107  0.707107  6\n",
-       "1 -0.707107  0.707107  2\n",
-       "2 -0.707107  0.707107  7\n",
-       "3  0.707107 -0.707107  1"
+       "0"
       ]
      },
-     "execution_count": 18,
+     "execution_count": 1,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
-   "source": []
+   "source": [
+    "a=9\n",
+    "print(bin(a))\n",
+    "b=a>>1\n",
+    "print(bin(b))\n",
+    "b & 1\n",
+    "0%9"
+   ]
   }
  ],
  "metadata": {
   "interpreter": {
-   "hash": "009616ea12ff11d964a448e699ff313e04f27deb90a31fcd4b2c009270f2f738"
+   "hash": "ad2bdc8ecc057115af97d19610ffacc2b4e99fae6737bb82f5d7fb13d2f2c186"
   },
   "kernelspec": {
-   "display_name": "Python 3.8.5 32-bit",
+   "display_name": "Python 3.8.8 ('base')",
    "language": "python",
    "name": "python3"
   },
@@ -408,7 +311,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.8.5"
+   "version": "3.8.8"
   },
   "orig_nbformat": 4
  },