steer-materials 0.1.17__tar.gz → 0.1.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: steer-materials
3
- Version: 0.1.17
3
+ Version: 0.1.19
4
4
  Summary: Modelling energy storage from cell to site - STEER OpenCell Design
5
5
  Author-email: Nicholas Siemons <nsiemons@stanford.edu>
6
6
  Maintainer-email: Nicholas Siemons <nsiemons@stanford.edu>
@@ -22,7 +22,7 @@ Classifier: Topic :: Scientific/Engineering
22
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
23
  Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
- Requires-Dist: steer-core==0.1.27
25
+ Requires-Dist: steer-core==0.1.34
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest; extra == "dev"
28
28
  Requires-Dist: pytest-cov; extra == "dev"
@@ -31,7 +31,7 @@ classifiers = [
31
31
  ]
32
32
 
33
33
  dependencies = [
34
- "steer-core==0.1.27",
34
+ "steer-core==0.1.34",
35
35
  ]
36
36
 
37
37
  [project.optional-dependencies]
@@ -73,4 +73,4 @@ target-version = ['py310']
73
73
  testpaths = ["test"]
74
74
  python_files = "test_*.py"
75
75
  python_classes = "Test*"
76
- python_functions = "test_*"
76
+ python_functions = "test_*"
@@ -10,8 +10,8 @@ import numpy as np
10
10
 
11
11
  class _Material(
12
12
  ValidationMixin,
13
- SerializerMixin,
14
- DunderMixin
13
+ DunderMixin,
14
+ SerializerMixin
15
15
  ):
16
16
 
17
17
  def __init__(self, name: str, density: float, specific_cost: float, color: str):
@@ -43,13 +43,13 @@ class _Material(
43
43
 
44
44
  @property
45
45
  def density(self):
46
- return round(self._density * (KG_TO_G / M_TO_CM**3), 2)
46
+ return np.round(self._density * (KG_TO_G / M_TO_CM**3), 2)
47
47
 
48
48
  @property
49
49
  def density_range(self):
50
50
  return (
51
- round(self._density_range[0] * (KG_TO_G / M_TO_CM**3), 2),
52
- round(self._density_range[1] * (KG_TO_G / M_TO_CM**3), 2),
51
+ np.round(self._density_range[0] * (KG_TO_G / M_TO_CM**3), 2),
52
+ np.round(self._density_range[1] * (KG_TO_G / M_TO_CM**3), 2),
53
53
  )
54
54
 
55
55
  @property
@@ -58,13 +58,13 @@ class _Material(
58
58
 
59
59
  @property
60
60
  def specific_cost(self):
61
- return round(self._specific_cost, 2)
61
+ return np.round(self._specific_cost, 2)
62
62
 
63
63
  @property
64
64
  def specific_cost_range(self):
65
65
  return (
66
- round(self._specific_cost_range[0], 2),
67
- round(self._specific_cost_range[1], 2),
66
+ np.round(self._specific_cost_range[0], 2),
67
+ np.round(self._specific_cost_range[1], 2),
68
68
  )
69
69
 
70
70
  @property
@@ -173,21 +173,21 @@ class _VolumedMaterialMixin:
173
173
  @property
174
174
  def volume(self):
175
175
  if hasattr(self, '_volume') and self._volume is not None:
176
- return round(self._volume * (M_TO_CM**3), 4)
176
+ return np.round(self._volume * (M_TO_CM**3), 4)
177
177
  else:
178
178
  return None
179
179
 
180
180
  @property
181
181
  def mass(self):
182
182
  if hasattr(self, '_mass') and self._mass is not None:
183
- return round(self._mass * KG_TO_G, 2)
183
+ return np.round(self._mass * KG_TO_G, 2)
184
184
  else:
185
185
  return None
186
186
 
187
187
  @property
188
188
  def cost(self):
189
189
  if hasattr(self, '_cost') and self._cost is not None:
190
- return round(self._cost, 2)
190
+ return np.round(self._cost, 2)
191
191
  else:
192
192
  return None
193
193
 
@@ -0,0 +1,2 @@
1
+ __version__ = "0.1.19"
2
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: steer-materials
3
- Version: 0.1.17
3
+ Version: 0.1.19
4
4
  Summary: Modelling energy storage from cell to site - STEER OpenCell Design
5
5
  Author-email: Nicholas Siemons <nsiemons@stanford.edu>
6
6
  Maintainer-email: Nicholas Siemons <nsiemons@stanford.edu>
@@ -22,7 +22,7 @@ Classifier: Topic :: Scientific/Engineering
22
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
23
  Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
- Requires-Dist: steer-core==0.1.27
25
+ Requires-Dist: steer-core==0.1.34
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest; extra == "dev"
28
28
  Requires-Dist: pytest-cov; extra == "dev"
@@ -8,6 +8,4 @@ steer_materials.egg-info/PKG-INFO
8
8
  steer_materials.egg-info/SOURCES.txt
9
9
  steer_materials.egg-info/dependency_links.txt
10
10
  steer_materials.egg-info/requires.txt
11
- steer_materials.egg-info/top_level.txt
12
- test/test_electrode_materials.py
13
- test/test_electrolyte.py
11
+ steer_materials.egg-info/top_level.txt
@@ -1,4 +1,4 @@
1
- steer-core==0.1.27
1
+ steer-core==0.1.34
2
2
 
3
3
  [dev]
4
4
  pytest
@@ -1,2 +0,0 @@
1
- __version__ = "0.1.17"
2
-
@@ -1,1160 +0,0 @@
1
- import unittest
2
- from io import StringIO
3
- import pandas as pd
4
-
5
- from steer_materials.CellMaterials.Electrode import (
6
- CathodeMaterial,
7
- AnodeMaterial,
8
- Binder,
9
- ConductiveAdditive,
10
- )
11
-
12
-
13
- class TestLFPSingleCurve(unittest.TestCase):
14
-
15
- def setUp(self):
16
- """
17
- Set up
18
- """
19
- half_cell_data = StringIO(
20
- """
21
- Specific Capacity (mAh/g),Voltage (V),Step Name,Step_ID
22
- 0.227014756,2.743703704,CC_Chg,1
23
- 0.227014756,3.354074074,CC_Chg,1
24
- 0.227014756,3.460740741,CC_Chg,1
25
- 0.454029512,3.49037037,CC_Chg,1
26
- 0.908059024,3.508148148,CC_Chg,1
27
- 1.816118048,3.502222222,CC_Chg,1
28
- 3.405221339,3.496296296,CC_Chg,1
29
- 4.994324631,3.49037037,CC_Chg,1
30
- 7.264472191,3.49037037,CC_Chg,1
31
- 11.12372304,3.484444444,CC_Chg,1
32
- 21.79341657,3.478518519,CC_Chg,1
33
- 33.82519864,3.472592593,CC_Chg,1
34
- 46.08399546,3.472592593,CC_Chg,1
35
- 57.43473326,3.472592593,CC_Chg,1
36
- 67.19636776,3.472592593,CC_Chg,1
37
- 76.73098751,3.472592593,CC_Chg,1
38
- 81.72531215,3.472592593,CC_Chg,1
39
- 87.17366629,3.472592593,CC_Chg,1
40
- 93.98410897,3.478518519,CC_Chg,1
41
- 98.29738933,3.478518519,CC_Chg,1
42
- 102.1566402,3.484444444,CC_Chg,1
43
- 107.3779796,3.484444444,CC_Chg,1
44
- 112.1452894,3.484444444,CC_Chg,1
45
- 115.7775255,3.49037037,CC_Chg,1
46
- 118.5017026,3.49037037,CC_Chg,1
47
- 122.814983,3.496296296,CC_Chg,1
48
- 126.4472191,3.502222222,CC_Chg,1
49
- 129.8524404,3.508148148,CC_Chg,1
50
- 132.3496027,3.514074074,CC_Chg,1
51
- 135.0737798,3.525925926,CC_Chg,1
52
- 137.1169126,3.525925926,CC_Chg,1
53
- 138.7060159,3.531851852,CC_Chg,1
54
- 141.2031782,3.543703704,CC_Chg,1
55
- 143.4733258,3.54962963,CC_Chg,1
56
- 145.5164586,3.567407407,CC_Chg,1
57
- 147.5595914,3.579259259,CC_Chg,1
58
- 148.9216799,3.591111111,CC_Chg,1
59
- 150.2837684,3.614814815,CC_Chg,1
60
- 151.1918275,3.632592593,CC_Chg,1
61
- 152.0998865,3.656296296,CC_Chg,1
62
- 152.7809308,3.697777778,CC_Chg,1
63
- 153.461975,3.733333333,CC_Chg,1
64
- 153.9160045,3.792592593,CC_Chg,1
65
- 154.3700341,3.84,CC_Chg,1
66
- 154.5970488,3.881481481,CC_Chg,1
67
- 154.8240636,3.934814815,CC_Chg,1
68
- 155.0510783,3.97037037,CC_Chg,1
69
- 155.2780931,4.017777778,CC_Chg,1
70
- 155.5051078,4.059259259,CC_Chg,1
71
- 156.6401816,4.100740741,CC_Chg,1
72
- 0.227014756,4.071111111,CC_DChg,2
73
- 0.454029512,3.685925926,CC_DChg,2
74
- 0.454029512,3.54962963,CC_DChg,2
75
- 0.681044268,3.502222222,CC_DChg,2
76
- 1.13507378,3.466666667,CC_DChg,2
77
- 1.589103292,3.437037037,CC_DChg,2
78
- 2.724177072,3.419259259,CC_DChg,2
79
- 4.313280363,3.401481481,CC_DChg,2
80
- 6.129398411,3.395555556,CC_DChg,2
81
- 19.52326901,3.395555556,CC_DChg,2
82
- 33.37116913,3.395555556,CC_DChg,2
83
- 48.58115778,3.395555556,CC_DChg,2
84
- 52.44040863,3.38962963,CC_DChg,2
85
- 57.2077185,3.395555556,CC_DChg,2
86
- 63.79114642,3.38962963,CC_DChg,2
87
- 72.87173666,3.38962963,CC_DChg,2
88
- 80.81725312,3.38962963,CC_DChg,2
89
- 86.49262202,3.38962963,CC_DChg,2
90
- 91.94097616,3.383703704,CC_DChg,2
91
- 95.11918275,3.377777778,CC_DChg,2
92
- 98.52440409,3.383703704,CC_DChg,2
93
- 101.9296254,3.377777778,CC_DChg,2
94
- 104.4267877,3.377777778,CC_DChg,2
95
- 107.8320091,3.371851852,CC_DChg,2
96
- 110.7832009,3.365925926,CC_DChg,2
97
- 113.9614075,3.36,CC_DChg,2
98
- 117.5936436,3.354074074,CC_DChg,2
99
- 120.7718502,3.342222222,CC_DChg,2
100
- 123.9500568,3.336296296,CC_DChg,2
101
- 126.6742338,3.33037037,CC_DChg,2
102
- 129.1713961,3.324444444,CC_DChg,2
103
- 131.4415437,3.318518519,CC_DChg,2
104
- 133.4846765,3.318518519,CC_DChg,2
105
- 136.2088536,3.306666667,CC_DChg,2
106
- 138.2519864,3.300740741,CC_DChg,2
107
- 140.2951192,3.288888889,CC_DChg,2
108
- 141.6572077,3.277037037,CC_DChg,2
109
- 143.0192963,3.265185185,CC_DChg,2
110
- 144.15437,3.247407407,CC_DChg,2
111
- 145.0624291,3.211851852,CC_DChg,2
112
- 145.7434733,3.182222222,CC_DChg,2
113
- 146.4245176,3.140740741,CC_DChg,2
114
- 147.1055619,3.081481481,CC_DChg,2
115
- 147.7866061,3.022222222,CC_DChg,2
116
- 148.6946652,2.957037037,CC_DChg,2
117
- 149.6027242,2.891851852,CC_DChg,2
118
- 150.2837684,2.820740741,CC_DChg,2
119
- 151.1918275,2.755555556,CC_DChg,2
120
- 151.8728717,2.696296296,CC_DChg,2
121
- """
122
- )
123
-
124
- half_cell = (
125
- pd.read_csv(
126
- half_cell_data,
127
- skiprows=2,
128
- names=["specific_capacity", "voltage", "direction", "id"],
129
- )
130
- .drop(columns=["id"])
131
- .assign(
132
- direction=lambda x: x["direction"].apply(
133
- lambda y: (
134
- "discharge"
135
- if "CC_DChg" in y
136
- else "charge" if "CC_Chg" in y else None
137
- )
138
- ),
139
- )
140
- )
141
-
142
- self.material = CathodeMaterial(
143
- name="LFP",
144
- reference="Li/Li+",
145
- specific_cost=6.00,
146
- density=3.6,
147
- half_cell_curves=half_cell,
148
- )
149
-
150
- self.material2 = CathodeMaterial(
151
- name="LFP",
152
- reference="Li/Li+",
153
- specific_cost=6.00,
154
- density=3.6,
155
- half_cell_curves=half_cell,
156
- voltage_cutoff=4.0,
157
- reversible_capacity_scaling=0.5,
158
- )
159
-
160
- def test_instantiation(self):
161
- """
162
- Test instantiation
163
- """
164
- self.assertTrue(isinstance(self.material, CathodeMaterial))
165
- self.assertEqual(self.material.voltage_cutoff_range, (3.7, 4.1))
166
-
167
- figure1 = self.material.plot_half_cell_curve()
168
- figure2 = self.material.plot_curves()
169
-
170
- # figure1.show()
171
- # figure2.show()
172
-
173
- def test_equality(self):
174
- self.assertTrue(self.material == self.material)
175
- self.assertTrue(self.material != self.material2)
176
-
177
- def test_extrapolation_window_setter(self):
178
-
179
- self.material.extrapolation_window = 0.5
180
- self.assertEqual(self.material.extrapolation_window, 0.5)
181
- self.assertEqual(self.material.voltage_cutoff_range, (3.6, 4.1))
182
-
183
- def test_voltage_setter(self):
184
- """
185
- Test voltage setter
186
- """
187
- self.material.voltage_cutoff = 4.0
188
-
189
- data = self.material.half_cell_curve
190
- figure = self.material.plot_half_cell_curve()
191
-
192
- self.assertEqual(round(data["Voltage (V)"].max(), 10), 4.0)
193
- self.assertEqual(
194
- round(
195
- data.query('Direction == "discharge"')[
196
- "Specific Capacity (mAh/g)"
197
- ].min(),
198
- 2,
199
- ),
200
- 3.59,
201
- )
202
- self.assertEqual(
203
- round(data.query('Direction == "discharge"')["Voltage (V)"].min(), 2), 2.7
204
- )
205
- self.assertEqual(
206
- round(
207
- data.query('Direction == "charge"')["Specific Capacity (mAh/g)"].max(),
208
- 2,
209
- ),
210
- 155.19,
211
- )
212
-
213
- # figure.show()
214
-
215
- def test_from_database(self):
216
- self.material = CathodeMaterial.from_database("LFP")
217
- self.assertTrue(isinstance(self.material, CathodeMaterial))
218
-
219
- def test_irreversible_capacity_scaling(self):
220
- """
221
- Test irreversible capacity scaling
222
- """
223
- self.material.voltage_cutoff = 4
224
- self.material.irreversible_capacity_scaling = 0.5
225
-
226
- data = self.material.half_cell_curve
227
- figure = self.material.plot_half_cell_curve()
228
-
229
- self.assertEqual(round(data["Voltage (V)"].max(), 10), 4.0)
230
- self.assertEqual(
231
- round(
232
- data.query('Direction == "discharge"')[
233
- "Specific Capacity (mAh/g)"
234
- ].min(),
235
- 2,
236
- ),
237
- 1.79,
238
- )
239
- self.assertEqual(
240
- round(data.query('Direction == "discharge"')["Voltage (V)"].min(), 2), 2.7
241
- )
242
- self.assertEqual(
243
- round(
244
- data.query('Direction == "charge"')["Specific Capacity (mAh/g)"].max(),
245
- 2,
246
- ),
247
- 77.6,
248
- )
249
-
250
- # figure.show()
251
-
252
- def test_reversible_capacity_scaling(self):
253
- """
254
- Test reversible capacity scaling
255
- """
256
- self.material.voltage_cutoff = 4
257
- self.material.reversible_capacity_scaling = 0.5
258
-
259
- data = self.material.half_cell_curve
260
- figure = self.material.plot_half_cell_curve()
261
-
262
- self.assertEqual(round(data["Voltage (V)"].max(), 10), 4)
263
- self.assertEqual(
264
- round(
265
- data.query('Direction == "discharge"')[
266
- "Specific Capacity (mAh/g)"
267
- ].min(),
268
- 2,
269
- ),
270
- 79.39,
271
- )
272
- self.assertEqual(
273
- round(data.query('Direction == "discharge"')["Voltage (V)"].min(), 2), 2.7
274
- )
275
- self.assertEqual(
276
- round(
277
- data.query('Direction == "charge"')["Specific Capacity (mAh/g)"].max(),
278
- 2,
279
- ),
280
- 155.19,
281
- )
282
-
283
- # figure.show()
284
-
285
- def test_material2(self):
286
-
287
- data = self.material2.half_cell_curve
288
- figure = self.material2.plot_half_cell_curve()
289
-
290
- self.assertEqual(round(data["Voltage (V)"].max(), 10), 4)
291
- self.assertEqual(
292
- round(
293
- data.query('Direction == "discharge"')[
294
- "Specific Capacity (mAh/g)"
295
- ].min(),
296
- 2,
297
- ),
298
- 79.39,
299
- )
300
- self.assertEqual(
301
- round(data.query('Direction == "discharge"')["Voltage (V)"].min(), 2), 2.7
302
- )
303
- self.assertEqual(
304
- round(
305
- data.query('Direction == "charge"')["Specific Capacity (mAh/g)"].max(),
306
- 2,
307
- ),
308
- 155.19,
309
- )
310
-
311
- # figure.show()
312
-
313
- def test_switching_values(self):
314
- """
315
- Test switching values
316
- """
317
- self.material.voltage_cutoff = 4.0
318
- self.material.reversible_capacity_scaling = 0.5
319
- self.material.irreversible_capacity_scaling = 0.5
320
- self.material.reversible_capacity_scaling = 0.2
321
- self.material.irreversible_capacity_scaling = 0.2
322
- self.material.voltage_cutoff = 4
323
- self.material.reversible_capacity_scaling = 1
324
- self.material.irreversible_capacity_scaling = 1
325
-
326
- data = self.material.half_cell_curve
327
-
328
- self.assertEqual(round(data["Voltage (V)"].max(), 10), 4.0)
329
- self.assertEqual(
330
- round(
331
- data.query('Direction == "discharge"')[
332
- "Specific Capacity (mAh/g)"
333
- ].min(),
334
- 2,
335
- ),
336
- 3.59,
337
- )
338
- self.assertEqual(
339
- round(data.query('Direction == "discharge"')["Voltage (V)"].min(), 2), 2.7
340
- )
341
- self.assertEqual(
342
- round(
343
- data.query('Direction == "charge"')["Specific Capacity (mAh/g)"].max(),
344
- 2,
345
- ),
346
- 155.19,
347
- )
348
-
349
-
350
- class TestNMMMultiCurve(unittest.TestCase):
351
-
352
- def setUp(self):
353
-
354
- half_cell_data_1 = StringIO(
355
- """
356
- Specific Capacity (mAh/g),Voltage (V),Step Name,Step_ID
357
- 0,2.925467626,CC_Chg,1
358
- 0.93676815,2.908201439,CC_Chg,1
359
- 2.43559719,2.908201439,CC_Chg,1
360
- 4.121779859,2.915107914,CC_Chg,1
361
- 7.119437939,2.932374101,CC_Chg,1
362
- 10.49180328,2.94618705,CC_Chg,1
363
- 12.92740047,2.956546763,CC_Chg,1
364
- 16.11241218,2.966906475,CC_Chg,1
365
- 20.6088993,2.987625899,CC_Chg,1
366
- 24.91803279,3.008345324,CC_Chg,1
367
- 27.16627635,3.022158273,CC_Chg,1
368
- 29.78922717,3.046330935,CC_Chg,1
369
- 32.97423888,3.06705036,CC_Chg,1
370
- 35.40983607,3.091223022,CC_Chg,1
371
- 38.40749415,3.118848921,CC_Chg,1
372
- 41.03044496,3.143021583,CC_Chg,1
373
- 44.4028103,3.170647482,CC_Chg,1
374
- 47.21311475,3.187913669,CC_Chg,1
375
- 49.64871194,3.212086331,CC_Chg,1
376
- 51.8969555,3.23971223,CC_Chg,1
377
- 56.01873536,3.281151079,CC_Chg,1
378
- 59.76580796,3.322589928,CC_Chg,1
379
- 62.95081967,3.353669065,CC_Chg,1
380
- 65.76112412,3.384748201,CC_Chg,1
381
- 68.7587822,3.415827338,CC_Chg,1
382
- 71.94379391,3.446906475,CC_Chg,1
383
- 74.56674473,3.477985612,CC_Chg,1
384
- 77.37704918,3.515971223,CC_Chg,1
385
- 79.81264637,3.550503597,CC_Chg,1
386
- 82.24824356,3.585035971,CC_Chg,1
387
- 85.6206089,3.616115108,CC_Chg,1
388
- 88.99297424,3.64028777,CC_Chg,1
389
- 91.99063232,3.667913669,CC_Chg,1
390
- 94.9882904,3.702446043,CC_Chg,1
391
- 97.42388759,3.736978417,CC_Chg,1
392
- 99.85948478,3.754244604,CC_Chg,1
393
- 102.295082,3.788776978,CC_Chg,1
394
- 104.9180328,3.82676259,CC_Chg,1
395
- 107.35363,3.857841727,CC_Chg,1
396
- 109.6018735,3.892374101,CC_Chg,1
397
- 111.8501171,3.923453237,CC_Chg,1
398
- 114.2857143,3.964892086,CC_Chg,1
399
- 116.9086651,4.002877698,CC_Chg,1
400
- 119.5316159,4.044316547,CC_Chg,1
401
- 122.1545667,4.099568345,CC_Chg,1
402
- 124.5901639,4.103021583,CC_Chg,1
403
- 0,4.099568345,CC_DChg,2
404
- 0.74941452,4.061582734,CC_DChg,2
405
- 2.43559719,4.023597122,CC_DChg,2
406
- 4.683840749,3.975251799,CC_DChg,2
407
- 6.932084309,3.930359712,CC_DChg,2
408
- 9.180327869,3.892374101,CC_DChg,2
409
- 12.36533958,3.847482014,CC_DChg,2
410
- 14.80093677,3.809496403,CC_DChg,2
411
- 16.8618267,3.771510791,CC_DChg,2
412
- 19.67213115,3.740431655,CC_DChg,2
413
- 22.29508197,3.705899281,CC_DChg,2
414
- 25.10538642,3.671366906,CC_DChg,2
415
- 28.1030445,3.636834532,CC_DChg,2
416
- 30.72599532,3.602302158,CC_DChg,2
417
- 33.34894614,3.585035971,CC_DChg,2
418
- 35.5971897,3.564316547,CC_DChg,2
419
- 38.03278689,3.53323741,CC_DChg,2
420
- 40.46838407,3.502158273,CC_DChg,2
421
- 42.71662763,3.467625899,CC_DChg,2
422
- 44.96487119,3.436546763,CC_DChg,2
423
- 47.02576112,3.408920863,CC_DChg,2
424
- 49.64871194,3.384748201,CC_DChg,2
425
- 52.64637002,3.353669065,CC_DChg,2
426
- 54.89461358,3.326043165,CC_DChg,2
427
- 57.5175644,3.294964029,CC_DChg,2
428
- 59.57845433,3.270791367,CC_DChg,2
429
- 62.76346604,3.236258993,CC_DChg,2
430
- 65.19906323,3.205179856,CC_DChg,2
431
- 67.82201405,3.174100719,CC_DChg,2
432
- 70.07025761,3.143021583,CC_DChg,2
433
- 72.69320843,3.118848921,CC_DChg,2
434
- 74.75409836,3.094676259,CC_DChg,2
435
- 77.18969555,3.070503597,CC_DChg,2
436
- 78.87587822,3.035971223,CC_DChg,2
437
- 80.74941452,3.001438849,CC_DChg,2
438
- 83.37236534,2.956546763,CC_DChg,2
439
- 85.05854801,2.915107914,CC_DChg,2
440
- 86.93208431,2.88057554,CC_DChg,2
441
- 88.80562061,2.846043165,CC_DChg,2
442
- 91.05386417,2.818417266,CC_DChg,2
443
- 93.30210773,2.794244604,CC_DChg,2
444
- 95.36299766,2.776978417,CC_DChg,2
445
- 97.79859485,2.756258993,CC_DChg,2
446
- 100.4215457,2.735539568,CC_DChg,2
447
- 102.4824356,2.711366906,CC_DChg,2
448
- 104.1686183,2.68028777,CC_DChg,2
449
- 105.8548009,2.642302158,CC_DChg,2
450
- 107.9156909,2.590503597,CC_DChg,2
451
- 109.2271663,2.535251799,CC_DChg,2
452
- 110.9133489,2.486906475,CC_DChg,2
453
- 112.5995316,2.431654676,CC_DChg,2
454
- 114.0983607,2.376402878,CC_DChg,2
455
- 115.2224824,2.310791367,CC_DChg,2
456
- 116.1592506,2.245179856,CC_DChg,2
457
- 117.2833724,2.193381295,CC_DChg,2
458
- 117.6580796,2.145035971,CC_DChg,2
459
- 118.4074941,2.086330935,CC_DChg,2
460
- 119.7189696,2.037985612,CC_DChg,2
461
- 121.2177986,1.996546763,CC_DChg,2
462
- """
463
- )
464
-
465
- half_cell_data_2 = StringIO(
466
- """
467
- Specific Capacity (mAh/g),Voltage (V),Step Name,Step_ID
468
- 0,2.873669065,CC_Chg,1
469
- 1.12412178,2.863309353,CC_Chg,1
470
- 2.24824356,2.86676259,CC_Chg,1
471
- 3.55971897,2.877122302,CC_Chg,1
472
- 5.620608899,2.894388489,CC_Chg,1
473
- 8.805620609,2.915107914,CC_Chg,1
474
- 12.17798595,2.932374101,CC_Chg,1
475
- 16.67447307,2.96,CC_Chg,1
476
- 20.04683841,2.980719424,CC_Chg,1
477
- 23.79391101,3.004892086,CC_Chg,1
478
- 28.1030445,3.032517986,CC_Chg,1
479
- 31.66276347,3.073956835,CC_Chg,1
480
- 34.28571429,3.101582734,CC_Chg,1
481
- 37.65807963,3.132661871,CC_Chg,1
482
- 40.28103044,3.156834532,CC_Chg,1
483
- 43.65339578,3.187913669,CC_Chg,1
484
- 46.2763466,3.212086331,CC_Chg,1
485
- 49.46135831,3.243165468,CC_Chg,1
486
- 52.08430913,3.274244604,CC_Chg,1
487
- 54.51990632,3.298417266,CC_Chg,1
488
- 56.95550351,3.322589928,CC_Chg,1
489
- 59.76580796,3.34676259,CC_Chg,1
490
- 62.76346604,3.377841727,CC_Chg,1
491
- 65.57377049,3.408920863,CC_Chg,1
492
- 68.7587822,3.44,CC_Chg,1
493
- 71.94379391,3.464172662,CC_Chg,1
494
- 74.75409836,3.491798561,CC_Chg,1
495
- 78.50117096,3.53323741,CC_Chg,1
496
- 81.31147541,3.578129496,CC_Chg,1
497
- 83.93442623,3.598848921,CC_Chg,1
498
- 86.93208431,3.62647482,CC_Chg,1
499
- 90.30444965,3.654100719,CC_Chg,1
500
- 93.67681499,3.688633094,CC_Chg,1
501
- 96.67447307,3.726618705,CC_Chg,1
502
- 99.67213115,3.761151079,CC_Chg,1
503
- 102.4824356,3.802589928,CC_Chg,1
504
- 104.9180328,3.830215827,CC_Chg,1
505
- 106.9789227,3.861294964,CC_Chg,1
506
- 109.4145199,3.895827338,CC_Chg,1
507
- 111.4754098,3.923453237,CC_Chg,1
508
- 113.911007,3.964892086,CC_Chg,1
509
- 116.1592506,3.995971223,CC_Chg,1
510
- 118.5948478,4.023597122,CC_Chg,1
511
- 121.5925059,4.065035971,CC_Chg,1
512
- 124.028103,4.103021583,CC_Chg,1
513
- 126.8384075,4.134100719,CC_Chg,1
514
- 129.6487119,4.154820144,CC_Chg,1
515
- 132.2716628,4.175539568,CC_Chg,1
516
- 135.0819672,4.189352518,CC_Chg,1
517
- 138.8290398,4.19971223,CC_Chg,1
518
- 142.2014052,4.216978417,CC_Chg,1
519
- 144.824356,4.234244604,CC_Chg,1
520
- 146.8852459,4.254964029,CC_Chg,1
521
- 150.8196721,4.251510791,CC_Chg,1
522
- 0,4.254964029,CC_DChg,2
523
- 0.37470726,4.220431655,CC_DChg,2
524
- 1.31147541,4.189352518,CC_DChg,2
525
- 2.62295082,4.154820144,CC_DChg,2
526
- 4.496487119,4.123741007,CC_DChg,2
527
- 7.119437939,4.085755396,CC_DChg,2
528
- 9.742388759,4.061582734,CC_DChg,2
529
- 11.80327869,4.037410072,CC_DChg,2
530
- 14.23887588,4.016690647,CC_DChg,2
531
- 16.67447307,3.99942446,CC_DChg,2
532
- 18.92271663,3.982158273,CC_DChg,2
533
- 20.98360656,3.964892086,CC_DChg,2
534
- 22.85714286,3.947625899,CC_DChg,2
535
- 24.54332553,3.923453237,CC_DChg,2
536
- 27.35362998,3.892374101,CC_DChg,2
537
- 29.9765808,3.854388489,CC_DChg,2
538
- 32.78688525,3.82676259,CC_DChg,2
539
- 35.22248244,3.799136691,CC_DChg,2
540
- 37.470726,3.764604317,CC_DChg,2
541
- 40.09367681,3.73352518,CC_DChg,2
542
- 42.529274,3.702446043,CC_DChg,2
543
- 45.15222482,3.667913669,CC_DChg,2
544
- 47.58782201,3.636834532,CC_DChg,2
545
- 50.0234192,3.612661871,CC_DChg,2
546
- 53.02107728,3.581582734,CC_DChg,2
547
- 55.08196721,3.564316547,CC_DChg,2
548
- 57.33021077,3.540143885,CC_DChg,2
549
- 60.14051522,3.509064748,CC_DChg,2
550
- 63.1381733,3.474532374,CC_DChg,2
551
- 65.94847775,3.433093525,CC_DChg,2
552
- 68.94613583,3.402014388,CC_DChg,2
553
- 71.56908665,3.377841727,CC_DChg,2
554
- 74.94145199,3.343309353,CC_DChg,2
555
- 77.75175644,3.315683453,CC_DChg,2
556
- 80,3.291510791,CC_DChg,2
557
- 82.43559719,3.263884892,CC_DChg,2
558
- 85.24590164,3.232805755,CC_DChg,2
559
- 87.68149883,3.208633094,CC_DChg,2
560
- 89.92974239,3.184460432,CC_DChg,2
561
- 91.99063232,3.163741007,CC_DChg,2
562
- 94.42622951,3.139568345,CC_DChg,2
563
- 96.8618267,3.118848921,CC_DChg,2
564
- 99.48477752,3.087769784,CC_DChg,2
565
- 101.9203747,3.056690647,CC_DChg,2
566
- 104.1686183,3.029064748,CC_DChg,2
567
- 106.4168618,2.994532374,CC_DChg,2
568
- 109.0398126,2.953093525,CC_DChg,2
569
- 111.2880562,2.915107914,CC_DChg,2
570
- 113.1615925,2.88057554,CC_DChg,2
571
- 115.4098361,2.846043165,CC_DChg,2
572
- 117.8454333,2.808057554,CC_DChg,2
573
- 120.6557377,2.780431655,CC_DChg,2
574
- 123.2786885,2.763165468,CC_DChg,2
575
- 125.7142857,2.742446043,CC_DChg,2
576
- 127.9625293,2.718273381,CC_DChg,2
577
- 130.0234192,2.690647482,CC_DChg,2
578
- 131.7096019,2.659568345,CC_DChg,2
579
- 133.0210773,2.625035971,CC_DChg,2
580
- 134.5199063,2.583597122,CC_DChg,2
581
- 135.6440281,2.549064748,CC_DChg,2
582
- 136.7681499,2.504172662,CC_DChg,2
583
- 137.8922717,2.459280576,CC_DChg,2
584
- 139.2037471,2.404028777,CC_DChg,2
585
- 140.1405152,2.341870504,CC_DChg,2
586
- 141.264637,2.286618705,CC_DChg,2
587
- 142.2014052,2.241726619,CC_DChg,2
588
- 142.9508197,2.183021583,CC_DChg,2
589
- 143.7002342,2.127769784,CC_DChg,2
590
- 144.4496487,2.086330935,CC_DChg,2
591
- 145.5737705,2.048345324,CC_DChg,2
592
- 147.2599532,2,CC_DChg,2
593
- """
594
- )
595
-
596
- half_cell_data_3 = StringIO(
597
- """
598
- Specific Capacity (mAh/g),Voltage (V),Step Name,Step_ID
599
- 0,2.839136691,CC_Chg,1
600
- 2.06088993,2.842589928,CC_Chg,1
601
- 4.309133489,2.85294964,CC_Chg,1
602
- 7.681498829,2.88057554,CC_Chg,1
603
- 10.49180328,2.904748201,CC_Chg,1
604
- 12.92740047,2.932374101,CC_Chg,1
605
- 16.29976581,2.956546763,CC_Chg,1
606
- 19.11007026,2.97381295,CC_Chg,1
607
- 21.17096019,2.991079137,CC_Chg,1
608
- 23.98126464,3.018705036,CC_Chg,1
609
- 26.97892272,3.03942446,CC_Chg,1
610
- 29.60187354,3.06705036,CC_Chg,1
611
- 32.22482436,3.094676259,CC_Chg,1
612
- 34.66042155,3.115395683,CC_Chg,1
613
- 36.90866511,3.139568345,CC_Chg,1
614
- 39.71896956,3.167194245,CC_Chg,1
615
- 42.529274,3.191366906,CC_Chg,1
616
- 45.71428571,3.218992806,CC_Chg,1
617
- 48.71194379,3.23971223,CC_Chg,1
618
- 52.27166276,3.277697842,CC_Chg,1
619
- 55.08196721,3.305323741,CC_Chg,1
620
- 58.26697892,3.336402878,CC_Chg,1
621
- 61.63934426,3.374388489,CC_Chg,1
622
- 64.44964871,3.398561151,CC_Chg,1
623
- 67.07259953,3.415827338,CC_Chg,1
624
- 70.25761124,3.450359712,CC_Chg,1
625
- 73.06791569,3.481438849,CC_Chg,1
626
- 75.87822014,3.512517986,CC_Chg,1
627
- 78.68852459,3.54705036,CC_Chg,1
628
- 81.49882904,3.585035971,CC_Chg,1
629
- 85.24590164,3.612661871,CC_Chg,1
630
- 88.05620609,3.64028777,CC_Chg,1
631
- 91.05386417,3.664460432,CC_Chg,1
632
- 93.86416862,3.695539568,CC_Chg,1
633
- 96.67447307,3.730071942,CC_Chg,1
634
- 99.29742389,3.764604317,CC_Chg,1
635
- 102.1077283,3.806043165,CC_Chg,1
636
- 105.29274,3.837122302,CC_Chg,1
637
- 108.1030445,3.878561151,CC_Chg,1
638
- 111.8501171,3.930359712,CC_Chg,1
639
- 115.2224824,3.978705036,CC_Chg,1
640
- 118.0327869,4.020143885,CC_Chg,1
641
- 121.030445,4.058129496,CC_Chg,1
642
- 124.4028103,4.10647482,CC_Chg,1
643
- 127.2131148,4.134100719,CC_Chg,1
644
- 130.3981265,4.158273381,CC_Chg,1
645
- 134.3325527,4.182446043,CC_Chg,1
646
- 137.704918,4.192805755,CC_Chg,1
647
- 140.5152225,4.206618705,CC_Chg,1
648
- 143.8875878,4.227338129,CC_Chg,1
649
- 147.2599532,4.254964029,CC_Chg,1
650
- 149.5081967,4.282589928,CC_Chg,1
651
- 152.1311475,4.310215827,CC_Chg,1
652
- 155.1288056,4.348201439,CC_Chg,1
653
- 159.8126464,4.355107914,CC_Chg,1
654
- 0,4.348201439,CC_DChg,2
655
- 0.74941452,4.303309353,CC_DChg,2
656
- 1.8735363,4.258417266,CC_DChg,2
657
- 3.55971897,4.216978417,CC_DChg,2
658
- 4.683840749,4.185899281,CC_DChg,2
659
- 6.932084309,4.141007194,CC_DChg,2
660
- 8.992974239,4.109928058,CC_DChg,2
661
- 11.42857143,4.075395683,CC_DChg,2
662
- 14.42622951,4.044316547,CC_DChg,2
663
- 18.17330211,4.01323741,CC_DChg,2
664
- 20.79625293,3.989064748,CC_DChg,2
665
- 23.60655738,3.975251799,CC_DChg,2
666
- 26.79156909,3.951079137,CC_DChg,2
667
- 29.22716628,3.923453237,CC_DChg,2
668
- 32.03747073,3.892374101,CC_DChg,2
669
- 34.47306792,3.861294964,CC_DChg,2
670
- 37.470726,3.823309353,CC_DChg,2
671
- 39.90632319,3.799136691,CC_DChg,2
672
- 42.34192037,3.768057554,CC_DChg,2
673
- 45.52693208,3.730071942,CC_DChg,2
674
- 49.27400468,3.685179856,CC_DChg,2
675
- 52.45901639,3.647194245,CC_DChg,2
676
- 55.08196721,3.616115108,CC_DChg,2
677
- 59.01639344,3.574676259,CC_DChg,2
678
- 62.76346604,3.540143885,CC_DChg,2
679
- 66.32318501,3.498705036,CC_DChg,2
680
- 69.32084309,3.457266187,CC_DChg,2
681
- 72.5058548,3.422733813,CC_DChg,2
682
- 75.50351288,3.391654676,CC_DChg,2
683
- 78.31381733,3.36057554,CC_DChg,2
684
- 81.68618267,3.33294964,CC_DChg,2
685
- 85.99531616,3.284604317,CC_DChg,2
686
- 89.55503513,3.250071942,CC_DChg,2
687
- 92.92740047,3.208633094,CC_DChg,2
688
- 97.61124122,3.163741007,CC_DChg,2
689
- 100.9836066,3.132661871,CC_DChg,2
690
- 105.29274,3.084316547,CC_DChg,2
691
- 108.6651054,3.03942446,CC_DChg,2
692
- 112.9742389,2.984172662,CC_DChg,2
693
- 115.7845433,2.939280576,CC_DChg,2
694
- 118.969555,2.887482014,CC_DChg,2
695
- 121.5925059,2.849496403,CC_DChg,2
696
- 124.4028103,2.804604317,CC_DChg,2
697
- 127.0257611,2.770071942,CC_DChg,2
698
- 129.8360656,2.742446043,CC_DChg,2
699
- 133.2084309,2.714820144,CC_DChg,2
700
- 135.4566745,2.687194245,CC_DChg,2
701
- 137.704918,2.645755396,CC_DChg,2
702
- 140.5152225,2.590503597,CC_DChg,2
703
- 143.1381733,2.514532374,CC_DChg,2
704
- 145.1990632,2.438561151,CC_DChg,2
705
- 146.6978923,2.369496403,CC_DChg,2
706
- 148.1967213,2.300431655,CC_DChg,2
707
- 149.5081967,2.234820144,CC_DChg,2
708
- 150.8196721,2.165755396,CC_DChg,2
709
- 151.9437939,2.110503597,CC_DChg,2
710
- 153.6299766,2.055251799,CC_DChg,2
711
- 156.0655738,2.003453237,CC_DChg,2
712
- """
713
- )
714
-
715
- half_cell_1 = (
716
- pd.read_csv(
717
- half_cell_data_1,
718
- skiprows=2,
719
- names=["specific_capacity", "voltage", "direction", "id"],
720
- )
721
- .drop(columns=["id"])
722
- .assign(
723
- direction=lambda x: x["direction"].apply(
724
- lambda y: (
725
- "discharge"
726
- if "CC_DChg" in y
727
- else "charge" if "CC_Chg" in y else None
728
- )
729
- ),
730
- )
731
- )
732
-
733
- half_cell_2 = (
734
- pd.read_csv(
735
- half_cell_data_2,
736
- skiprows=2,
737
- names=["specific_capacity", "voltage", "direction", "id"],
738
- )
739
- .drop(columns=["id"])
740
- .assign(
741
- direction=lambda x: x["direction"].apply(
742
- lambda y: (
743
- "discharge"
744
- if "CC_DChg" in y
745
- else "charge" if "CC_Chg" in y else None
746
- )
747
- ),
748
- )
749
- )
750
-
751
- half_cell_3 = (
752
- pd.read_csv(
753
- half_cell_data_3,
754
- skiprows=2,
755
- names=["specific_capacity", "voltage", "direction", "id"],
756
- )
757
- .drop(columns=["id"])
758
- .assign(
759
- direction=lambda x: x["direction"].apply(
760
- lambda y: (
761
- "discharge"
762
- if "CC_DChg" in y
763
- else "charge" if "CC_Chg" in y else None
764
- )
765
- ),
766
- )
767
- )
768
-
769
- self.material = CathodeMaterial(
770
- name="NMM",
771
- half_cell_curves=[half_cell_1, half_cell_2, half_cell_3],
772
- reference="Na/Na+",
773
- density=4.4,
774
- specific_cost=1.1,
775
- )
776
-
777
- def test_instantiation(self):
778
- self.assertIsInstance(self.material, CathodeMaterial)
779
- self.assertTrue(self.material.voltage_cutoff_range == (3.7, 4.36))
780
-
781
- def test_voltage_setter_extrapolate(self):
782
-
783
- self.material.voltage_cutoff = 4.1
784
- data = self.material.half_cell_curve
785
- figure = self.material.plot_half_cell_curve()
786
-
787
- self.assertEqual(round(data["Voltage (V)"].max(), 10), 4.1)
788
- self.assertEqual(
789
- round(
790
- data.query('Direction == "discharge"')[
791
- "Specific Capacity (mAh/g)"
792
- ].min(),
793
- 2,
794
- ),
795
- 1.24,
796
- )
797
- self.assertEqual(
798
- round(data.query('Direction == "discharge"')["Voltage (V)"].min(), 2), 2
799
- )
800
- self.assertEqual(
801
- round(
802
- data.query('Direction == "charge"')["Specific Capacity (mAh/g)"].max(),
803
- 2,
804
- ),
805
- 122.46,
806
- )
807
-
808
- # figure.show()
809
-
810
- def test_voltage_setter_interpolate(self):
811
-
812
- self.material.voltage_cutoff = 4.2
813
- data = self.material.half_cell_curve
814
- figure = self.material.plot_half_cell_curve()
815
-
816
- self.assertEqual(round(data["Voltage (V)"].max(), 2), 4.20)
817
- self.assertEqual(
818
- round(
819
- data.query('Direction == "discharge"')[
820
- "Specific Capacity (mAh/g)"
821
- ].min(),
822
- 2,
823
- ),
824
- 3.49,
825
- )
826
- self.assertEqual(
827
- round(data.query('Direction == "discharge"')["Voltage (V)"].min(), 2), 2.0
828
- )
829
- self.assertEqual(
830
- round(
831
- data.query('Direction == "charge"')["Specific Capacity (mAh/g)"].max(),
832
- 2,
833
- ),
834
- 141.33,
835
- )
836
-
837
- # figure.show()
838
-
839
-
840
- class TestHardCarbon(unittest.TestCase):
841
-
842
- def setUp(self):
843
-
844
- half_cell_data = StringIO(
845
- """
846
- Specific Capacity (mAh/g),Voltage (V),Step Name,Step_ID
847
- 0,2.063123515,CC_DChg,1
848
- 0,2.023708432,CC_DChg,1
849
- 0,1.966775534,CC_DChg,1
850
- 0,1.918601544,CC_DChg,1
851
- 0,1.877544166,CC_DChg,1
852
- 0,1.839771378,CC_DChg,1
853
- 0,1.80199859,CC_DChg,1
854
- 0,1.760941211,CC_DChg,1
855
- 0,1.721526128,CC_DChg,1
856
- 0,1.681782586,CC_DChg,1
857
- 0,1.642695962,CC_DChg,1
858
- 0,1.604923174,CC_DChg,1
859
- 0,1.560581205,CC_DChg,1
860
- 0,1.521166122,CC_DChg,1
861
- 0,1.480108744,CC_DChg,1
862
- 0,1.442335956,CC_DChg,1
863
- 0,1.404563168,CC_DChg,1
864
- 0,1.36350579,CC_DChg,1
865
- 0.112145985,1.313415788,CC_DChg,1
866
- 0.627917606,1.262778355,CC_DChg,1
867
- 2.101550812,1.223089556,CC_DChg,1
868
- 5.196180543,1.17792644,CC_DChg,1
869
- 8.732900235,1.131942176,CC_DChg,1
870
- 12.26961993,1.085957913,CC_DChg,1
871
- 15.36424966,1.047090261,CC_DChg,1
872
- 18.45887939,1.002200861,CC_DChg,1
873
- 21.99559908,0.95539545,CC_DChg,1
874
- 25.53231877,0.907768891,CC_DChg,1
875
- 29.06903847,0.862605775,CC_DChg,1
876
- 32.60575816,0.819084954,CC_DChg,1
877
- 36.14247785,0.778027576,CC_DChg,1
878
- 39.67919754,0.73943364,CC_DChg,1
879
- 43.6580072,0.696733967,CC_DChg,1
880
- 48.07890681,0.654691211,CC_DChg,1
881
- 52.49980643,0.616589964,CC_DChg,1
882
- 57.36279601,0.579583581,CC_DChg,1
883
- 62.66787555,0.539621066,CC_DChg,1
884
- 67.53086512,0.503600059,CC_DChg,1
885
- 72.3938547,0.466812648,CC_DChg,1
886
- 77.69893424,0.424660407,CC_DChg,1
887
- 83.00401378,0.38415046,CC_DChg,1
888
- 88.30909332,0.343093082,CC_DChg,1
889
- 93.61417285,0.305320294,CC_DChg,1
890
- 98.91925239,0.268094938,CC_DChg,1
891
- 104.2243319,0.235249035,CC_DChg,1
892
- 109.5294115,0.205687723,CC_DChg,1
893
- 114.834491,0.181053296,CC_DChg,1
894
- 120.1395705,0.161893186,CC_DChg,1
895
- 125.4446501,0.145470235,CC_DChg,1
896
- 130.7497296,0.130689578,CC_DChg,1
897
- 138.7073489,0.10550772,CC_DChg,1
898
- 144.0124285,0.100580834,CC_DChg,1
899
- 149.317508,0.098938539,CC_DChg,1
900
- 154.6225876,0.096201381,CC_DChg,1
901
- 159.9276671,0.09163945,CC_DChg,1
902
- 165.2327466,0.085800178,CC_DChg,1
903
- 170.5378262,0.079778429,CC_DChg,1
904
- 175.8429057,0.076493839,CC_DChg,1
905
- 181.1479852,0.073756681,CC_DChg,1
906
- 186.4530648,0.072661817,CC_DChg,1
907
- 191.7581443,0.069924659,CC_DChg,1
908
- 197.0632239,0.068282363,CC_DChg,1
909
- 202.3683034,0.066092637,CC_DChg,1
910
- 207.6733829,0.066092637,CC_DChg,1
911
- 212.9784625,0.065545205,CC_DChg,1
912
- 218.283542,0.062808046,CC_DChg,1
913
- 223.5886216,0.061713183,CC_DChg,1
914
- 228.8937011,0.059523456,CC_DChg,1
915
- 234.1987806,0.059523456,CC_DChg,1
916
- 239.5038602,0.059523456,CC_DChg,1
917
- 244.8089397,0.057881161,CC_DChg,1
918
- 250.1140192,0.052954276,CC_DChg,1
919
- 255.4190988,0.052954276,CC_DChg,1
920
- 260.7241783,0.053501707,CC_DChg,1
921
- 266.0292579,0.054596571,CC_DChg,1
922
- 271.3343374,0.052954276,CC_DChg,1
923
- 276.6394169,0.049122254,CC_DChg,1
924
- 281.9444965,0.046385095,CC_DChg,1
925
- 287.249576,0.046385095,CC_DChg,1
926
- 292.5546556,0.045837663,CC_DChg,1
927
- 297.8597351,0.039815914,CC_DChg,1
928
- 303.1648146,0.039815914,CC_DChg,1
929
- 308.4698942,0.039815914,CC_DChg,1
930
- 313.7749737,0.033246734,CC_DChg,1
931
- 319.0800533,0.033246734,CC_DChg,1
932
- 324.3851328,0.029962144,CC_DChg,1
933
- 329.6902123,0.026677553,CC_DChg,1
934
- 334.9952919,0.024487827,CC_DChg,1
935
- 340.3003714,0.020108373,CC_DChg,1
936
- 345.6054509,0.014634056,CC_DChg,1
937
- 350.9105305,0.009159739,CC_DChg,1
938
- 356.21561,0.002590558,CC_DChg,1
939
- 359.7523297,-0.001241464,CC_DChg,1
940
- 1.65946085,0.031057007,CC_Chg,2
941
- 6.964540389,0.039815914,CC_Chg,2
942
- 12.26961993,0.048574822,CC_Chg,2
943
- 17.57469947,0.055691434,CC_Chg,2
944
- 22.879779,0.062260615,CC_Chg,2
945
- 28.18485854,0.066092637,CC_Chg,2
946
- 33.48993808,0.071566954,CC_Chg,2
947
- 38.79501762,0.072661817,CC_Chg,2
948
- 44.10009716,0.075946407,CC_Chg,2
949
- 49.4051767,0.079230998,CC_Chg,2
950
- 54.71025624,0.079230998,CC_Chg,2
951
- 60.01533578,0.082515588,CC_Chg,2
952
- 65.32041531,0.085800178,CC_Chg,2
953
- 70.62549485,0.085800178,CC_Chg,2
954
- 75.93057439,0.085800178,CC_Chg,2
955
- 81.23565393,0.085800178,CC_Chg,2
956
- 86.54073347,0.085800178,CC_Chg,2
957
- 91.84581301,0.085800178,CC_Chg,2
958
- 97.15089255,0.087442473,CC_Chg,2
959
- 102.4559721,0.090727064,CC_Chg,2
960
- 107.7610516,0.092369359,CC_Chg,2
961
- 113.0661312,0.092369359,CC_Chg,2
962
- 118.3712107,0.092369359,CC_Chg,2
963
- 123.6762902,0.092369359,CC_Chg,2
964
- 128.9813698,0.092369359,CC_Chg,2
965
- 134.2864493,0.095653949,CC_Chg,2
966
- 139.5915289,0.100033403,CC_Chg,2
967
- 144.8966084,0.100033403,CC_Chg,2
968
- 150.2016879,0.098938539,CC_Chg,2
969
- 155.5067675,0.096748812,CC_Chg,2
970
- 160.811847,0.100580834,CC_Chg,2
971
- 166.1169266,0.104960288,CC_Chg,2
972
- 171.4220061,0.10550772,CC_Chg,2
973
- 176.7270856,0.106055151,CC_Chg,2
974
- 182.0321652,0.111529469,CC_Chg,2
975
- 187.3372447,0.112624332,CC_Chg,2
976
- 192.6423242,0.118646081,CC_Chg,2
977
- 197.9474038,0.124120398,CC_Chg,2
978
- 203.2524833,0.132879305,CC_Chg,2
979
- 208.5575629,0.142733076,CC_Chg,2
980
- 213.8626424,0.1569663,CC_Chg,2
981
- 219.1677219,0.17284182,CC_Chg,2
982
- 224.4728015,0.193644225,CC_Chg,2
983
- 229.777881,0.220468379,CC_Chg,2
984
- 235.0829606,0.253861713,CC_Chg,2
985
- 239.9459501,0.29075861,CC_Chg,2
986
- 244.3668497,0.328859857,CC_Chg,2
987
- 248.7877494,0.365647268,CC_Chg,2
988
- 253.208649,0.40571927,CC_Chg,2
989
- 257.6295486,0.447105107,CC_Chg,2
990
- 262.0504482,0.487177108,CC_Chg,2
991
- 266.0292579,0.526756421,CC_Chg,2
992
- 270.0080675,0.564693438,CC_Chg,2
993
- 273.9868772,0.601480849,CC_Chg,2
994
- 277.9656868,0.640895932,CC_Chg,2
995
- 281.9444965,0.676205278,CC_Chg,2
996
- 285.9233061,0.717098426,CC_Chg,2
997
- 290.3442057,0.755856591,CC_Chg,2
998
- 294.7651054,0.801183937,CC_Chg,2
999
- 298.743915,0.839613643,CC_Chg,2
1000
- 302.2806347,0.877386431,CC_Chg,2
1001
- 305.8173544,0.916801514,CC_Chg,2
1002
- 308.9119841,0.951837144,CC_Chg,2
1003
- 312.0066139,0.990704795,CC_Chg,2
1004
- 315.1012436,1.031762173,CC_Chg,2
1005
- 317.7537834,1.07227212,CC_Chg,2
1006
- 320.4063231,1.11387693,CC_Chg,2
1007
- 322.6167729,1.154934308,CC_Chg,2
1008
- 324.8272228,1.20037114,CC_Chg,2
1009
- 326.1534926,1.250187426,CC_Chg,2
1010
- 327.4797625,1.303562018,CC_Chg,2
1011
- 327.9218525,1.3602212,CC_Chg,2
1012
- 328.9533957,1.454379454,CC_Chg,2
1013
- 328.8060324,1.406205463,CC_Chg,2
1014
- 329.6902123,1.596711698,CC_Chg,2
1015
- 329.8375756,1.548537708,CC_Chg,2
1016
- 329.2481224,1.517881532,CC_Chg,2
1017
- 330.7217556,1.920791271,CC_Chg,2
1018
- 330.5743923,1.86933269,CC_Chg,2
1019
- 330.5743923,1.829917607,CC_Chg,2
1020
- 330.5743923,1.790502524,CC_Chg,2
1021
- 330.5743923,1.754372031,CC_Chg,2
1022
- 330.1323023,1.714956948,CC_Chg,2
1023
- 330.1323023,1.675541865,CC_Chg,2
1024
- 330.1323023,1.636126781,CC_Chg,2
1025
- 331.0164822,1.984293349,CC_Chg,2
1026
- """
1027
- )
1028
-
1029
- half_cell = (
1030
- pd.read_csv(
1031
- half_cell_data,
1032
- skiprows=2,
1033
- names=["specific_capacity", "voltage", "direction", "id"],
1034
- )
1035
- .drop(columns=["id"])
1036
- .assign(
1037
- direction=lambda x: x["direction"].apply(
1038
- lambda y: (
1039
- "discharge"
1040
- if "CC_DChg" in y
1041
- else "charge" if "CC_Chg" in y else None
1042
- )
1043
- ),
1044
- )
1045
- )
1046
-
1047
- self.material = AnodeMaterial(
1048
- name="Hard Carbon",
1049
- half_cell_curves=[half_cell],
1050
- reference="Na/Na+",
1051
- density=1.5,
1052
- specific_cost=7,
1053
- )
1054
-
1055
- def test_instantiation(self):
1056
- """
1057
- Test instantiation
1058
- """
1059
- self.assertTrue(isinstance(self.material, AnodeMaterial))
1060
- self.assertEqual(self.material.voltage_cutoff_range, (0.05, 0))
1061
- figure = self.material.plot_half_cell_curve()
1062
-
1063
- # figure.show()
1064
-
1065
- def test_voltage_setter_extrapolate(self):
1066
- """
1067
- Test voltage setter with extrapolation
1068
- """
1069
- self.material.voltage_cutoff = 0
1070
- data = self.material.half_cell_curve
1071
- figure = self.material.plot_half_cell_curve()
1072
-
1073
- self.assertEqual(round(data["Voltage (V)"].min(), 10), 0)
1074
- self.assertEqual(
1075
- round(
1076
- data.query('Direction == "discharge"')[
1077
- "Specific Capacity (mAh/g)"
1078
- ].max(),
1079
- 2,
1080
- ),
1081
- 358.61,
1082
- )
1083
- self.assertEqual(
1084
- round(data.query('Direction == "discharge"')["Voltage (V)"].min(), 2), 0.0
1085
- )
1086
-
1087
- # figure.show()
1088
-
1089
- def test_reversible_capacity_scaling(self):
1090
- """
1091
- Test reversible capacity scaling
1092
- """
1093
- self.material.reversible_capacity_scaling = 0.5
1094
- data = self.material.half_cell_curve
1095
- figure = self.material.plot_half_cell_curve()
1096
-
1097
- self.assertEqual(round(data["Voltage (V)"].max(), 2), 2.06)
1098
- self.assertEqual(
1099
- round(
1100
- data.query('Direction == "discharge"')[
1101
- "Specific Capacity (mAh/g)"
1102
- ].min(),
1103
- 2,
1104
- ),
1105
- 194.24,
1106
- )
1107
- self.assertEqual(
1108
- round(data.query('Direction == "discharge"')["Voltage (V)"].min(), 2), 0
1109
- )
1110
- self.assertEqual(
1111
- round(
1112
- data.query('Direction == "charge"')["Specific Capacity (mAh/g)"].max(),
1113
- 2,
1114
- ),
1115
- 359.75,
1116
- )
1117
-
1118
- # figure.show()
1119
-
1120
-
1121
- class TestBinder(unittest.TestCase):
1122
- def setUp(self):
1123
- self.name = "PVDF"
1124
- self.specific_cost = 20.0
1125
- self.density = 1.7
1126
- self.color = "#ff0000"
1127
- self.binder = Binder(
1128
- name=self.name,
1129
- specific_cost=self.specific_cost,
1130
- density=self.density,
1131
- color=self.color,
1132
- )
1133
-
1134
- def test_instantiation(self):
1135
- self.assertIsInstance(self.binder, Binder)
1136
- self.assertEqual(self.binder.name, self.name)
1137
- self.assertEqual(self.binder.specific_cost, self.specific_cost)
1138
- self.assertEqual(self.binder.density, self.density)
1139
- self.assertEqual(self.binder.color, self.color)
1140
-
1141
-
1142
- class TestConductiveAdditive(unittest.TestCase):
1143
- def setUp(self):
1144
- self.name = "Carbon Black"
1145
- self.specific_cost = 10.0
1146
- self.density = 2.0
1147
- self.color = "#000000"
1148
- self.additive = ConductiveAdditive(
1149
- name=self.name,
1150
- specific_cost=self.specific_cost,
1151
- density=self.density,
1152
- color=self.color,
1153
- )
1154
-
1155
- def test_instantiation(self):
1156
- self.assertIsInstance(self.additive, ConductiveAdditive)
1157
- self.assertEqual(self.additive.name, self.name)
1158
- self.assertEqual(self.additive.specific_cost, self.specific_cost)
1159
- self.assertEqual(self.additive.density, self.density)
1160
- self.assertEqual(self.additive.color, self.color)
@@ -1,39 +0,0 @@
1
- import unittest
2
-
3
- from steer_materials.Electrolytes.Electrolytes import Electrolyte
4
-
5
-
6
- class TestElectrolyteVolumeMassCost(unittest.TestCase):
7
-
8
- def setUp(self):
9
- self.electrolyte = Electrolyte(
10
- name="Test Electrolyte",
11
- density=1.2, # g/cm^3
12
- specific_cost=15.0, # $/kg
13
- color="#abcdef",
14
- )
15
-
16
- def test_volume_setter_updates_mass_and_cost(self):
17
- self.electrolyte.volume = 10.0
18
-
19
- self.assertAlmostEqual(self.electrolyte.volume, 10.0, places=4)
20
- self.assertAlmostEqual(self.electrolyte.mass, 12.0, places=2)
21
- self.assertAlmostEqual(self.electrolyte.cost, 0.18, places=2)
22
-
23
- def test_mass_setter_updates_volume_and_cost(self):
24
- self.electrolyte.mass = 25.0
25
-
26
- self.assertAlmostEqual(self.electrolyte.mass, 25.0, places=2)
27
- self.assertAlmostEqual(self.electrolyte.volume, 20.8333, places=3)
28
- self.assertAlmostEqual(self.electrolyte.cost, 0.38, places=2)
29
-
30
- def test_cost_setter_updates_mass_and_volume(self):
31
- self.electrolyte.cost = 5.0
32
-
33
- self.assertAlmostEqual(self.electrolyte.cost, 5.0, places=2)
34
- self.assertAlmostEqual(self.electrolyte.mass, 333.33, places=2)
35
- self.assertAlmostEqual(self.electrolyte.volume, 277.7778, places=1)
36
-
37
-
38
- if __name__ == "__main__":
39
- unittest.main()