Project Tutorials SampleProject1 - acep-uaf/MiGRIDS GitHub Wiki

SampleProject1 starts off from the point where all the necessary input data is in netCDF files in SampleProject/InputData/TimeSeriesData/ProcessedData and the setup XML files are in in SampleProject1/InputData/Setup. This tutorial will help you step through how to generate simulation runs, run the simulations and analyze the results. Download the directory SampleProject1 from here. To get the same project with all the output files already generated, download SampleProject1Filled.

Go to SampleProject1/OutputData/Set0. The only file is the SampleProject1Set0Attributes.xml. This lists the changes from the setup files in input directory for each simulation run. It is set up to generate simulations where the electrical energy storage unit ees0 will have maximum input and output powers of 500, 750 and 1000 kW and rated durations of 300 and 1800 seconds. The components that will be run in each simulation in this set are: ees0, wtg0, gen0, gen1, gen2, load0 and tes0. All simulation steps will be run. However, in order to save time, instead of running at a 1 second time step (the resolution of the data files), a 10 second time step is selected. No changes are made to the control module input files.

Go to the Test Scripts directory and open the test script generateRunsSandbox. Enter the relative path to the Set0 directory of the project in the script and run it. This will populate the Set0 directory with different run directories. Three values were given for ees0 rated power and two values for its duration. Thus, there are 6 unique combinations of values and 6 run directories were created. Each Run directory contains a Components directory with the modified component descriptor files (based on the values in the compAttributeValues tag in SampleProject1Set0Attributes.xml.

Now open runSimulationSandbox in Test Scripts, enter the directory of Set0 and run it. After the first simulation run has finished, a wind power time series file for wtg0 (wtg0WP.nc) will have been saved in SampleProject1/InputData/TimeSeriesData/ProcessedData. Initially there was only a wind speed file (wtg0WS.nc). At the beginning of the first run, the wind power file is generated based on the power curve in the wtg descriptor file. Subsequent simulation runs will now use this instead of recalculating available wind power.

Each simulation run will take around 10-15 minutes to run, depending on the computer. So it will take around 1-1.5 hours to run all the simulations. If you rather not wait, you can download the completed project called SampleProject1Filled from here to continue with the analysis of the results.

Once the simulations have finished running, open getRunMetaDataSandbox in Test Scripts and enter the directory of Set0. Enter which simulation runs to analyze in runs. We will look at all simulation runs in this set, so you can enter [0,1,2,3,4,5] or range(6). Run the script. After a few minutes, csv and SQL database files called Set0Results will be saved in the Set0 directory. You can open the CSV to look at performance data, such as the total diesel generator import into the grid, diesel generator charging of the energy storage system, spilled wind power and more.

A plotting function is also provided called plotSetResult. Open plotSetResultSandbox in Test Scripts and change plotSetDir to the Set0 directory and run it. Look at the variable plotResValues for the values of what is being plotted. Values from the Set0Results` SQL database can be scaled, added, subtracted, multiplied and divided.

Right now, empty strings are being passed to baseSet and baseRun. Since we are comparing different energy storage sizes, it makes sense to have a base case where there is no energy storage. Create another directory called SampleProject1/OutputData/SetBase (you can call it whatever you like). Copy the SampleProject1Set0Attributes.xml file from Set0 into SetBase and call it SampleProject1SetBaseAttributes.xml. In compAttributeValues, change the ees0.PinMaxPa.value from 500,750,1000 to 0 and change ees0.ratedDuration.value from 300,1800 to 0. Note that currently the simulation requires there to be an electrical energy storage in the simulation. To model no electrical storage, simply set these values to zero. Generate the simulation run (it will only create one) and run it. Now, go back to plotSetResultSandbox and set baseSet = 'Base' and baseRun = '0'. If you want to simply have the base case as another point on the x axis, keep subtractFrombase = [0]\*len(plotResValues). If you want to plot the increase or decrease from the base case, change it to subtractFrombase = [2]*len(plotResValues) or subtractFrombase = [1]*len(plotResValues) respesctively.

Congratulations! You are now generating and running simulations. Play around with it to get a feel for how changing different parameters affects the simulations. Use initiateProjectSet to create a new set of simulations. It is always a good idea to plot the time series to see what is happening in the dispatch to make sure it is behaving like you want it to.