This part of the guide shows first an example how to insert objects and their parameter data. Then it shows what other objects, relationships and parameter data needs to be added for a very basic model. Lastly, the model instance is run.
This section explains the process of creating a SpineOpt.jl model from scratch in order to give you an understanding of the underlying principles of the data structure, etc. If you simply want to try something out quickly to see results, check out the Example Models section. Furthermore, if you're in a hurry, the Archetypes section provides you with some pre-made templates for the different parts of a SpineOpt.jl model to get you started quickly.
- First, open the database editor by double-clicking the Input DB.
- Right click on model in the Object tree.
- Choose Add objects.
- Then, add a model object by writing a name to the object name field. You can use e.g. instance.
- Click ok.
- The model object in SpineOpt is an abstraction that represents the model itself. Every SpineOpt database needs to have at least one
- The model object holds general information about the optimization. The whole range of functionalities is explained in Advanced Concepts chapter - in here a minimal set of parameters is used.
- Select the model object
instancefrom the object tree.
- Go to the
Object parameter valuetab.
- Every parameter value belongs to a specific alternative. This allows to hold multiple values for the same parameter of a particular object. The alternative values are used to create scenarios. Choose,
Basefor all parameter values (
Baseis required in Spine Toolbox - all other alternatives can be chosen freely).
- Then define a
model_starttime and a
- Double-click on the empty row under
parameter_nameand select model_start.
Noneshould appear in
- To asign a start date value, right-click on
Noneand open the editor (cannot be entered directly, since the datatype needs to be changed).
- The parameter type of
model_startis of type
- Set the value to e.g.
- Proceed accordingly for the model_end.
- Double-click on the empty row under
Further reading on adding parameter values can be found here.
- Add all objects and their parameter data by replicating what has been done in the picture below. Do it the same way as explained above with the following caveats.
- Whilst most object names can be freely defined by the user, there is one object name in the example below that needs to be written exactly since it is used internally by SpineOpt:
parameter_namecan be selected from a drop down menu.
- The date time and time series parameter data can be added by using right-click to access the Edit... dialog. When creating the time series, use the fixed resolution with
Start timeof the model run and with
1hresolution. Then only values need to be entered (or copy pasted) and time stamps come automatically.
balance_typeneeds to have value
balance_type_nonein the gas node, since it allows the node to create energy (natural gas) against a price and therefore the energy balance is not maintained.
- To specify the temporal structure for SpineOpt, you need to define temporal_block objects. Think of a
temporal_blockas a distinctive way of 'slicing' time across the model horizon.
- To link the temporal structure to the spatial structure, you need to specify node__temporal_block relationships, establishing which
temporal__blockapplies to each
node. This relationship is added by right-clicking the
node__temporal_blockin the relationship tree and then using the
add relationships...dialog. Double clicking on an empty cell gives you the list of valid objects. The relationship name is automatically formed, but you can change it if that is desirable.
- To keep things simple at this point, let's just define one
temporal_blockfor our model and apply it to all
nodes. We add the object
temporal_blockfollowing the same procedure as before and establish
- In practical terms, the above means that there energy flows over
electricity_nodefor each 'time-slice' comprised in
- Similarly with the stochastic structure, each node is assigned a
- To specify the spatial structure for SpineOpt, you will need to use the node, unit, and connection objects added before.
- Nodes can be understood as spatial aggregators. In combination with units and connections, they form the energy network.
- Units in SpineOpt represent any kind of conversion process. As one example, a unit can represent a power plant that converts the flow of a commodity fuel into an electricity and/or heat flow.
- Connections on the other hand describe the transport of goods from one location to another. Electricity lines and gas pipelines are examples of such connections. This example does not use connections.
- The database should have an object
unitobject class and objects
- Next, define how the
nodesinteract with each other: create a unit__from_node relationship between
node_gas, and unit__to_node relationships between
- In practical terms, the above means that there is an energy flow going from
node_elec, through the
- Similar to adding the objects and their parameter data, add the relationships and their parameter data based on the picture below.
- The capacity of the gas_turbine has to be sufficient to meet the highest demand for electricity, otherwise the model will be infeasible (it is possible to set penalty values, but they are not included in this example).
- The parameter
fix_ratio_in_out_unit_flowforces the ratio between an input and output flow to be a constant. This is one way to establish an efficiency for a conversion process.
- Select SpineOpt
- Press Execute selection.
- Double-check that the data is correct
- Try to see what the problem might be
- Ask help from the discussion forum
- Double-clicking the Results database.
- Create a new alternative
- Add parameter data for the new alternative
- Connect alternatives under a scenario. Toolbox modifies
Basedata with the data from the alternatives in the same scenario.
- Execute multiple scenarios in parallel. First run in a new Julia instance will need to compile SpineOpt taking some time.