0

I have developed a process to semi-automate the Simulink Load Flow Tool to allow the Load Flow to continuously be computed for different Load values. Each time the Load Flow is computed I require the data to be copied from the Powergui Load Flow Tool (Clipboard) to an array, at the moment I am doing this manually and cannot figure out a way to automate. To give reference to the data I require to copy from the clipboard I have attached the following image:Powergui Load Flow Tool, at this stage I only need to copy the data from the 2nd column.

Perhaps a more generic question is how to copy data from a Simulink Simulation GUI to an array in Matlab?

Any help would be greatly appreciated! Thanks

1 Answers1

0

You can use power_loadflow command to perform load flow and store results.

For example, if you run the simulation of Matlab in-built 5 bus system,

LF = power_loadflow('-v2','power_LFnetwork_5bus','solve')

LF is a structure where all results are stored, so you may save this variable in Matlab workspace. You can also store the results in Excel file as follows,

LF = power_loadflow('-v2','power_LFnetwork_5bus','solve','ExcelReport',fname)

Edit

To export to excel: load flow data is anyway stored in the variable LF. You can put the following command in your loop to copy the results to your excel file.

xlswrite('results_bus',cellstr(num2str([LF.bus.Vbus]')))

I used cellstrand num2str to save the complex results to excel. LF.bus.Vbus is the vector where bus voltage result is stored.

Hazem
  • 370
  • 1
  • 5
  • 14
  • Thanks for you response. I cannot use LF = power_loadflow('-v2','power_LFnetwork_5bus','solve','ExcelReport',fname) as this capability is available only for the positive-sequence load flow, which my model does not use. I am currently using power_loadflow('-v2','LVnetworkModel '), in a loop, it allows the Load Flow Tool to initialise for each different load but then I have to manually copy it over to excel. If I use: LF = power_loadflow('-v2',sys,'solve','report'), i can store the results in a 'REP File' but the format is not of much use to me as I only require the voltages at each bus. – j dahman Apr 09 '18 at 23:18
  • I am thinking I may be able to use LF = power_loadflow('-v2',sys,'solve','report'), and loop through the file taking out the particular rows/columns I require from the report, but I am not sure how to do this nor is there much information on 'REP files'. – j dahman Apr 09 '18 at 23:25