Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mleot committed Apr 8, 2024
1 parent 27ff07f commit 3974872
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 7 additions & 2 deletions ecm/__liionsolve__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def run_simulation_lp(parameter_values, experiment, initial_soc, project, **kwar
kwargs.setdefault('disable', True)
kwargs.setdefault('max_workers', 1)
kwargs.setdefault('timeit',False)
kwargs.setdefault('model','SPMe')
###########################################################################
# Simulation information #
###########################################################################
Expand Down Expand Up @@ -144,11 +145,15 @@ def run_simulation_lp(parameter_values, experiment, initial_soc, project, **kwar
],
period="1 second",
)
if kwargs['model'] == 'SPMe':
sim_func = lp.thermal_external
elif kwargs['model'] == 'DFN':
sim_func = lp.thermal_external_DFN
# Solve the pack
manager = lp.CasadiManager()
manager.solve(
netlist=netlist,
sim_func=lp.thermal_external,
sim_func=sim_func,
parameter_values=parameter_values,
experiment=experiment_init,
output_variables=output_variables,
Expand Down Expand Up @@ -230,7 +235,7 @@ def run_simulation_lp(parameter_values, experiment, initial_soc, project, **kwar
manager = lp.CasadiManager()
manager.solve(
netlist=netlist,
sim_func=lp.thermal_external,
sim_func=sim_func,
parameter_values=parameter_values,
experiment=experiment,
output_variables=output_variables,
Expand Down
4 changes: 3 additions & 1 deletion ecm/__postprocess__.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def stacked_variables(data, case, amp, var_list=[0, 1, 2, 3], ax=None, subi=0):
return ax


def plot_resistors(net, throats, color, ax):
def plot_resistors(net, throats, color, ax,resistors=True):
conns = net["throat.conns"][throats]
coords = net["pore.coords"]
v = coords[conns[:, 1]] - coords[conns[:, 0]]
Expand All @@ -477,6 +477,8 @@ def plot_resistors(net, throats, color, ax):
zigzag = np.array(
[0, 0, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 0, 0, 0, 0, 0, 0]
)
if not resistors:
zigzag = zigzag / 100
segs = len(zigzag)
p_start = coords[conns[:, 0]]
x_all = [p_start[:, 0]]
Expand Down
6 changes: 3 additions & 3 deletions ecm/__topology__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pandas as pd


def plot_topology(net, ax=None):
def plot_topology(net, ax=None, resistors=True):
# inner = net["pore.inner"]
# outer = net["pore.outer"]
c1 = np.array([[75 / 255, 139 / 255, 190 / 255, 1]]) # Cyan-Blue Azure
Expand All @@ -23,8 +23,8 @@ def plot_topology(net, ax=None):
c3 = np.array([[100 / 255, 100 / 255, 100 / 255, 1]]) # Granite Gray
if ax is None:
fig, ax = plt.subplots(1, 1, figsize=(10, 10))
ax = ecm.plot_resistors(net, throats=net.throats("throat.neg_cc"), color=c1, ax=ax)
ax = ecm.plot_resistors(net, throats=net.throats("throat.pos_cc"), color=c2, ax=ax)
ax = ecm.plot_resistors(net, throats=net.throats("throat.neg_cc"), color=c1, ax=ax,resistors=resistors)
ax = ecm.plot_resistors(net, throats=net.throats("throat.pos_cc"), color=c2, ax=ax,resistors=resistors)
ax = pcoord(net, pores=net.pores("neg_cc"), color=c1, s=25, ax=ax)
ax = pcoord(net, pores=net.pores("pos_cc"), color=c2, s=25, ax=ax)
ax = pcoord(net, pores=net["pore.neg_tab"], color=c1, s=75, ax=ax)
Expand Down

0 comments on commit 3974872

Please sign in to comment.