How can I generate a grid schematic in MATLAB?

Hi guys, I am currently working on a GUI to model the effects of low temperature on a PV array. The GUI (as made from the GUIDE) as of now takes in user inputs from text boxes in order to change some of the parameters of the PV modules (such as short circuit current and ideality factor).
However, the GUI ideally should be able to output a grid of cells whose dimensions correspond to however many cells are wired in series and in parallel. The user would then click on individual cells and be able to change the individual characteristics of each cell and view its IV curve.
How can you generate a grid of images that can change according to user input? For example if the user states that there are 2 rows of 5 cells wired in series connected to each other in parallel, the GUI will display a 2x5 array of cells. I have the actual equations written for manipulating the IV curves already written but I don't know how to generate this grid of cells.
Thanks in advance!

2 件のコメント

Sara
Sara 2014 年 7 月 29 日
What do you need to plot the cells for? Are they editable or is that just an image? Do you want to show connections among them too? can you attach an image of what you want (done in power point, or paint, or by hand and scanned,..., nothing fancy needed)?
Roel
Roel 2014 年 7 月 29 日
編集済み: Roel 2014 年 7 月 29 日
Something like this, it should just be an image (not editable), but the actual array should change. For example, I have attached a 3x5 array. I would want this to also generate a 4x5 and any n x m array.
Each of the individual cells can be selected by the user and have its individual IV curve and parameters shown/edited.

サインインしてコメントする。

 採用された回答

Sara
Sara 2014 年 7 月 29 日

2 投票

Take a look at the code. nrow and ncol will be your adjustable inputs. Now the code wait for the user to click on the image (ginput); you can change that behavior by checking the mouse click. It really depends on what you want to do.

15 件のコメント

Roel
Roel 2014 年 7 月 30 日
This is great! I figured out the handle for nrow and ncol. I have one last question though. How can I manipulate ginput so that it can change values in an array in that index. In the GUI I have written, I model solar cells in series and parallel by replicating and summing the vectors for Voltage and Current to approximate Ohm's law.
So say the user clicks the 3rd cell in row 1, how can I use ginput to change that corresponding entry in the voltage and current arrays? In this example, I would want to change the values for the 3rd entry in the voltage array.
Anyway, Thanks so much
Sara
Sara 2014 年 7 月 30 日
I don't understand what you are trying to do. The counter in the while loop will give you the element. You can convert that to row and col index as:
row = ceil(cont / ncol);
col = cont-(row-1)*ncol; %check to make sure I got it right :)
This is counting from the bottom left of the pic. But with a similar logic you can count from top left if you prefer. So now that you have the element chosen by the user, I don't understand what you want to do.
Roel
Roel 2014 年 7 月 30 日
I have attached the .m file of what I currently have for manipulating the IV curves. Sorry for being vague. So in lines 71 and 90 I replicate the matrix for current and voltage respectively in order to model how the IV curves change according to how many cells are in series and in parallel.
I would like to be able to do the following: So initially I replicate the IV characteristics of an ideal solar cell according to how many cells (in series and parallel) are in the array. The user can then select one cell in the array, and then change its characteristics (ideality factor, Series Resistance, short circuit current, etc.). For example say we have 3 identical cells wired in series with Series Resistance of [0 0 0] (vector input for the 3 junctions of the solar cell model I'm using) ohms each. I would like to plot the IV curve of this array under these conditions. Then I would want to change the 2nd cell to have a series resistance of [0 0.2 0] and plot the IV curve of the array under those conditions. How would I do this
Sara
Sara 2014 年 7 月 30 日
There's no file.
Roel
Roel 2014 年 7 月 30 日
sorry, fixed that.
Sara
Sara 2014 年 7 月 30 日
Can you attach the whole script + the GUI (fig file)? Here's my questions:
- when the user select a cell, will he be shown some edit boxes where he can change the params, e.g., ideality factor?
- if yes to the previous, after the user changes params, do you have a pushbutton to signal it's time to plot the IV curve?
Roel
Roel 2014 年 7 月 30 日
Question 1) As of now the GUI has the user is shown some edit box the changes the params for ALL the cells in the array. I would want the user to be able to change the params for single cells/strings of cells. Question 2) Yes the IV curve refreshes upon clicking the plot button.
Sara
Sara 2014 年 7 月 30 日
As a fast solution, couldn't you add a listbox where you choose which cell to modify instead of accepting arrays in input?
Roel
Roel 2014 年 7 月 30 日
How would I be able to implement that? I thought listboxes were mainly for different cases. I don't know how it would behave in larger arrays (1000+ cells)
Sara
Sara 2014 年 7 月 30 日
You could have two, indicating row and col, and populate them depending on the user inputs. It's better than having to input 1000+ arrays by hand IMO. You could still select the box from the image with ginput as a plus.
Roel
Roel 2014 年 7 月 30 日
I see. Well I don't plan to have the user input 1000+ arrays by hand, I am sorry if that's what it seemed like. I would want the program to first model an array of identical cells by default. The user would then choose 1 cell, change its params, and then the IV curve of the whole array would update upon clicking plot
Sara
Sara 2014 年 7 月 30 日
So are you planning on using the edit boxes for one component at a time, i.e. the component chosen from the schematic of the circuit?
Roel
Roel 2014 年 7 月 30 日
Yes! Either one component or one string of components in series. Not only chosen from the schematic but also if the user chooses a value. Like cell(1,2) would be cell in row 1 col 2. Which I guess would be the same for clicking it.
Sara
Sara 2014 年 7 月 30 日
Ok, it took me a while but I finally understood. So, where do you load a default size of the array + default values that the user can change in your code?
Roel
Roel 2014 年 7 月 30 日
As of now they don't have default values, the user would input the values according to the type of solar cell they are working with. But soon I will set it to the default values of the type of cells we use in our lab, which is:
Series res: [0 0 0] Shunt res: [10000 10000 10000] Short circuit current: [1.8 1.9 3] Open circuit voltage: [1.4 1 0.3] Ideality factor: [3 3 3]

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2014 年 7 月 29 日

コメント済み:

2014 年 7 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by