Plotting an Array in Simulink with the Simulation time on X-Axis

7 visualizaciones (últimos 30 días)
Abdelrahman Alamoudi
Abdelrahman Alamoudi el 28 de Dic. de 2018
Comentada: Viren Gupta el 7 de En. de 2019
Hello Guys,
I'd be really thankful if somebody would answer my question.
I am working on a project in my college where I need to build different subsystems simulating an electric car on Simulink. Subsystems such as "Wheel" , "Gearbox" , "Electric Engine" , "Battery" etc. and in the end I should be connecting them all together and start getting my values. The very first subsystem is called " Cycle " and In this subsystem I must use my given variable "V" which is the speed of the car. V is an array with 1800 rows and 1 column stating the speed of the car in KM/H for every second for 1800 seconds (30 Min Total). (It's all about the WLTP Car Test where a Car will be accelerated and deccelerated for 30 Min continious). My very first substem "Cycle" should plot a graph with this speed according to the simulation time ( What I understood I'll change the simulation time to 1800 Seconds and I need to get V drawn for every second up to 1800 seconds so the graph with be plotted) . My second Subsystem will be "Wheel". Wheel should be able to calculate my Wheel RPM and my Wheel Toque using the Speed graph (Speed array) from my first subsystem "Cycle". I have spent already 10 Hours playing around Matlab and Simulink to get an idea of how to start but I failed. Does anybody have a solution? I am really thankful.
Kind Regards

Respuestas (1)

Viren Gupta
Viren Gupta el 4 de En. de 2019
Hi,
For giving the input as an array (1800*1), you can directly set the Input parameter in Data imprt/Export parameter as [t,u]. Make sure you have t and u present in the workspace as 1800*1 vectors. t will be time based vector as [1;2;3....1800] and u will the speed vector. For graph, you can use the scope block. You other subsystems like Wheel should be able to use the same inputs.
  2 comentarios
Abdelrahman Alamoudi
Abdelrahman Alamoudi el 4 de En. de 2019
Hi,
Thanks a lot for your Answer but would you please explain this more in details? In my Workspace I have t as (1800*1) and v as (1800*1) vectors. Now I'll open Simulink and from the Toolbar I'll go to Simulation then to Model configuration parameters and then I guess under "Load from Workspace" is Input [t,u] I should be changing it to [cycle.t , cycle.v] because my t and v are under Cycle in my Workspace. Now in my Block window, which Block should I be connecting to Scope to get the graph? When I use the Input block how do I change the variables inside it to v and t ? How many plugs should the scope have? Thanks for your help.
Viren Gupta
Viren Gupta el 7 de En. de 2019
You can use the in1 block. This needs to be connected to the scope. Now yoy should be able to run the model and see the graph in scope block.

Iniciar sesión para comentar.

Categorías

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

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by