First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
1

Dynamic simulation .out to matlab

asked Jan 29 '13

Johannes.Thorleiksson gravatar image

Hey guys

I have been using excel to manage my .out files but I want to import the data into matlab now since the datasets are getting bigger and bigger.

Is there a function that would do this for me similar as dyntools exports to excel.

Best Regards Johannnes

Comments

There isn't a ready-made function. But you could write something that exports to CSV. Then import that to matlab. Does it take a long time to write to excel?

JervisW gravatar imageJervisW (Jan 29 '13)

Hey man, I am currently exporting all the out files and the channels I want to excel and then I should be able to open it in matlab but that is a alot of mouseclicks :)

Johannes.Thorleiksson gravatar imageJohannes.Thorleiksson (Jan 30 '13)

I actually noticed an interesting problem. When I run many dynamic simulations the size of the .out files seem to grow althoguh I change the name and reopen the channels so I can run limited amount of dynamic simulations.

Johannes.Thorleiksson gravatar imageJohannes.Thorleiksson (Jan 30 '13)

Yeah, sorry I wasn't much help on that one. My suggestion had more to do with writing directly to a flat CSV file and then in Matlab reading that CSV file in. This way you skip Excel entirely.

JervisW gravatar imageJervisW (Feb 1 '13)

2 answers

Sort by » oldest newest most voted
0

answered Mar 25 '13

Madje gravatar image

Hello,

I do you read the .out file in Excel? Mine is just a bunch of garbage.

Best Regards,

Madjê

link

Comments

Hey Madje Yes I use dyntools to export the .out files and the channels I want to excel. Best Regards Johannes

0

answered Jul 7 '17

AmirN gravatar image

updated Jul 12 '17

*Copying of all channels into matlab workspace (as possibility for matlab users)*

Download matlab function and example of using:

https://drive.google.com/drive/folder...

function [numberchannels,nameschannels,tomatlab]=pssout2matlab(inputfile)

nameschannels=[];

channelsdata=[];

numberchannels=[];

tekst=[];

if nargin==0

[filename]=uigetfile('*.out','PSSE .out files'); % select file from disk (without inputfile in function call)

fid=fopen(filename);

else

fid=fopen(inputfile');

end

setstr(fread(fid,4,'char')');

setstr(fread(fid,4,'char')');

setstr(fread(fid,4,'char')');

numberchannels=fread(fid,1,'float32');

fread(fid,1,'float32');

nameschannels=setstr(fread(fid,[32, numberchannels] ,'char'))';

nameschannels=strvcat(strcat('Time',blanks(28)),nameschannels);

tekst=setstr(fread(fid,[60, 2] ,'char'))';

channelsdata=fread(fid,Inf,'float32');

kolona=(size(channelsdata,1)-2)/(numberchannels+2);

rezultat=reshape(channelsdata(1:kolona*(numberchannels+2)),numberchannels+2,kolona)';

tomatlab=rezultat(:,2:size(rezultat,2));

fclose(fid);

numberchannels=numberchannels+1;

nameschannels=strcat(num2str([1:numberchannels]','%06.f'),'-',nameschannels);

end

link

Comments

Johannes.Thorleiksson, you have to delete all channels after one dynamic simulation, and then again set channels using python... then the sizes of out files doesn't grow during simulations

AmirN gravatar imageAmirN (Jul 7 '17)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

Stats

Asked: Jan 29 '13

Seen: 1,827 times

Last updated: Jul 12 '17