Convert PSS/E .raw file to Pandapower - psse

I'm trying to find a possible way to convert PSS/E native .raw files to Pandapower format.
My objective is to take advantage of the network plotting capabilities that are available in Pandapower.
For that, I have to first be able to load my grid data into Pandapower.
For that, I have to somehow bridge the gap between PSSE .raw to Pandapower.
Literature says that a possible way of doing this is by using the 'psse2mpc' function available in Matpower.
I've tried to use it but I get the following error message:
(quote)
>> psse2mpc('RED1523.raw')
Reading file 'RED1523.raw' ............................................. done.
Splitting into individual lines ...error: regexp: the input string is invalid UTF-8
error: called from
psse_read at line 60 column 9
psse2mpc at line 68 column 21
(unquote)
I'was informed that maybe I should save my .raw file (natively generated with a PSSE/E v33 version) into an older .raw format (corresponding to previous PSS/E versions).
I've tried this as well but still have the same error message.
Apart from getting this error which so far impedes to reach my objective, I've been unable to guess the Pandapower "equivalent .raw" structure. Does anybody know how this input structure looks like in Pandapower?
If I would know how Pandapower needs to get the input data, I could even try to code a taylor-made python script that converts my .raw file into whatever is required from Pandapower.
If somebody could help me to get out of this labyrinth I would be most gratefull !!!
Thanks.
Eneko.

You need to check your .raw file to enter the other Inputs of the psse2mpc function. For instance, if I have the case39.raw file and I want to convert it to matpower format like case39mpc.m, then I must enter something like this:
psse2mpc ('case39.raw', 'case39mpc.m', '1', '29')

Related

Matlab unable to format string to path

In original script there is part of code where is this
filepathsource='C:\Users\...';
strFP=dir([filepathsource '*.txt']);
Which works nicely.
Problem is that i need to change that filepathsource to some more dynamic so i did.
filepathsource=string(strcat(app.folderPath,'\',string(app.currentCount),'\'));
strFP=dir([filepathsource '*.txt']);
But i end with error
Error using dir
Name must be a text scalar.
And i need original formating because i get errors later in script. Is there any way how can i fix it? I tried everything but always is something somewhere wrong. And i just dont understand whats difference between original filepathsource and the one that i created bot are strings. (output of my filepathsource is correct when i display it)

For loop to open files in Python

I am relatively new to Python and need to run a python macro through Abaqus. I am opening files e.g "nonsym1, nonsym2, nonsym3". I'm trying to do this with a loop. The code opens nonsym1 (in abaqus) and performs some operations on it, then is supposed loop back and do the same to the other files. Here is the code I'm trying...
for i in range (1,10):
filename = 'nonsym(i)'
step = mdb.openStep(
'C:/Users/12345678/Documents/Inventor/Aortic Dissection/%s.stp' %filename,
scaleFromFile=OFF)
My main issue is coming from the fact that the %s in the directory I think?...
error message when trying to run this macro Don't know how to best approach this, so any help would be great thanks! Still learning!
Instead of using filename=nonsym1-2-3-..., name the step files as integers 1.stp,2.stp,3.stp and then convert integers to the string values with %str(i)...
And use the code below:
for i in range (1,10):
step = mdb.openStep(
'C:/Users/12345678/Documents/Inventor/Aortic Dissection/%s.stp' %str(i), scaleFromFile=OFF)
To obtain equal quantity of odb files, modify the Job code line as similiar as this code.

Matlab radar/spider plots

I need to make a radar plot, I googled it and got this: http://www.mathworks.co.uk/matlabcentral/fileexchange/33134-radar-plot/content/radarPlot.m
but it gives an error I'm not sure how to solve.
The error is Error: File: radarplottest.m Line: 17 Column: 1
Function definitions are not permitted in this context.
Any tips?
Did you copy the function and paste it into a script file you were working on?
If you did something like add your own code at the top of the file (say, to load data), that will give you the error you're seeing. You should have one file, "radarPlot.m", which contains this function, and then "radarplottest.m" could be something like a script containing data loading/pre-processing and then calling the radarPlot function on the appropriate data.
All you need in radarplottest.m is something like:
Data = % define some random test data or load some existing data
radarPlot(Data); % requires radarPlot.m to be on your path so Matlab can find it

Updating String in a matlab GUI

I am having quite a bit of trouble updating a string using a push button in my created matlab GUI. The goal would be to have this button preform a function on an image, whose string has been placed in a textbox on the GUI, then replace the old string with the new image's string
The main issue that I have run into is that I need the file to be in .raw format, but I am unable to figure out how I would accomplish that. I can replace the old string with a new string in .png format with the following code by adding it the guide GUI code.
handles.currentImage = imread(get(handles.Textbox1,'string'));
handles.currentImage = Addnoise(handles.currentImage); %addnoise is the function i created.
imwrite(handles.currentImage, 'photonoise', 'png');
pathname = 'C:\Documents and Settings\staff\My Documents\MATLAB\photonoise.png';
set(handles.Textbox1, 'string', fullfile(pathname));
But i am totally lost on how to make the string format a .raw. If there is some code I do not know about that i need to add to the GUI or to the Addnoise function, please let me know, I would greatly appreciate it.
Since .raw images are not supported by imwrite, you won't be able to use it. However, since .raw is a image format that isn't compressed this can be easily done using fwrite.
Here's an example using a 300 x 100 matrix of just zeroes (black):
cmodel=(zeros(300,100,1));
fid=fopen('blackimage.raw','w+');
cnt=fwrite(fid,cmodel,'uint8');
fclose(fid);
so in your case you'll need to modify this to the following:
fid=fopen('myimage.raw','w+');
cnt=fwrite(fid,handles.currentImage,'uint8');
fclose(fid);
Warning: my knowledge of the .raw format is pretty limited as well as imread so please take this with a grain (maybe even a cube) of salt

Cant enter raw_parser in postgreSQL?

I'm trying to analyze how postgreSQL parse a query, and after some postgreSQL source code tracing with embedding printf() here and there, I've known that the query will be parsed into raw parse tree with raw_parser, which located in file parser.c.
The strange thing is, I've already embedded a printf() dummy in the raw_parser, and after re-installing the postgreSQL and execute a query, my printf() dummy is not printed to the screen!
Can anybody please help me, where I went wrong?
Thanks in advance :D
if you use printf(stderr, "...."), then you can find result in server log. Don't forget - you are not work with server directly. For debugging purposes there are a elog function - it's like printf for client application:
elog(NOTICE, "some text");
a format string is same like printf's format - but you must to remember, PostgreSQL uses a different formats than glibc - so you can to show only integer or float variables. String variables uses different format than is C zero finished string.