This question is closed. Reopen it to edit or answer.
How to solve a data type issue in Simulink when using workspace struct variables in a Buscreator?
1 view (last 30 days)
Show older comments
Amanda Brito on 7 Nov 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi, I'm using Simulink to model a thermal system to calculate the temperature of an electrical motor at certain time considering its losses, its initial temperature and the ambient temperature according to the equation dT/dt = Pv/Cth - T/Rth*Cth . (where T is the difference of temperature, Pv is the losses, and Rth and Cth are the thermal- resistance and capacitance). As I’m using experimental values as inputs to calculate the losses, as well as input of the initial temperature added to the integral block at the end of the model (to have the temperature of the motor at the time) I have struct workspaces variables with the these experimental values that will be used by "from workspace blocks". Each necessary parameter for calculations is written inside a subsystem block (eg. I have one subsystem for Losses Calculation, other for the thermal impedance etc.) and to propagate the signals among the subsystems I've created "Bus" using "Bus Creator". When trying to run the model I have the error "Invalid output port data type." in the "Bus Selector" output. The problematic variable is double type but when I try to propagate it to a "discrete Time Integrator" it turns single alone. I've checked my output data types of the blocks and they don't have any changes (Auto Inherit). If I substitute the "GoTo" block for a Outport, for example, the variable stays as double. I don't know how can I solve this issue. It would be nice if someone have some idea about it!
I've attached some images about the problem.
Arunkumar M on 9 Nov 2018
Try changing properties of Discrete Time Integrator block as follows: Signal Attributes tab -> Data type -> Inherit: Inherit via back propagation
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!