이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hello to all,
I am developing a project and i would like your thoughts and your opinion about this...
I want to design a fuzzy logic controller with real inputs and real outputs. I would like to run the controller outside Matlab environment (probably an .exe file...?) and along with a Visual Basic application.
Should i use - Matlab compiler, - Matlab Builder NE or - Simulink coder (Real Time Workshop) ??
The controller's input will be inserted from a .txt file but the output will be sent in a serial port for communication with a pic micro-controller.
What do you think?
Thank you in advance,
Tassos
채택된 답변
Walter Roberson
2011년 10월 10일
It depends what you mean by "real time". I/O on MS Windows is synonymous with "unbounded latency".
Average latency on any particular MS Windows system might be tolerable for your purposes, but you cannot count on it.
You mentioned serial ports for communication with the PIC micro-controller. If you are planning to use a virtual USB serial port, then unless you write your own drivers, the lower bound on your latency is 40 ms, equivalent to 125 Hz. That applies no matter which OS.
댓글 수: 12
The maximum average latency for Windows XP cannot really be defined. Windows XP was supported on some pretty slow hardware... 120 ns DRAM, run from floppy... add virus scanners and Windows firewall.
I've seen the screen-saver kick in on an 2.4 GHz XP system while it was just processing a single keystroke typed in to an editor.
Average latency is something that really has to be measured for a specific configuration.
If 500 ms is affordable, then as long as you have a decent amount of memory and your system is not doing SETI@Home in the background, and your virus scanners are off while the program is running, you should be able to achieve that the great majority of the time.
However! If this system involves safety to a human or animal or endangered species, then you would probably not be able to get approval for it.
Safety-critical systems need a Real Time Operating System (RTOS), and have to be carefully designed. Even when a half-second response time is acceptable.
When your XP system goes BSOD because it detected a memory parity error (as it eventually will), what is going to happen to the system being controlled?
Tassos
2011년 10월 10일
I use 1GHz processor, 2GB Ram, an SSD, no internet connection, no antivirus.
The system will have continuous human observation so if BSOD happened, human takes control!
With that configuration I would suggest that MATLAB Coder would probably be better. MATLAB Compiler generates objects that need MCR (MATLAB Component Runtime), which is somewhere close to 900 MB. You will want that in memory and you want the program memory itself and you will want VB and associated libraries to be in memory, and you will want any writable OS files to normally be in memory. The total of these things is going to strain the 2GB of RAM that you have. You do NOT want to be swapping on to the SSD as you would "wear out" the SSD (SSD have limited write cycles.)
With MATLAB Coder, with relatively simple tasks, your memory occupancy should be much smaller.
Tassos
2011년 10월 11일
Thank you very much Walter!
I just realized that I have no information about whether something done in MATLAB Coder can control VB or vice versus. My suspicion would be that if it can happen it would not be via the COM interface.
Tassos
2011년 10월 12일
I just want to send data from VB application to be the input for the fuzzy controller.
I know i can call .m file from VB and pass data to it.
If I use Simulink coder to make C/C++ code will be possible to have this functionality??
By saying COM interface you mean serial port communication??
COM is the Microsoft Component Object Model, http://en.wikipedia.org/wiki/Component_Object_Model
I do not know whether that could be incorporated in to Simulink Coder code. My suspicion is that it cannot be. Possibly the solution is to use MATLAB Builder NE -- I do not know.
When you call a .m file from VB, it is either going through the COM interface or else making calls to the equivalent of MCR (MATLAB Component Runtime.) I do not know which. Kaustubha knows a lot more about these matters than I do.
Tassos
2011년 10월 12일
Ok, thank you very much for your time and for your answers.
I will try to communicate with Kaustubha.
The other way i had in mind is to make a DLL from the generated Simulink Coder's C code and call from VB application.
What do you think about this?
I think calling as a DLL is probably workable, but keep in mind that this work requires that there be a component monitoring the data transfer, and that component cannot sit around and wait for the next time that VB happens to make a call in to the DLL. So really you need at least 2 threads, one mainly dealing with the I/O.
If the VB is controlling, does that imply "live" controls, in the sense that the VB portion could change what was to be sent to the device? If so then you will also need some logic for data sharing between the threads. These sorts of things are common in real (or semi-real-) time programming, but problems in this area can be very difficult to track down even in well-written programs.
Tassos
2011년 10월 12일
I think i am a little confused from your answer....
If i have a timer tick event in VB and the vb application reads data every second from pic and in the same tick event call the DLL???
So there is no need for a monitoring component for the data...
Sorry if i am wrong, but i am trying to understand...
Timers in VB that deliberately invoke the DLL would be feasible only if the timer will reliably fire and execute and complete the DLL task within your maximum latency period (which you indicated earlier is 1/2 second.)
If you have the VB reading from the PIC, then I am confused about which part will be doing what? What computation would the the MATLAB DLL do that you would not just execute in straight VB ? And is the MATLAB component responsible for controlling the PIC or is the VB part? (You wouldn't want to be sharing a single serial port between the two; MATLAB doesn't like sharing files or devices.)
Tassos
2011년 10월 13일
Ok, i have a pic that communicates with the vb application via serial port. This work is already done. Its a data acquisition and data visualization application...
Now i want to develop a fuzzy logic cotroller that will control my system.
Fuzzy controller will use a different serial port to "speak" with a different pic controller. So, Matlab will be responsible for controlling the pic and there is no serial port sharing.
So, the vb part will read the data and the matlab part will do the control.
My problem is the interface between vb part and matlab part. I want to send two differnt data values(velocity, inclination) from vb part to matlab part. With these two values, fuzzy controller will make the control...
I dont know a way to develop a fuzzy logic controller in VB. Is there any?
I hope to made things more clear now...
추가 답변 (1개)
Tassos
2011년 10월 10일
Thank you for your answer Walter.
So until now we have 40 ms latency of virtual serial port adding the OS latency which is Windows XP.
What is the maximum average latency on Windows XP?
I think a latency of 500 ms is affordable. You think that something like that i want to do is a "waste of time"?
If no, which is the best Matlab product to develop the fuzzy controler?
카테고리
도움말 센터 및 File Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
