A controller for controlling charging/discharging of a plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028), comprising: a charging/discharging current measuring part for measuring a charging/discharging current of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028); a bidirectional converter for controlling charging/discharging of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) so that charging/discharging power takes a command value; a discharging capacity calculator for integrating a measured value of the charging/discharging current measured by said charging/discharging current measuring part and calculating a discharging capacity of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028); a charging state calculator for calculating a state of charge of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) based on the calculated value of the discharging capacity calculated by said discharging capacity calculator; a priority degree determiner (1212, 2004, 2006) for obtaining a first index including a difference of a target value of the state of charge from the calculated value of the state of charge calculated by said charging state calculator as a factor, and determining a charging priority degree and a discharging priority degree of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) so that the charging priority degree is raised and the discharging priority degree is lowered with the increasing difference of the target value of the state of charge from the calculated value of the state of charge calculated by said charging state calculator; a power allocating part (1212, 2008) for allocating charging power to the secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) in descending manner of the charging priority degree determined by said priority degree determiner (1212, 2004, 2006) and allocating discharging power to the secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) in descending manner of the discharging priority degree determined by said priority degree determiner (1212, 2004, 2006); and a charging/discharging command part for commanding said bidirectional converter to charge/discharge the charging/discharging power allocated by said power allocating part (1212, 2008). a charging/discharging current measuring part for measuring a charging/discharging current of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028); a bidirectional converter for controlling charging/discharging of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) so that charging/discharging power takes a command value; a discharging capacity calculator for integrating a measured value of the charging/discharging current measured by said charging/discharging current measuring part and calculating a discharging capacity of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028); a charging state calculator for calculating a state of charge of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) based on the calculated value of the discharging capacity calculated by said discharging capacity calculator; a priority degree determiner (1212, 2004, 2006) for obtaining a first index including a difference of a target value of the state of charge from the calculated value of the state of charge calculated by said charging state calculator as a factor, and determining a charging priority degree and a discharging priority degree of each of the plurality of secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) so that the charging priority degree is raised and the discharging priority degree is lowered with the increasing difference of the target value of the state of charge from the calculated value of the state of charge calculated by said charging state calculator; a power allocating part (1212, 2008) for allocating charging power to the secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) in descending manner of the charging priority degree determined by said priority degree determiner (1212, 2004, 2006) and allocating discharging power to the secondary batteries (1004, 10004, 10008, 10016, 10022, 10028) in descending manner of the discharging priority degree determined by said priority degree determiner (1212, 2004, 2006); and a charging/discharging command part for commanding said bidirectional converter to charge/discharge the charging/discharging power allocated by said power allocating part (1212, 2008).