Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Issue with the built-in functions (such as if(), floor() ) in COMSOL
Posted Nov 22, 2023, 7:30 a.m. EST Battery Design Version 6.1 2 Replies
Please login with a confirmed email address before reporting spam
I am facing an issue while running the Charge-Discharge Cycling simulation in Lithium-Ion Battery Interface. For the context, there are some variables (cycle_no, t_factor, corr_factor1_) defined in the "Definitions" node under the "comp1" node with the expression mentioned as follows. Also, a required interpolation function ("t_factor_int") is defined earlier in the global definitions.
t_factor = t_factor_int(comp1.liion.cdc1.cycle_counter)
corr_factor1_ = if(t_factor==1,1,0)
cycle_no = if(comp1.liion.cdc1.cycle_counter<3,comp1.liion.cdc1.cycle_countert_factor,(comp1.liion.cdc1.cycle_counter-floor(comp1.liion.cdc1.cycle_counter/3))250+corr_factor1_)
For the current battery cycling study, I need to supply charge and discharge current as a function of cycle number in the Charge-Discharge Cycling boundary condition, which are defined as:
Discharge Current = if((cycle_no==0)+(mod(cycle_no,10)==1),-i_1C/3,-i_1C); Charge Current = i_1C
(i_1C is the 1C current value defined earlier in the global definitions)
After running the simulations for some cycles, the following issues arise.
Issue with the if() function: The if() function in the "corr_factor1_" variables is not updated as expected i.e., does not give value as 1 if "t_factor" is 1.
Issue with the floor() function: The floor() function too does not work as expected. For example, while calculating "floor(liion.cdc1.cycle_counter/3)", the output obtained for floor(39/3) is 12 instead of 13.
The aforementioned issues continue for further cycles although they weren't observed during the earlier cycles of the same run.