Reference to unknown symbol 'Init' under state Charge in 'Standby' error in stateflow is coming even though it is defined correctly and there is no typing error.

3 views (last 30 days)
I am trying to make model of BMS in simulink. In State Machine of BMS following error is showing in one of the state,"Reference to unknown symbol 'Init' under state Charge in 'Standby' ". But syntax is correct and also there is no typing error. I tried to make a new identicle state to replace the old one, the error just moved to next state and after correcting from second state it returned to previous state. I am attaching copy of stateflow diagram and all other connected files. Please help regarding this error.

Answers (1)

Yash
Yash on 30 Aug 2023
Hi Vedant,
I have found two errors in your files.
1. Error:Invalid setting in 'Chart' for parameter 'maxCellV': This is because the variable 'maxCellV' is not defined in the 'data.mat' file. You can resolve this by defining 'maxCellV' in the base workspace.
2. Error: Reference to unknown symbol 'Init' under state Charge in 'Standby1': This error has occurred because you have not defined and assigned the 'Init' variable properly. Follow these steps to resolve it:
  • Replace "ChargeState=Charge.Init" with "ChargeState=Init" in the 'Standby1' state
  • In the Symbols Pane, right click the "ChargeState" variable and then click inspect. In the Type field, select "Enum: <class name>". Replace <class name> with "Charge".
  • Delete 'Init' variable from the symbols pane if it gets created automatically.
For more information, visit this page: Assign Enumerated Values in a Chart

Categories

Find more on Complex Logic in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!