Menu

Export Results

Help
2016-11-08
2016-11-18
  • João Paulo da Silva Bernardes

    Hi Mr. Davis, is me again. I have a question, I need to export voltage results of the simulation to complement my work, but I need to get for each hour the number of the tap that operates when I have this variation of voltage. Can you give some thoughts about it?

    P.S: I can't update my version of the software 1.2, so I was think to download again with new version 1.2.2, I need to know if I can update and open my work in this new version without problems? Can I?

     
  • Davis Montenegro

    Hi,

    In this case you will have to do some work by yourself. Version 1.5 of DSSim-PC is no longer supported, which means that there not too much we can do with this code. But not everything is lost!, go to your dss script (the name of your project.dss in your projects folder), and create a monitor using your script, but this time the monitor will be mode=5 and must be place on your transformers (1 monitor per xfrm). once your simulation is done, using the TCP interface you can command DSSim to export your monitor data using the export command of OpenDSS.

    I hope this helps, please let me know if you need some extra help on this.

    Best regards

    Davis

     
    • João Paulo da Silva Bernardes

      Mr. Davis, it's working so far, but I have a problem with the loop, I try to select a specific transformer, but when I simulate on DSSIM-PC and plot on Matlab, the program returns all the transformers of the system, not just model that I choose, so what I doing wrong?

      DSSim_TCP('Init');

      for i=1:1440
      DSSim_TCP('Step_in');
      DSSim_TCP('Command','select Transformer.Tr_SubXF');
      voltage=DSSim_TCP('Command','voltage',);
      voltage=DSSim_TCP('Vpu');
      pause(0.02);
      end

      DSSim_TCP('End_Sim');
      DSSim_TCP('Close');

      I testing so far, before apply the monitor function like you suggested. If works, I will try to export all the data from the matlab.

       

      Last edit: João Paulo da Silva Bernardes 2016-11-10
      • Davis Montenegro

        Hi João,

        The problem is that Vpu returns the voltages in pu for all the nodes on the circuit. Instead of that try the following:

        voltage=DSSim_TCP('Command','voltage',);
        VBase=srt2num(DSSim_TCP('Command','? Transformer.Tr_SubXF.kV'));
        Vpu=[str2num(voltage(1,1)/VBase(1,1));str2num(voltage(1,3)/VBase(1,1));str2num(voltage(5,1)/VBase(1,1))];
        

        This should work

        Best regards

        Davis

         
        • João Paulo da Silva Bernardes

          First thanks for the help. Second, It's seems he's not reconize the function VBase=srt2num(DSSim_TCP('Command','? Transformer.Tr_SubXF.kV'));

          I thought the srt2num was actually str2num, but not work after I fixed. Also this message appears after I ploted.

          "??? Undefined function or method 'srt2num' for input arguments of type
          'cell'."

           
          • Davis Montenegro

            Hi man,

            You are right, the command is str2num. In this case we can try the following:

            voltage=DSSim_TCP('Command','voltage',);
            VBase=DSSim_TCP('Command','? Transformer.Tr_SubXF.kV');
            VBasen=str2num(VBase(1,1));
            Vpu=[str2num(voltage(1,1))/VBasen;str2num(voltage(1,3))/VBasen;str2num(voltage(5,1))/VBasen];
            

            Lets see what happens.

            Best regards

            Davis

             
            • João Paulo da Silva Bernardes

              Ok, I try twice, but the system still insist that the error is:

              "??? Error using ==> str2num at 33
              Requires string or character array input."

              I think before the program read the line 70, the algoritm works fine, but for some reason this str2num still show an error in his function, I try follow the instructions:

              CAUTION: STR2NUM uses EVAL to convert the input argument, so side
              % effects can occur if the string contains calls to functions. Use
              % STR2DOUBLE to avoid such side effects or when S contains a single
              % number.

              But It's seems the problem is VBase(1,1), the program don't reconize as string, if I not mistaken.

               
        • Davis Montenegro

          I just tried this:

          voltage=DSSim_TCP('Command','voltage',);
          VBase=DSSim_TCP('Command','? Transformer.Tr_SubXF.kV');
          VBasen=str2num(char(VBase(1,1)));
          Vpu=[str2num(char(voltage(1,1)))/VBasen;str2num(char(voltage(1,3)))/VBasen;str2num(char(voltage(5,1)))/VBasen];
          

          And it worked, please let me know if it worked for you too.

          Best regards

          Davis

           
          • João Paulo da Silva Bernardes

            I will text it now, thanks.

             
          • João Paulo da Silva Bernardes

            Work, but I have some problems with matrix sizes.

            "??? Index exceeds matrix dimensions."

             
            • Davis Montenegro

              Could be because we are sweeping the array (voltage) using the columns, try the following: in your MATLAB command window type size(voltage), can you please tell me what MATLAB returns?

              Best regards

              Davis

               
              • João Paulo da Silva Bernardes

                The matlab shows

                1x1 cell - 139.26, 3.9, 233.68, -123.7, 231.41, 131.4,

                Nothing more

                 
                • Davis Montenegro

                  Ok,

                  Then the solution is as follows:

                  voltage=DSSim_TCP('Command','voltage',);
                  voltagen=str2num(voltage{1});
                  VBase=DSSim_TCP('Command','? Transformer.Tr_SubXF.kV');
                  VBasen=str2num(VBase{1});
                  Vpu=[voltagen(1)/VBasen;voltagen(3)/VBasen;voltagen(5)/VBasen];
                  

                  Best regards

                  Davis

                   
                  • João Paulo da Silva Bernardes

                    Thanks Mr. Davis. I use your code above and occurrs the problem with str2num, so like you suggest early, I used char to complement the code, but occurrs another error, now with voltagen(3):

                    "??? Attempted to access voltagen(3); index out of bounds because
                    numel(voltagen)=2."

                     
    • João Paulo da Silva Bernardes

      Mr. Davis hi, I try to create a monitor, but I think the script is not entirely correct..

      New monitor.generator.PV_1 element=generator model=1 enabled=Yes terminal=1

      Can you give some advices?

       
      • Davis Montenegro

        Hi,

        There are several mistakes, for example, the element must be specified using the element's full name (for example, if your generator name is G12, the element name should be: element=generator.G12). "model" property does not exists, try "mode". Try the following declaration:

        New monitor.Mon1 element=generator.PV_1 mode=1 enabled=Yes terminal=1
        

        Best regards

        Davis

         
        • João Paulo da Silva Bernardes

          Thank you Mr. Davis, after this explanation the system work properly.

          Btw, last tuesday I finally was able to put TCP to work on matlab and export the data of transformer's tap, but I noticed that the system doesn't show the taps change per second, the value was fixed in 1, I don't know if I set the RegControl wrong, or my instructions of the control are not exactly right, do you have some thoughts about this?

          My code:

          Set VoltageBases = "69,13.8,7.967, .22"
          CalcVoltageBases

          Transformer.Tr_reg1a.wdg=2 Tap=(0.00625 12 * 1 +) !Allow only one tap change per solution. This one moves first
          Transformer.Tr_reg1b.wdg=2 Tap=(0.00625 5 * 1 +) !Allow only one tap change per solution.
          Transformer.Tr_reg1c.wdg=2 Tap=(0.00625 5 * 1 +) !Allow only one tap change per solution.
          Transformer.Tr_reg2a.wdg=2 Tap=(0.00625 13 * 1 +) !Allow only one tap change per solution.
          Transformer.Tr_reg2b.wdg=2 Tap=(0.00625 11 * 1 +) !Allow only one tap change per solution.
          Transformer.Tr_reg2c.wdg=2 Tap=(0.00625 12 * 1 +) !Allow only one tap change per solution.

          Set Controlmode=OFF

          Example of data response:

          hour, t(sec), Tap (pu)
          0, 0.00000, 1
          0, 60.00000, 1
          0, 120.00000, 1
          0, 180.00000, 1
          0, 240.00000, 1
          0, 300.00000, 1
          0, 360.00000, 1
          0, 420.00000, 1
          0, 480.00000, 1
          0, 540.00000, 1
          0, 600.00000, 1
          0, 660.00000, 1
          0, 720.00000, 1
          0, 780.00000, 1
          0, 840.00000, 1
          0, 900.00000, 1
          0, 960.00000, 1
          0, 1020.00000, 1
          0, 1080.00000, 1
          0, 1140.00000, 1
          0, 1200.00000, 1
          0, 1260.00000, 1

           
  • João Paulo da Silva Bernardes

    Thank you Mr. Davis, I will stay with 1.2.1 version so. About the export data using TCP interface, I will do that remotely using your matlab script, because I need all data from the taps of each regulator on my circuit, so I just need one more thing, do you have a code specifically for taps that I can use to export the data on matlab? Your software suggested a different approach with "EXP_Taps.CSV", but I don't know if this will work.

    Best Regards

    João Paulo

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.