At present, for high-power products such as UPS, EPS, and inverter power supplies, the battery inverter voltage designed by developers is often very high. Faced with a high-voltage battery pack composed of many batteries in series, designers often charge the battery pack in the traditional way of boosting the mains power through a transformer and then rectifying it, or rectifying the mains power and then boosting it through a high-frequency electronic BOOST. The former is bound to cause a significant increase in the cost of charging circuit components, and the latter is not reliable and has high costs. The purpose of this design is to solve the defects and shortcomings of the above-mentioned traditional higher charging voltage design method. For the higher voltage battery pack, it is divided into two groups with equal voltage segments, and the self-controlled switch combination adjustment method is used to achieve: when there is mains power, the two groups of batteries are automatically adjusted to parallel mode, and the charging voltage of the charger is only half of the whole group of batteries; when there is a power outage, the two groups of batteries are automatically adjusted to series mode to output the purpose of discharge. Figure 1 is a schematic diagram of the battery group series and parallel automatic adjustment charging/discharging system. In FIG1, 1. charger, 2. battery group A, 3. bipolar normally open automatic switch, 4. normally closed automatic switch, 5. battery group B, 6. power diode, 7. normally open automatic switch. Specific implementation method: In FIG1, the control electrodes of the three automatic normally open switches (3), (7) and the automatic normally closed switch (4) and the input of the charger (1) are all controlled by the same mains electricity to synchronously control their operation; the positive and negative electrodes output by the charger (1) are electrically connected to the positive and negative electrodes of the battery group A (2); the two contact electrodes at the same end of the automatic normally open switch (3) are electrically connected to the positive and negative electrodes of the battery group A (2) through a wire; the positive and negative electrodes of the battery group B (5) are connected to the two contact electrodes at the other end of the normally open bipolar automatic switch (3) through a wire, so that when the normally open bipolar automatic switch (3) is working and closed, the positive and negative contacts of the two groups of batteries (2) and (5) are connected in parallel. The input contact electrode and control electrode of the automatic normally open switch (7) are electrically connected to the mains, and the output contact electrode thereof is electrically connected to the control electrode of the automatic normally open bipolar switch (3) through a wire. One contact electrode of the normally closed automatic switch (4) is electrically connected to the positive (negative) electrode of the battery group A (2) through a wire, and the other contact electrode of the normally closed automatic switch (4) is electrically connected to the negative (positive) electrode of the battery group B (5) through a wire. The positive and negative output terminals of the series and parallel automatic regulating charging/discharging system are electrically connected to the positive (negative) electrode of the battery group B (5) and the negative (positive) electrode of the battery group A (2) through a wire, respectively, and a power diode (6) is connected in series to prevent current backflow. The battery groups A and B are equal voltage battery segments of the same nature. The switching speed of the automatic switch is selected: the automatic normally open switch (7) and the automatic normally closed switch (4) work synchronously, but slower than the switching speed of the normally open bipolar automatic switch (3). The automatic normally open switch (7) and the automatic normally closed switch (4) can be designed as a normally open/normally closed bipolar switch integrated into one. The specific connection relationship is as described above. When the city power is connected, the normally closed automatic switch (4) is disconnected first at a fast speed, and the normally open automatic switch (7) is synchronously closed, followed by the normally open automatic switch (3). At this time, the battery group A (2) and the battery group B (5) are in a parallel state, and the charger (1) charges the parallel battery group. Since the positive and negative output terminal voltages of the system are half of the sum of the voltages of the two groups of batteries at this time, the working voltage of the inverter device connected thereto cannot reach the sum of the voltages of the two groups of batteries set and will not work. In addition, since a power diode (6) is connected in series to the positive and negative output terminals of the system to prevent current backflow, current backflow of the high-voltage DC bus connected to the output terminal will not occur. When the city power fails, the normally open automatic switch (3) is disconnected first due to its fast speed, followed by the normally closed automatic switch (4) being closed. At this time, the battery group A (2) and the battery group B (5) are connected in series, and the sum of the voltages of the two battery groups in series reaches the set inverter device working voltage, which can provide a stable DC working power supply for the set inverter device.