Reading a value from ADC buffer and creating graph on that with ePWM - adc

I am new to CCS and C general. I have a problem to ask hope you can help me;
enter image description here
I want to add another ePWM (the third one) to the above project. The first ePWM already generates a 2kHz 25% duty cycle symmetric PWM waveform and the second ePWM triggers the ADC so we can read the values from ADC. When I add the third ePWM it should cycle the duty cycle (0-100%). What I want to do is read ePWM3 from AdcBuf and create a graph with that.
To do that, I set configurations on DefaultISR, ePWM, and ADC. However, it did not recognize the epwm3_info on update_compare in Default ISR. The error says it did not define but when I search it with CTRL it goes where I defined it. I did not understand why it gives the error. Can you help me?
Here is my code:
https://drive.google.com/drive/folders/1W12mHtPN2Mozj8K1pLLG2wNEUqT7QtBd

Related

Zero output force after one cycle

I'm making a dynamical system model in Simulink. It is a drop test on 2 springs. I want that after first drop the object will stop, so that in the accelaration graph there will be only 1 maximum. Am asking for a detailed answer. Thanks in advance.
The system to model
Current acceleration Graph
Simulink model
I know the time of the first cycSimulink modelle, but I calculate it only in the end of the run. I understand that I can use Matlab function in Simulink, and maybe a Subsystem.
when_shock=(acc.Time(two_times(2))+acc.Time(two_times(1)))/2;
I need the accelatarion graph to have only one peak. Meaning only one drop accures, after which the object stops. The force where the arrow shoud be zero after force drop.

export to workspace problems using rtwin.tlc

I'm using Sensoray 626 card with simulink real time (rtwin), the problem is that when I try to plot some graph using scope block in real time no more than 800 points are plotted. In other words, it seems that the scope updates the graph by deleting the old points and starting new frame from zero again and again.
I tried to export data to be plotted from simulink to workspace in order to plot it after the real-time simulation is finished but, unfortunately, the same problem occurred. I have got no more than 800 points in workspace (in some attempts I've got less than 200).
The weird thing is that such problem doesn't occur with the same matlab version and with the same pc but using das 1002 card instead. both The scope and save-to-workspace blocks work well.
I'm using matlab 2009 on Windows Xp.
I would have used das 1002 card but it doesn't contain any encoder.
PS: solver configuration was properly set , necessary libraries were loaded.
Any help that can solve this problem would be appreciated.
thanks in advance.
solver configuration
solver
scope properties
simple simulink example
The Scope is only able to display an amount of samples equal to external
mode buffer length. So please go to Tools->External Mode Control
Panel->Signal & Triggering and check the Duration parameter there. I'd
bet it is 1000, so 1000 samples at 0.001 s sampling rate gives the 1
second of data you get. If you want more, try to increase this number.

How to Calculate 3 Phase Voltage & Current from Power (VA)?

I am trying to develop a MATLAB Simulink model that will help me study the load of my department.
The model works, however one of the blocks goes right over my head when it comes to understanding, as I used the internet to help me with it.
Here is the main block:
The Scope Displays the Voltage, Current & Power
The "dept01" block inputs the data from .csv file and contains only [Time,Power].
Here is what goes inside of the "Electrical Department" Block:
I have no problem understanding this part, I'm simply splitting the total power into three portions.
NOTE: I am also assuming that ultimately Q=0 so Total Power = Real Power
This is the Second Step of the "Electrical Department" block which I cannot understand in any way. Maybe my concepts are weak but this part makes no sense to me.
Can someone please explain it to me that how is the block calculating Voltage & Current using just the Power??? Also how does it imitate the function of a Load so that the Energy Meter sees it as a load?
Thanks!
Load can be emulated by connecting a current source in series with the voltage source as it is seen the diagram. In your case, the controlled current source has been used. It also looks like the dependent current source is derived from the voltage. I request you to give the details of relational operator used and the sigma block. Without which you can not derive the relation ship. If the current is dependent on the voltage like the case, voltage and current can be calculated simply from the power.

Which input block is used in Matlab simulink that provide random values with time?

I am a new user of Matlab Simulink and currently i am working with Fuzzy Logic Controller with Simulation. In the Simulink, i want to input the values(i highlighted in the picture below), that changes with time.
Here, i am using Uniform Random Number Block which sends four values(which i feed) at same time but i want one value must input first, then another and so on. My target is to use Scope block(the one which is highlighted in the right side) and check the output that varies with time. But with current configuration, i just input ONLY one value. Please help?

import a continuous bitsream from workspace into simulink using "In" block and then buffer it using "buffer" block

how to import a bitsream form binary vector from workspace into simulink.Actually I have found that I can use simin block or In block but my binary vector is independant of time. I tried to use Const block and it works but afer that when I wanted to put my output in the Buffer block in simulink, it didn't work because the input is continuous and not discrete. So I am asking if it's a way to add time to my binary uni-dimensional without having any influence on the result?and how can I do it?
Or is there another way to import this date to avoid this problem with Buffer block?
Your screenshot shows your constant block to have a sample time of Inf. As the error message suggest, you need to change that to a discrete sample time. In addition, you should also:
check your model is using a fixed-step solver
check what time step you are using for your chosen fixed-step solver (ideally the same as your constant).
You can have multi-rate models, but you need to manage the rate transitions with Rate Transition blocks. For more details on sample times, see the documentation, in particular how to view sample time information in a Simulink model. You should probably also have a quick look at the Choose a Solver section.