philipp007 / masters_thesis

TUM, CSE: Modelling and coupled simulation of a thermal and electrochemical system
0 stars 0 forks source link

Attribute error in pp_dummy.py #3

Closed MakisH closed 10 months ago

MakisH commented 10 months ago

Trying to run pp_dummy.py, I get the following error after closing the first plot window:

vagrant@precicevm:~/Desktop/masters_thesis/measurement_data$ python3 ./pp_dummy.py 
Traceback (most recent call last):
  File "./pp_dummy.py", line 310, in <module>
    battery_charge_cycles.plot_me()
AttributeError: 'list' object has no attribute 'plot_me'

I get this both with dummy_battery_data.csv and with dummy_battery_short.csv. With some educated guess, I modified the following:

[battery_charge_cycles, battery_discharge_cycles] = battery.find_cycles() 
- battery_charge_cycles.plot_me()
- battery_discharge_cycles.plot_me()
+ battery_charge_cycles[0].plot_me()
+ battery_discharge_cycles[0].plot_me()

which generated a few more plots, and eventually crashed again with a similar error:

vagrant@precicevm:~/Desktop/masters_thesis/measurement_data$ python3 pp_dummy.py 
Traceback (most recent call last):
  File "pp_dummy.py", line 315, in <module>
    battery_SOC_data = SOC_data(battery_charge_cycles, battery_discharge_cycles)
  File "pp_dummy.py", line 183, in __init__
    self.ID = cycles.ID
AttributeError: 'list' object has no attribute 'ID'

Applying the same change:

- battery_SOC_data = SOC_data(battery_charge_cycles, battery_discharge_cycles)
+ battery_SOC_data = SOC_data(battery_charge_cycles[0], battery_discharge_cycles[0])

I am getting another error:

vagrant@precicevm:~/Desktop/masters_thesis/measurement_data$ python3 pp_dummy.py 
Traceback (most recent call last):
  File "pp_dummy.py", line 315, in <module>
    battery_SOC_data = SOC_data(battery_charge_cycles[0], battery_discharge_cycles[0])
  File "pp_dummy.py", line 184, in __init__
    [self.SOC, self.Cap, self.time] = self.capacity_array(cycles, total_cap)
  File "pp_dummy.py", line 243, in capacity_array
    comparing_cap = total_cap*0.9999*1e9*3.6
TypeError: unsupported operand type(s) for *: 'm_data' and 'float'

Furthermore, I notice that the call to the constructor is:

battery_SOC_data = SOC_data(battery_charge_cycles, battery_discharge_cycles)

but the total_cap name in the constructor suggests that a different kind of argument is expected here:

https://github.com/philipp007/masters_thesis/blob/ed908330824ee0a4ef18ddaf831505c0c15f3f4e/measurement_data/pp_dummy.py#L181-L185

I am not sure how to continue debugging. @philipp007 any suggestions? Is the code or the dataset outdated?

edit: Same on a different system with Ubuntu 22.04 and Python 3.10.12.

philipp007 commented 10 months ago

should run now, I did some changes

MakisH commented 10 months ago

@philipp007 thanks a lot for the quick update! 🚀

The first issues are now fixed. I still have a similar error as the last one, though:

vagrant@precicevm:~/Desktop/masters_thesis/measurement_data$ python3 pp_dummy.py 
Traceback (most recent call last):
  File "pp_dummy.py", line 322, in <module>
    tmp = SOC_data(battery_discharge_cycles[elem], battery_discharge_cap)
  File "pp_dummy.py", line 184, in __init__
    [self.SOC, self.Cap, self.time] = self.capacity_array(cycles, total_cap)
  File "pp_dummy.py", line 243, in capacity_array
    comparing_cap = total_cap*0.9999*1e9*3.6
TypeError: can't multiply sequence by non-int of type 'float'
philipp007 commented 10 months ago

I pushed another fix

MakisH commented 10 months ago

The pp_dummy.py worked now, nice!