필터 지우기
필터 지우기

Problems with Working with A GUI to Simulink and back in realtime

조회 수: 9 (최근 30일)
Paul
Paul 2012년 3월 8일
Hi Guys I have been working on using a simulink model to control a toy helicopters flight in realtime. Anyway the model is fine and works by a simple matlab script but my aim is to use a GUI to control it.
The Model works by comparing inputs of X,Y,Z and YAW of the aircraft and comparing it with The current values then reducing the error till there is none so putting the aircraft in the position it needs to be . Originally I used a matlab script to assign waypoints due to time in the simulation.
I Have built a GUI so data can be imputed into it but I am having problems sending that into simulink and then a read out of the aircraft's position to be pulled from it real time.
The data I'm inputting is a set of waypoints and are not time dependent. So my aim is to have the controller get the helicopter to this point and then switch to another waypoint which i think is going to be tricky.
Back to the main problem
1. How do I update blocks in simulink in real time - I have been looking into the set_para function which looks promising but im no entirely sure how to pull this wapoint information into my simulink. I have been trying to use gains with constants of one.
2. How could i make a real time plot of the aircraft in my GUI on an axes. I have tried to use a listening block on the function to pull each variable out but im not entirely sure how to do this or to make it into ad 2d plot or 3d plot as they are seperate signals.
Hope that makes sense

채택된 답변

TAB
TAB 2012년 3월 12일
(1) To update the model during simulation, you can call
set_param('YourModel','SimulationCommand','update')
from your GUI.
Here you can find a good example of GUI<-->Simulink communication during run time.
(2) To find a good example of plotting simulink data during runtime using listener, type
>>sldemo_msfcn_lms
on your command window.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multicore Processor Targets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by