What is the idea behind data processing for SCI communication in DC/DC Buck Converter Example?

19 次查看(过去 30 天)
Dear Antonin, firstly thank you a lot for your model Digital DC/DC Buck Converter Voltage Mode Control (VMC) https://goo.gl/VkdvuD I learnt myself a lot from that model. But there is still one more thing I don't understand. In your model, for target f28377S_DCDC_Buck.slx in subsystem "PI_controller_ISR there is a subsystem Serial Send. Inside that subsystem, I was able to understand everything except: merge blocks and following While Iterator Subsystem. Could you please provide me with the idea, what is happening inside of these blocks? What is the idea in general? You did some data processing, but I don't really understand why. From your video regarding this model, I understand that Simulink is good at handling of big data blocks at low sampling time, whereas target processor is good at handling of small data blocks at high sampling time. But I don't know how to do that. Thanks in advance for your answer. Karol

采纳的回答

Antonin
Antonin 2018-9-17
Hi Karol,
Here is what is happening in the Serial Send subsystem:
  • The goal is to send data to the host at a fast rate and insert delimiters around a large sequence so the host reads a large chunk of data at a slow rate instead of small pieces of data at a fast rate.
  • On the host side, it's impossible for Simulink to read 2 Uint16 data points at 200kHz, but Simulink can easily read 12,000 x 2 Uint16 data points every 60ms (~17Hz). The turnaround time makes it easy for Simulink in the second case, though it's the same amount of data.
  • On the target model (DCDC_Buck.slx), the purpose of the Serial_Send subsystem is to send data at a fast rate (2 Uint16 data points at 200kHz) and insert delimiters every 12,000 hits.
  • To do so, I use a counter that counts from 0 to 11,999. When the counter equals 0, I insert the end of the previous sequence ('EE') and the beginning of the next sequence ('SS'). 'EE' (0x4545 in ASCII) and 'SS' (0x5353 in ASCII) are arbitrary delimiters. Just make sure they match what you use on the host, you can use whatever you want, I picked S for Start and E for End, and I used 2 characters for each to match the Uint16 format of the delimiters.
  • When the counter equals 0 I need to send 4 Uint16 data points. The 2 delimiters + the 2 signal data points.
  • When the counter is different than 0, I need to send only the 2 signal data points.
  • The counter feeds an "if" condition for the 2 above cases. The merge blocks are used to combine the outputs of the 2 conditions into one. The merge block will pick the output of the subsystem that is active at that time step.
  • I can only use one Serial send block, and in the start case I need to send 4 Uint16 data points while I need to send 2 in the other cases. To do that I use a "While Iterator Subsystem". It's the equivalent of a "while" loop in C. I will loop 4 times in the Start case to send 4 Uint16 data points and twice in other cases to send signal data.
  • The Serial_Send subsystem is scalable to different widths. Pay attention to the baudrate if changing the width of the signal. Serial communication usually sends 10 bits per data byte (1 start bit and 1 stop bit + 8 bits of data). At 200kHz, 2 uint16 data points mean 2x2x10x200000 = 8Mbps needed, neglecting the delimiters. The baudrate on the target is set to 12.5Mbps which should accommodate for 8Mbps. Increasing to 3 uint16 signals should still work as it will push the baudrate to a little more than 12Mbps, but that is very close to the limit. 4 signals will be too many and will not work at it would require 16+Mbps.
I hope it helps,
Antonin
  3 个评论
Antonin
Antonin 2018-9-17
In this particular host Simulink model, we need to read serial data which is coming from the OS (MS Windows). Making the request to read from the COM port takes time. It's much better to ask for a large buffer at a slower pace compared to asking for small pieces very often.
It's hard to be able to give accurate timings as it depends on your computer's performance as well as how busy the OS is at that time. Overall, while using serial blocks on the host it's best to keep the turnaround time above 30ms. Simulink can go much faster if there is no host serial block in the simulation.
I hope it helps,
Thanks,
Antonin.
Karol Kyslan
Karol Kyslan 2018-9-17
Definitively helped. Now I understand limitations of Host PC that I will be able to overcame by using of buffering (and/or) that fast algorithm you have provided.
I have one more question anyway.
By using Host PC and and HOST blocks (SCI receive, SCI Transmit, SCI Setup) in NORMAL mode, I am able to configure it and reach the communication limits when it comes to baud rate and number of received variables. Everything works as expected. Though slowly, but enough. But I don't understand the behavior of Scope block.
What I want to do is to display data coming from SCI receive. In target (f28069) I created sinusoidal waveform (sine wave, sample based, 10 Hz) changing its output every 0.001s. I am sending it to Host PC every 0.001s, where I receive it with SCI receive at 0.1s. To display it, I want to use Scope block (with default setting). Here comes the question: If I set Simulation stop time to "inf", what does it precisely mean the time displayed at the bottom of Simulink window (T= xxx). This time is faster than real time but what does it represents and how it is connected to the algorithm running in my target?

请先登录,再进行评论。

更多回答(3 个)

Karol Kyslan
Karol Kyslan 2018-12-9
Dear Antonin.
it took me a time, but I have implemented it and it works like a charm! I modified it to slower sampling rate (~10 kHz), but the principle remained the same. I find very useful is that by using this principle, there is no need to use external mode and you have a total control to each algorithm step. Many thanks for support!
Karol

Burak Caykenari
Burak Caykenari 2020-7-15
Hi Antonin and Karol ,
I understood almost all the information you provided except 'When the counter is different than 0, I need to send only the 2 signal data points.' . I watched the related video but I did not understood this sentence. Counter counts up to 12.000 . Then it reaches this point data will be sent. Therefore 4 times loop are implemented. (2 datas , 2 delimiters(SS,EE))
Other conditions there are no any header (SS) and terminator (EE) informations ,instead this you sent 00's . For this reason the iteration loop number is 2(2 data values). For this reason host will not understand the information(because there are no any terminator ,header characters ) and data will not be received by the host. Isn't it ?
If it's true , why you sent 2 datas in this case ? Because data will not be received by the host since there is no header and terminator informations ? Can you explain why do 2 data informations sent in this situation ? Does it make sense ?
Thank you so much .
Burak
  3 个评论
Moinul Shahidul Haque
Hi Antonin,
I have learnt a lot studying your buck model. I have a couple of question.
  1. in the C2000_Host_read_12M, voltage demand is multiplied by 16383/6.0909; P gain and I gain are multiplied by 16383. I would greatly appreciatre if you could explain why multiplication is done.
  2. I want read the error and voltage reference using simulink while the F28379D is running. I have convert all the data type as int16. I can read the error and adc values but cannot read the voltage reference. I am wondering if this is possible? If yes, I would appreciate if you could help me with that
R.Y.SH
R.Y.SH 2021-5-20
hi, have you got answer for your first question (in the C2000_Host_read_12M, voltage demand is multiplied by 16383/6.0909; P gain and I gain are multiplied by 16383. I would greatly appreciatre if you could explain why multiplication is done. )

请先登录,再进行评论。


Hassan Abouobaida
Hassan Abouobaida 2020-8-24
Hi Antonin,
Thank you very much Mr Antonin for your relevant explanations about the sampling and the sending of data via the COM PORT, it is very interesting what you have just explained. But I have a few questions that I can't understand
- The Launchpad F28379D is connected to analog input ADCIN_A4 which contains the real signal (traingular) which represents the current signal passing through the inductor so you preferred to transmit the average or filtered current available at the analog input ADCIN_C5 !!
- the signal received by the exposed method (sending of data packet 12000 x 2) allowed to transmit the signal but the received shape is distorted, the signal has lost its triangular shape,
- the time displayed does not correspond to the real time on the Scope !!
- Why the real time is not used for the "real time" operation and the data LOGGING on the scope directly without going through the COM port !!
Thank you very much for your contribution in this discussion.

社区

更多回答在  Power Electronics Control

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by