Skip to content

Commit 5405723

Browse files
authored
feature: add support for S21+ hydro (#326)
1 parent 83035a8 commit 5405723

File tree

10 files changed

+83
-15
lines changed

10 files changed

+83
-15
lines changed

docs/miners/antminer/X21.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@
5353
show_root_heading: false
5454
heading_level: 0
5555

56+
## S21+ Hydro (Stock)
57+
58+
- [x] Shutdowns
59+
- [x] Power Modes
60+
- [ ] Setpoints
61+
- [ ] Presets
62+
63+
::: pyasic.miners.antminer.bmminer.X21.S21.BMMinerS21PlusHydro
64+
handler: python
65+
options:
66+
show_root_heading: false
67+
heading_level: 0
68+
5669
## T21 (Stock)
5770

5871
- [x] Shutdowns

docs/miners/supported_types.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ details {
104104
<li><a href="../antminer/X21#s21-stock">S21 (Stock)</a></li>
105105
<li><a href="../antminer/X21#s21-stock">S21 (Stock)</a></li>
106106
<li><a href="../antminer/X21#s21_1-stock">S21+ (Stock)</a></li>
107+
<li><a href="../antminer/X21#s21_1-hydro-stock">S21+ Hydro (Stock)</a></li>
107108
<li><a href="../antminer/X21#s21-pro-stock">S21 Pro (Stock)</a></li>
108109
<li><a href="../antminer/X21#t21-stock">T21 (Stock)</a></li>
109110
<li><a href="../antminer/X21#s21-hydro-stock">S21 Hydro (Stock)</a></li>

pyasic/data/boards.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class HashBoard(BaseModel):
2828
Attributes:
2929
slot: The slot of the board as an int.
3030
hashrate: The hashrate of the board in TH/s as a float.
31+
inlet_temp: Inlet temperature for hydro asics as an int
32+
outlet_temp: Outlet temperature for hydro asics as an int
3133
temp: The temperature of the PCB as an int.
3234
chip_temp: The temperature of the chips as an int.
3335
chips: The chip count of the board as an int.
@@ -41,6 +43,8 @@ class HashBoard(BaseModel):
4143

4244
slot: int = 0
4345
hashrate: AlgoHashRateType | None = None
46+
inlet_temp: float | None = None
47+
outlet_temp: float | None = None
4448
temp: float | None = None
4549
chip_temp: float | None = None
4650
chips: int | None = None

pyasic/device/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class AntminerModels(MinerModelType):
5959
T19 = "T19"
6060
S21 = "S21"
6161
S21Plus = "S21+"
62+
S21PlusHydro = "S21+ Hydro"
6263
S21Pro = "S21 Pro"
6364
S21Hydro = "S21 Hydro"
6465
T21 = "T21"

pyasic/miners/antminer/bmminer/X21/S21.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# ------------------------------------------------------------------------------
1616

1717
from pyasic.miners.backends import AntminerModern
18-
from pyasic.miners.device.models import S21, S21Hydro, S21Plus, S21Pro
18+
from pyasic.miners.device.models import S21, S21Hydro, S21Plus, S21PlusHydro, S21Pro
1919

2020

2121
class BMMinerS21(AntminerModern, S21):
@@ -26,6 +26,10 @@ class BMMinerS21Plus(AntminerModern, S21Plus):
2626
pass
2727

2828

29+
class BMMinerS21PlusHydro(AntminerModern, S21PlusHydro):
30+
pass
31+
32+
2933
class BMMinerS21Pro(AntminerModern, S21Pro):
3034
pass
3135

pyasic/miners/antminer/bmminer/X21/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@
1313
# See the License for the specific language governing permissions and -
1414
# limitations under the License. -
1515
# ------------------------------------------------------------------------------
16-
from .S21 import BMMinerS21, BMMinerS21Hydro, BMMinerS21Plus, BMMinerS21Pro
16+
from .S21 import (
17+
BMMinerS21,
18+
BMMinerS21Hydro,
19+
BMMinerS21Plus,
20+
BMMinerS21PlusHydro,
21+
BMMinerS21Pro,
22+
)
1723
from .T21 import BMMinerT21

pyasic/miners/backends/antminer.py

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -272,18 +272,47 @@ async def _get_hashboards(self) -> List[HashBoard]:
272272
rate=board["rate_real"], unit=self.algo.unit.GH
273273
).into(self.algo.unit.default)
274274
hashboards[board["index"]].chips = board["asic_num"]
275-
board_temp_data = list(
276-
filter(lambda x: not x == 0, board["temp_pcb"])
277-
)
278-
hashboards[board["index"]].temp = sum(board_temp_data) / len(
279-
board_temp_data
280-
)
281-
chip_temp_data = list(
282-
filter(lambda x: not x == 0, board["temp_chip"])
283-
)
284-
hashboards[board["index"]].chip_temp = sum(chip_temp_data) / len(
285-
chip_temp_data
286-
)
275+
276+
if "S21+ Hyd" in self.model:
277+
hashboards[board["index"]].inlet_temp = board["temp_pcb"][0]
278+
hashboards[board["index"]].outlet_temp = board["temp_pcb"][2]
279+
hashboards[board["index"]].chip_temp = board["temp_pic"][0]
280+
board_temp_data = list(
281+
filter(
282+
lambda x: not x == 0,
283+
[
284+
board["temp_pic"][1],
285+
board["temp_pic"][2],
286+
board["temp_pic"][3],
287+
board["temp_pcb"][1],
288+
board["temp_pcb"][3],
289+
],
290+
)
291+
)
292+
hashboards[board["index"]].temp = (
293+
sum(board_temp_data) / len(board_temp_data)
294+
if len(board_temp_data) > 0
295+
else 0
296+
)
297+
298+
else:
299+
board_temp_data = list(
300+
filter(lambda x: not x == 0, board["temp_pcb"])
301+
)
302+
hashboards[board["index"]].temp = (
303+
sum(board_temp_data) / len(board_temp_data)
304+
if len(board_temp_data) > 0
305+
else 0
306+
)
307+
chip_temp_data = list(
308+
filter(lambda x: not x == 0, board["temp_chip"])
309+
)
310+
hashboards[board["index"]].chip_temp = (
311+
sum(chip_temp_data) / len(chip_temp_data)
312+
if len(chip_temp_data) > 0
313+
else 0
314+
)
315+
287316
hashboards[board["index"]].serial_number = board["sn"]
288317
hashboards[board["index"]].missing = False
289318
except LookupError:

pyasic/miners/device/models/antminer/X21/S21.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ class S21Plus(AntMinerMake):
3636
algo = MinerAlgo.SHA256
3737

3838

39+
class S21PlusHydro(AntMinerMake):
40+
raw_model = MinerModel.ANTMINER.S21PlusHydro
41+
42+
expected_chips = 95
43+
expected_fans = 0
44+
expected_hashboards = 3
45+
algo = MinerAlgo.SHA256
46+
47+
3948
class S21Pro(AntMinerMake):
4049
raw_model = MinerModel.ANTMINER.S21Pro
4150

pyasic/miners/device/models/antminer/X21/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
# limitations under the License. -
1515
# ------------------------------------------------------------------------------
1616

17-
from .S21 import S21, S21Hydro, S21Plus, S21Pro
17+
from .S21 import S21, S21Hydro, S21Plus, S21PlusHydro, S21Pro
1818
from .T21 import T21

pyasic/miners/factory.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class MinerTypes(enum.Enum):
121121
"ANTMINER BHB68601": BMMinerS21, # ???
122122
"ANTMINER BHB68606": BMMinerS21, # ???
123123
"ANTMINER S21+": BMMinerS21Plus,
124+
"ANTMINER S21+ HYD.": BMMinerS21PlusHydro,
124125
"ANTMINER S21 PRO": BMMinerS21Pro,
125126
"ANTMINER T21": BMMinerT21,
126127
"ANTMINER S21 HYD.": BMMinerS21Hydro,

0 commit comments

Comments
 (0)