Error evaluating 'InitFcn' callback of Battery block (mask):

6 visualizaciones (últimos 30 días)
Tommy
Tommy el 7 de Abr. de 2025
Respondida: Aabha el 6 de Mayo de 2025
Hi,
While I triedto use battery from Simulink library an error pop ups:
Error evaluating 'InitFcn' callback of Battery block (mask) 'MMC_20SM_CAP_MOSFET/CELL 1/Battery'.
Callback string is 'BatteryCback(gcb,1)'
Caused by: Invalid setting in masked block 'MMC_20SM_CAP_MOSFET/CELL 1/Battery' for parameter 'MaskEnables'
Can any one assist to undrstand/solved this problem?
Thanks,
Tommy

Respuestas (1)

Aabha
Aabha el 6 de Mayo de 2025
Hi @Tommy,
The error message you are encountering indicates an issue with the initialization function (InitFcn) of a masked block in the Simulink model. This error is related to the Battery block within the model, which is located inside the ‘CELL 1’ subsystem. The error seems to be with how the mask parameters are set or managed. You can try the following steps to troubleshoot and resolve the issue:
  1. Open the block mask editor for the Battery block by right-clicking on the mask and selecting Mask > Edit Mask. Then, navigate to the Initialization tab and examine the BatteryCback(gcb, 1) function. Please note, that ‘gcb’ returns the path of the current, or most recently clicked block. In order to get the correct path for the block, make sure that you have selected the desired block. Alternatively, you can give the path to the block directly, to avoid any issues during execution. Ensure that this callback function is correctly defined and that all variables and parameters it references are available and correctly initialized.
  2. Ensure that the MaskEnables property of the mask is correctly set. This property controls which parameters are enabled or disabled based on other parameter values. The value of this property needs to be a cell array of character vectors, each either 'on' or off'. You can access or modify this property by using the ‘get_param and set_param’ functionsin MATLAB. Please refer to the following documentation link for more information about ‘Mask Parameters’: https://www.mathworks.com/help/releases/r2024b/simulink/slref/mask-parameters.html
Please refer to the following documentation link for more information about the ‘get_param’ and ‘set_param’ functions:
I hope this helps.

Categorías

Más información sobre Subsystems en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by