-
Notifications
You must be signed in to change notification settings - Fork 3
Model
The file /SolarCalculator/Simulation.py contains the core simulation code which takes a set on input parameters and simulates the solar system over the given date range. To run a simulation, a Simulation object must be created. A Simulation object contains all of the parameters required to run a simulation, the methods to run and check on the progress of a simulation and a storage for the results.
All of the data required for a simulation is encapsulated as Asset objects2. Asset objects represent the physical items in a solar farm setup such as the panels, the inverters and transformers etc. Each asset derives itself from the Asset super class which contains all the methods for calcu- lating financial information relating to the assets. This super class contains the methods for calculating the depreciation on assets and storing information on the cost and currency of the assets. The subclasses created for each asset contain all the data relating to the asset which is relevant for the power flow simulation. For example the panel object encapsulates all the information such as the panel output voltage, the degradation rate, area and rating.
After a simulation object as been created it can be run by calling the following methods in sequence
This will start the power simulation threads which work through the a list of days to simulate, putting the resulting data in an output queue. It is important to note that this call is non-blocking.
After the power simulation has started this will return the progress of the power simulation as a number between 0 and 100 - 0 meaning the simulation has just started and 100 meaning the simulation is complete.
This will block until the power simulation is finished and will return a dictionary with the results of the power simulation.
This starts the financial simulation. It is worth noting that this call will block until the simulation is complete. The blocking call was done as it takes significantly less time to run in comparison to the power simulation.
This will return the results of the financial simulation as a dictionary with the results stored as arrays inside this dictionary
An example of how a simulation is created can be found in the function createSimulation() in /main.py. An example of how to execute a simulation can be found in the method evt runSimulation clicked() of the SolarFarmCalculator object, also found in /main.py.
Due to the days being independent from the each other during the simulation period, it is possible to simulate multiple days in parallel to increase throughput and allow for a higher resolution than conventional single threaded simulation.
Upon initialising a simulation object (discussed in section 3.1.1) objects containing the necessary data for each day are created and stored in a work queue. After the multiple execution threads have processed the data in parallel the results are pushed to an output queue and sorted into order. This is fundamental to the software being able to run detailed simulations and provide feedback to the user about the progress of the simulation as the simulations are happening asynchronously to the main thread.