2016-04-20 09:30:24 -0500
| received badge | ● Notable Question
(source)
|
2016-04-20 09:30:24 -0500
| received badge | ● Famous Question
(source)
|
2016-04-20 09:30:24 -0500
| received badge | ● Popular Question
(source)
|
2014-08-03 20:30:57 -0500
| received badge | ● Necromancer
(source)
|
2014-08-03 20:30:10 -0500
| received badge | ● Self-Learner
(source)
|
2014-08-03 20:29:36 -0500
| received badge | ● Student
(source)
|
2014-08-03 20:28:23 -0500
| received badge | ● Necromancer
(source)
|
2014-08-03 20:26:26 -0500
| received badge | ● Necromancer
(source)
|
2014-08-03 20:26:26 -0500
| received badge | ● Teacher
(source)
|
2014-07-10 02:57:17 -0500
| answered a question | Model writing using Python There is a way to do this but it requires a bit of fortran knowledge. Use the system call in your fortran model: call system(command [,status])
status = system(command)
where command is the command you want to perform (python.exe your_code.py ) character status is the return status integer There are some considerations to take here: - All the communication between your python code and psse (variables, functions, ...) should be defined in fortran as input and output before and after the system call; and, conveniently, through files.
- The call system procedure will be called each integration step. Therefore, the simulation will run significantly slower.
It seems to be a rough and dirty way of developing models, but you have to think differently: this system calls can allow to communicate your models with other systems (even between multiple simulations, internet information, etc.), while performing a primary execution through fortran. I hope it helps. Open your mind. |
2014-07-10 02:29:14 -0500
| answered a question | What is the API for tripping and reconnecting loads Use gentrp procedure, in order to perform a trip. Fortran call gentrp(bus_mac,id_mac)
Use recn , in order to reconnect the bus. Fortran call recnapi(bus_mac, ierr)
Python ierr = psspy.recn(bus)
- Note the fortran function differs from the python one.
- In our team, we usually run simulations until the machines trip. So i didn't actually test this function.
Variables bus_mac is the number of the bus. integer id_mac is the id of the machine inside the bus. character ierr is the result status returned by the function. integer |
2014-07-08 03:47:02 -0500
| answered a question | How can I print to a file instead of standard output? Maybe you are looking for this solution: import sys
sys.stdout = open('output.txt','w')
print('Hello!')
This way, you only have to use print to write to the file. |
2014-07-07 07:42:42 -0500
| answered a question | PSS/E-FORTRAN_sharing variables between modules I think the proper way to do that is using macind to get the mc value of the machine, and then assign the values to the arrays wipcmd and wiqcmd . Using this method, you don't have to import any other model inside the controller one, and you can control multiple and configurable machines. Example: into the controller model call macind(bus_mac, id_mac, mc_mac, ierr)
wipcmd(mc_mac) = var(l)
wiqcmd(mc_mac) = var(l+1)
where: bus_mac is the bus number where the
inverter is (ibus if the controller
use the same machine). id_mac is
the id of the machine inside the bus. mc_mac is the position of the
machine in the arrays. |
2014-07-07 07:00:22 -0500
| answered a question | Avoid "call change_var" writting. After hours of debugging and testing. I figured out there is no better solution than the described in the question.
Also, I've noticed the time performance of using mdlind for getting the machine position in the arrays and change the var array instead of calling change_var is significantly better when developing machine models in fortran. Here, I write some examples, where: bus_mac is the bus number where the machine is. id_mac is the id of the machine inside the bus. l_mac is the position of the machine in the var array. n_val is the new value to set to the position, for example, l_mac+2 of the var array. Way 1 - Better performance: only fortran call mdlind(bus_mac, id_mac, 'GEN', 'VAR', l_mac, ierr)
var(l_mac+2) = n_val
Way 2 - Secure and API use: fortran call mdlind(bus_mac, id_mac, 'GEN', 'VAR', l_mac, ierr)
call change_var(l_mac+2, n_val, ierr)
Way 2 - Secure and API use: python ierr, l_val= psspy.mdlind(bus_mac, id_mac, 'GEN', 'VAR')
ierr = psspy.change_var(l_mac+2, n_val)
|
2014-07-04 05:17:10 -0500
| received badge | ● Editor
(source)
|
2014-07-04 05:15:18 -0500
| asked a question | Avoid "call change_var" writting. Every time I use call change_var function. PSS/E writes a message in the output (in my case, a file). I would like to keep the other messages, due it provides information while executing into PSS/E gui. A solution is to get the position from the machine using mdlind and changing the var array itself. But I would like to know whether there is a better solution using the API. |