Borrar filtros
Borrar filtros

battery twin in simulink

4 visualizaciones (últimos 30 días)
Nalla Muthu
Nalla Muthu el 9 de Mzo. de 2023
Respondida: Harsh Sanghai el 9 de Mzo. de 2023
I am trying to do battery twin model for Lithuim ion battery in simulink. In simulation I required to give discharge current from hardware device (arduino). But I am getting error as Data type mismatch. 'Input Port 1' of 'Batteryhardwaresimulation/powergui/EquivalentModel1/Sources/u' expects a signal of data type 'double'. However, it is driven by a signal of data type 'uint16'.
Let me know how to clear error

Respuestas (1)

Harsh Sanghai
Harsh Sanghai el 9 de Mzo. de 2023
Hi,
The error message indicates that the data type of the signal coming from your Arduino is uint16, but the input port of the simulation expects a double data type. To resolve this error, you need to convert the uint16 data type to double data type before sending it to the input port.
You can use the "Data Type Conversion" block in Simulink to convert the data type of the signal.
  1. Drag and drop the "Data Type Conversion" block from the Simulink Library Browser to your Simulink model.
  2. Connect the output of your Arduino block to the input of the "Data Type Conversion" block.
  3. In the "Data Type Conversion" block parameters, set the output data type to double.
  4. Connect the output of the "Data Type Conversion" block to the input port of the simulation block.
After completing these steps, the error should be resolved and your simulation should run without any issues.

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by