Kritika Mehta
email: kritika.mehta@grenoble-inp.org

Raheel Qader
email: raheel.qader@univ-grenoble-alpes.fr

Cyril Labbé Franc

Portet

Fine-Grained Control of Sentence Segmentation and Entity Positioning in Neural NLG

The move from pipeline Natural Language Generation (NLG) approaches to neural endto-end approaches led to a loss of control in sentence planning operations owing to the conflation of intermediary micro-planning stages into a single model. Such control is highly necessary when the text should be tailored to respect some constraints such as which entity to be mentioned first, the entity position, the complexity of sentences, etc. In this paper, we introduce fine-grained control of sentence planning in neural data-to-text generation models at two levels -realization of input entities in desired sentences and realization of the input entities in the desired position among individual sentences. We show that by augmenting the input with explicit position identifiers, the neural model can achieve a great control over the output structure while keeping the naturalness of the generated text intact. Since sentence level metrics are not entirely suitable to evaluate this task, we used a metric specific to our task that accounts for the model's ability to achieve control. The results demonstrate that the position identifiers do constraint the neural model to respect the intended output structure which can be useful in a variety of domains that require the generated text to be in a certain structure.

Introduction

Typical NLG models are characterized by a pipeline of stages [START_REF] Walker | Individual and domain adaptation in sentence planning for dialogue[END_REF][START_REF] Barzilay | Aggregation via set partitioning for natural language generation[END_REF][START_REF] Walker | Training a sentence planner for spoken dialogue using boosting[END_REF][START_REF] Stent | A conversation acts model for generating spoken dialogue contributions[END_REF][START_REF] Barzilay | Bootstrapping lexical choice via multiple-sequence alignment[END_REF][START_REF] Langkilde | Generation that exploits corpus-based statistical knowledge[END_REF][START_REF] Reiter | Building applied natural language generation systems[END_REF]. This approach can be conceptually divided into solving two questions: what to say? aka content determination and planning, and how to say it? aka text realization [START_REF] Gatt | Survey of the state of the art in natural language generation: Core tasks, applications and evaluation[END_REF]. In contrast, end-toend NLG systems combine these stages in a single end-to-end learning framework. Recently, there has been a lot of interest in combining sentence planning and realization stage into a single neural model [START_REF] Nayak | To plan or not to plan? discourse planning in slot-value informed sequence to sequence models for language generation[END_REF][START_REF] Dušek | Sequenceto-sequence generation for spoken dialogue via deep syntax trees and strings[END_REF][START_REF] Lampouras | Imitation learning for language generation from unaligned data[END_REF][START_REF] Wen | Semantically conditioned lstm-based natural language generation for spoken dialogue systems[END_REF][START_REF] Mei | What to talk about and how? selective generation using lstms with coarse-to-fine alignment[END_REF]. Although this resulted in some improvement at the grammatical level, in neural natural language generation this led to a loss of control that was otherwise possible in the pipeline approaches.

Neural NLG systems struggle to produce a consistent order of entities and are sometimes not faithful to the input by either hallucinating, omitting or repeating the entities [START_REF] Moryossef | Step-by-step: Separating planning from realization in neural data-to-text generation[END_REF]. They do not allow control over the output structure and while they exhibit impressive levels of fluency, they are less equipped to deal with higher levels of text structuring in a consistent manner. They are also unable to generalize sentence planning operations beyond what is seen in the training. It is therefore important to introduce explicit control in neural NLG so that the output is faithful to the input. In this way, the system would be able to generate diverse realizations making way for explicit control over the output text structure.

By controlling the facts in the generated text, different variations can be produced that emphasize a particular fact which is more important than others. For example, if the focus should be on "a cheap italian place", then "There is a cheap italian place called The Sorrento. It is located in the city center." will be more appropriate than "The Sorrento is located in the city center. It is an Italian Restaurant. It is cheap too". This is particularly helpful in different domains, for instance, when generating hotel review summaries, it is important to put the elements important for the user in front (e.g., family, bathroom etc), when generating company descriptions, it is important to put the main company selling points in front, and when generating messages for user with low literacy it is important to break sentences in small pieces, etc.

Recently there has been some work on controlling outputs of neural NLG models. In [START_REF] Reed | Can neural generators for dialogue learn sentence planning and discourse structuring?[END_REF], authors use token supervision to reproduce sentence planning and discourse operations where a sentence scoping operation controls the number of sentences in the generated output which is measured using the period operator. This method does not provide any information about the word order in a particular sentence. While in [START_REF] Moryossef | Step-by-step: Separating planning from realization in neural data-to-text generation[END_REF] an explicit and symbolic text planner is proposed which determines the information structure and expresses it in the form of ordered trees. The plan structures in this work take the form of ad-hoc explorations for specific tasks and does not evolve into general-purpose plan structures. Moreover, this work is dataset dependent and does not generalize to datasets other than graph-based ones. To improve over the work in the literature of controlling neural NLG systems, in this paper, we propose an approach to explicitly control the realization of input entities in the desired sentences and in the desired position among individual sentences.

Overview of the Approach

Our method focuses on the control of sentence planning at two levels -1) realization of input facts in the desired sentences and 2) realization of input facts in the desired position in the individual sentences. The idea is to directly attach sentence identifiers and slot identifiers to each slot, that indicate the sentence number and the position of the slot within that sentence respectively. The next step is to feed the modified Meaning Representation (MR) as an input to the seq2seq model and test if the model is able to learn to realize the slots in the correct positions.

Data Preparation

We used the E2E dataset for the experiments which provides information about restaurants and consists of about 50k combinations of a dialogueact-based MR and 8.1 text references on an average. Each MR consists of up to 8 slots/attributes and their corresponding values.

As the dataset does not already contain a sentence plan, we modified it in a way that the MRs contain sentence and slot position identifiers. More specifically, given a reference text, two position identifiers were attached to each slot of the MR representing the sentence number in which the slot is found and the location of the slot in that specific sentence. The alignment information is extracted using a script1 provided by the authors of [START_REF] Juraska | Slug2slug: A deep ensemble model with slot alignment for sequence-to-sequence natural language generation[END_REF]. Table 1 provides an example of different stages of aligning the reference text with the MR. Initially, we annotate the reference text to identify the beginning of each slot value in the text (line 2), then using this annotation, we first attach the sentence identifiers (line 3), and finally the MRs are augmented with the position of each slot within a sentence (line 4). Owing to faults in the alignment information, in some cases the slot values are not detected in the reference text despite being present in the MR and for other cases the sentences do not contain some slots present in the MR. For such cases, a position token in the format 0 0 Slottype[ Slot value ] is attached.

Ideally, we expect a human to assign the position identifiers to each slot in the MR based on the desired output text. However, doing so for 4000 samples of the test set for validating our work would be very exhaustive. Therefore, we experiment with two different strategies to attach the position identifiers. Firstly, we directly use the test set reference text to extract the position identifiers. However, this will lead to biased results when computing the automatic metrics scores. Second strategy is to predict the position identifiers automatically. For this, we propose three different approaches as shown in Figure 1 and described in detail below:

• Random: The position identifiers are randomly chosen and assigned to the slots in the MR by taking care of a few rules.

• Seq2seq: The position identifiers are learned using a sequence-to-sequence (seq2seq) model. The train set MR without the position identifiers and the corresponding train set MR with the position identifiers are fed as training data to the model described in the Section 3. The test set MR without the position identifiers are then fed to the trained model, which outputs the test set MR with learned position identifiers.

• Top Frequent: The position identifiers for the test set are obtained from the most frequent combination of position identifiers in the train set. For each entry in the test set, the slot types (e.g., name) and slot values (e.g, blue spice) are separated and then the training entries which have slots with the same values are identified. Then, the most commonly occurring position identifier combination is picked for the test set entry.

Our random approach could be considered as a very naive baseline as randomly assigned identifiers might not even make sense in some cases. For example, having only one single slot in the first sentence (which never happens in the training set) would not be enough to form a grammatically correct sentence. Thus, in such cases, the model will fail to follow the assigned identifiers. The seq2seq model should perform much better than the random approach since it learns how to put position identifiers directly from the training data. However, this model has to re-generate the whole sequence including the slot type, slot value, and the newly added position identifiers. This means that any errors introduced during the generation process will significantly effect the text generated by the NLG model. Lastly, the top frequent approach is expected to perform better than the other two approaches. It extracts the most common sentence plan for some given values directly from the training set. Thus, the chosen sentence plan is among the ones that the NLG model was most exposed to during the training process.

Evaluation Metrics

In most NLG problems, sentence level metrics such as BLEU, ROUGE and METEOR are used to evaluate the results. However, these metrics are not entirely suitable to evaluate slot positioning since they measure performance at sentence level and do not provide precision in terms of sentence planning accuracy. In addition to using these automatic metrics to compare the results of the position augmented dataset with the original dataset, we evaluate the sentence planning accuracy using a modified version of the word error rate called the Slot Error Rate (SER) which is computed as:

SER = S + D + I N ,
where S refers to number of substitutions, D refers to number of deletions, I refers to number of insertions and N refers to the total number of slots in the input MR. If a slot is realized in the wrong sentence it is counted as wrong-sentence substitution whereas if a slot appears in the wrong position but the correct sentence, it is counted as a case of wrong-slot-position substitution. It is important to note that the slot error rate compares two sequences of different nature (MR vs text).

The generated text is pre-processed to extract the expressed slots and position of each slot using a script with some heuristics that involves lots of E2E dataset-specific handwritten rules. It is worth mentioning that our definition of SER is slightly different from the ones in the literature, particularly [START_REF] Reed | Can neural generators for dialogue learn sentence planning and discourse structuring?[END_REF]. In our case we take into account the exact position of each slot in the generated text, thus, the positioning of the realized slot in the generated text plays has a huge impact on the SER. Because of this difference, our metric can also be interpreted as slot position error rate in the realized text. Output the cricketers is a chinese restaurant near all bar one in the city centre with a customer rating of 5 out of 5 and is cheap and family friendly. We use a standard seq2seq model with attention [START_REF] Bahdanau | Neural machine translation by jointly learning to align and translate[END_REF][START_REF] Luong | Effective approaches to attentionbased neural machine translation[END_REF]. The seq2seq model consists of an encoder and a decoder based on Long Short-Term Memory (LSTM) [START_REF] Hochreiter | Long short-term memory[END_REF].

The encoder reads the position augmented MR tokens one by one and feeds each token into an embedding layer and then to an LSTM layer. Finally the LSTM-based decoder takes the last hidden state from the encoder and starts generating output tokens one by one. Our decoder uses the dot attention mechanism as described in [START_REF] Luong | Effective approaches to attentionbased neural machine translation[END_REF].

Experiments and Results

We begin by comparing the SER obtained using the test set with only sentence identifier and the test set with both sentence and slot identifiers. The position identifiers are attached based on the alignment information obtained from the test set. Table 3 shows that the SER for the model with both sentence and slot identifiers is significantly lower. This is probably because the model in this case has more information to learn from and the slot identifier proves to be very important. In order to ana-lyze the results better, in Table 2 some of the output examples are shown. As it can be seen, even though both examples have quite complex combination of position identifiers, all the slots are realized in the correct position as indicated in the MR.

In the next part of the experiments, instead of using the reference text of the test set, we used 3 other approaches listed in Section 2.1 to attach the sentence and slot identifiers. The idea here is to i) not rely on the reference text, since it will bias the automatic metrics such as BLEU, ROUGE and METEOR and ii) to try more complex position identifier combinations and test the robustness of the model. Table 4 summarizes the BLEU, ROUGE, METEOR, and SER results obtained on the test set using the 3 approaches. It can be seen that the sentence-level metrics scores for the different versions of position augmented test set are quite variable. Top frequent seems to significantly outperform the other two approaches. This can be attributed to the fact that top frequent uses the most common sentence plans from the train set which are the easiest for the model to generate. This also shows that the test set and the training sets are extremely similar in their sentences' structures. Surprisingly the seq2seq approach performs significantly worse than the top frequent one. As described earlier, this is mainly because the seq2seq model introduces many errors in the slot types and values during the generation process which does not happen in the top frequent approach. These errors are also propagated to the NLG model, and hence, the performance is significantly impacted. It is important to note that these sentence-level metrics are computed on a single reference as opposed to the E2E challenge systems where multiple references where used, and as a matter of fact, their results there were much higher. The reason that we cannot use multiple references is because in the case of the random approach, each MR is changed and is assigned a unique set of identifiers, thus, distinguishing all of the previously unique MRs. To make the results consistent, we report single reference scores for the other two approaches as well.

When it comes to SER, we can see that top frequent again achieves the lowest score of 0.7%. The seq2seq model was trained with the position augmented train set that mostly consists of text with just one sentence. As data with one sentence is relatively easier than the data with multiple sentences, the SER of 5% with seq2seq model based test set is justifiable. The test set prepared with random identifiers reports an SER of 32%, which can be explained by the fact that the identifiers are attached without significant rules, and hence, some of the MRs do not make a logical sense if realized as text. Nevertheless, the model still learns to produce logically and grammatically correct sentences.

To better assess the faithfulness of the model, we used human verification of the model's output. We randomly selected 50 generated outputs (from samples of Table 3, line 2) and 4 annotators manually annotated the MR to show deletion, insertion, substitution and hallucination of slots where hallucination refers to realization of a wrong slot value. The original MR is compared with the new annotated MR to obtain an SER. The different scores obtained were averaged and the final SER reported is 14.25%. This score is slightly higher than the 7% reported in Table 3 since human subjects were additionally annotating hallucinations too. Excluding hallucinations will lead to a similar score obtained using the SER metric. Thus we can say that the human verification scores is consistent with the scores obtained from the SER metric.

Conclusion

We presented an approach to explicitly control the output text structure by incorporating control at two levels of sentence planning-realization of input entities in desired sentences and in the desired position among individual sentences. We created a new data set with position identifiers designed specifically for controlling sentence planning operations and we investigated different ways of preparing such sentence plans. Our results show that the model learns from the extra position identifiers which provide the capability to control variation in the output and enables generalizing to unseen combinations without a significant loss of performance in terms of sentence-level metrics.

Figure 1 :

 1 Figure 1: The three proposed approaches to automatically assign position identifiers to an MR.

( 1 )

 1 Alignment information "name[Blue Spice], eatType[coffee shop], area[city centre]", A coffee shop in the city centre area called Blue Spice.,(2: eattype) (21: area) (45: name) (2) Annotated reference text a (eattype)coffee shop in the (area)city centre area called (name)blue spice.

	(3) MR with sentence id.	1 name[ blue spice ], 1 eattype[ coffee shop ], 1 area[ city centre ]
	(4) MR with sentence and slot id.	1 3 name[ blue spice ], 1 1 eattype[ coffee shop ], 1 2 area[ city centre ]

Table 1 :

 1 Example of an MR augmented with sentence and slot position identifiers.

  Output: the cricketers is a restaurant providing chinese food in the 20-25 price range. it is located in the riverside. it is near all bar one. its customer rating is high. MR: 1 1 name[ the cricketers ], 1 3 eattype[ restaurant ], 1 2 food[ chinese ], 1 7 pricerange[ cheap ], 1 6 customer rating[5 out of 5 ], 1 5 area[ city centre ], 1 8 familyfriendly[ yes ], 1 4 near[ all bar one ]

	MR: 1 1 name[ the cricketers ], 1 2 eattype[ restaurant ], 1 3 food[ chinese ], 1 4 pricerange[ 20-25 ], 4 1 customer
	rating[ high ], 2 1 area[ riverside ], 0 0 familyfriendly[ no ], 3 1 near[ all bar one ]

Table 2 :

 2 Output examples: position identifiers added from text references.

	Experiment Type	SER
	MR with sentence identifier	27%
	MR with sentence and slot identifier	7%

Table 3 :

 3 Results: SER on the test set prepared from test set alignment information.

		SER BLEU ROUGE METEOR
	Random	32%	0.22	0.39	0.34
	Seq2Seq	5%	0.20	0.40	0.27
	Top Frequent 0.7%	0.30	0.49	0.35

Table 4 :

 4 Results: SER and sentence-level metrics on different versions of the test set with sentence and slot identifiers

	3 Model Architecture

https://github.com/jjuraska/ slug2slug/tree/master/data/rest_e2e

Acknowledgments

This project was partly funded by the IDEX Université Grenoble Alpes innovation grant (AI4I-2018-2019) and the Région Auvergne-Rhône-Alpes (AISUA-2018(AISUA- -2019)).


Faly Ramahatana

Mathieu David

Economic optimization of micro-grid operations by dynamic programming with real energy forecast

Optimal management of micro-grids requires anticipating the supply-demand

unbalance. This work aims at developing a method to integrate real day-ahead deterministic forecasts of photovoltaic (PV) production and of system loads in the management of an ESS integrated inside a micro-grid. Dynamic Programming (DP) has been chosen to optimize the cost of the micro-grid operation. To test the developed method, a real educational Net Zero Energy Building equipped with a PV roof is considered. Compared to a management that does not take advantage of forecasts, the developed method allows decreasing the operating cost of the system.

Introduction

Microgrids are rising worldwide because they contribute to better integrate renewables in energy systems [START_REF] Asmus | Microgrids, Virtual Power Plants and Our Distributed Energy Future The Electricity[END_REF]. A micro-grid is a system with its own generation means such as PV rooftop, loads and frequently an energy storage system (ESS). Its architecture aims to improve energy production and delivery to load. By their variable nature, intermittent RES such as PV generate fluctuations that destabilize supply and demand balance, reduce the power quality and therefore the system reliability.

The main challenge facing the microgrids is to find the most effective way to manage the generation and the load. This work focuses on a centralized microgrid with few controllable devices. Considering non-dispatchable RES such as PV, the use of an ESS allows balancing the supplydemand of electricity and add flexibility [START_REF] Anees | Grid integration of renewable energy sources: Challenges, issues and possible solutions[END_REF] to the system. The objective is to reduce the operation costs

Methods and tools

Load and PV forecasts

The building load forecasts are based on average weekdays. 𝐸𝐸 𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 (ℎ, 𝐷𝐷) is the energy consumed by the building for the week day D (i.e. Monday to Sunday) and hour h. The forecasted load 𝐸𝐸 𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 (ℎ, 𝐷𝐷) � corresponds to the average load of the building over the N weeks of the year as follow:

𝐸𝐸 𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 (ℎ, 𝐷𝐷) � = ∑ 𝐸𝐸 𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 (ℎ, 𝐷𝐷) 𝑁𝑁 𝑖𝑖 𝑁𝑁 ℎ ∈ (1, ⋯ ,24) 𝐷𝐷 ∈ (1, ⋯ ,7) 𝑎𝑎𝑎𝑎𝑎𝑎 𝑁𝑁 = 51 (1)
Using this method, we generate 7 averages weekdays, which are representative of the building schedule use during an average week. As a consequence, all forecasted weeks are identical.

To forecast the PV output, day-ahead forecasts with a 1-hour granularity of relevant weather parameters, i.e. solar irradiance and dry-bulb air temperature are retrieved from the IFS run launched at midnight and available at the ECMWF portal. The simplified model proposed by [START_REF] Chen | Sizing of Energy Storage for Microgrids[END_REF] is used to compute the generation of the PV plant:

𝐸𝐸 𝑃𝑃𝑃𝑃 � (𝑡𝑡) = 𝜂𝜂 𝑃𝑃𝑃𝑃 × 𝑆𝑆 × 𝐼𝐼 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸 � × �1 -𝑐𝑐𝑐𝑐 𝑃𝑃𝑃𝑃 × (𝑡𝑡 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸 � (𝑡𝑡) -25)� × 𝜂𝜂 𝑖𝑖𝑖𝑖𝑖𝑖 × ∆𝑡𝑡 (2)
Where 𝜂𝜂 𝑃𝑃𝑃𝑃 is the conversion efficiency of the solar cell array, 𝑐𝑐𝑐𝑐 𝑃𝑃𝑃𝑃 the temperature coefficient of the PV module, S the PV field area, 𝑡𝑡 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸 � and 𝐼𝐼 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸 � are respectively the forecasted dry-bulb temperature and the global solar irradiance. Regarding the inverter, the efficiency is calculated using the model proposed by [START_REF] Riffonneau | Optimal Power Flow Management for Grid Connected PV Systems With Batteries[END_REF]:

𝜂𝜂 𝑖𝑖𝑖𝑖𝑖𝑖 = 1 - 𝑃𝑃 𝑖𝑖𝑖𝑖𝑖𝑖 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 𝑃𝑃 𝑃𝑃𝑃𝑃 × (0.0094 + 0.043 × 𝐼𝐼𝑎𝑎 + 0.04 × 𝐼𝐼𝑎𝑎 2 ) (3)

ESS model

The architecture of the system is based on the model introduced by Riffoneau [START_REF] Riffonneau | Optimal Power Flow Management for Grid Connected PV Systems With Batteries[END_REF], composed by a load, a PV generator, an ESS and a connection to the main grid. A lead-acid batterie is used for this work, with the assumption that no self-discharge occurs over time. For the AC-DC (bidirectional) conversion, we will use the same type of converter as the one used for the PV generator and its efficiency is given by see eq. 3. The round-trip efficiency of the batteries is estimated to be a constant value 𝜂𝜂 𝐸𝐸𝐸𝐸𝐸𝐸 of 82% [START_REF]International Renewable Energy Agency Electricity storage and renewables: Costs and markets to 2030[END_REF].

The State of Charge (𝑆𝑆𝑆𝑆𝑆𝑆 = 𝑆𝑆(𝑡𝑡) 𝑆𝑆 𝑟𝑟𝑟𝑟𝑟𝑟,𝑖𝑖𝑛𝑛𝑛𝑛 ⁄ ) is the ratio of the current capacity C(t) to the reference capacity 𝑆𝑆 𝑟𝑟𝑟𝑟𝑟𝑟,𝑖𝑖𝑛𝑛𝑛𝑛 and its variation over the time is ∆𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) = 𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡 -∆𝑡𝑡) -𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡). The energy that flows in and out to the ESS is given by:

𝐸𝐸 𝐸𝐸𝐸𝐸𝐸𝐸 (𝑡𝑡) = � 𝐸𝐸 𝐸𝐸𝐸𝐸𝐸𝐸 (𝑡𝑡) 𝐿𝐿𝐷𝐷𝐸𝐸𝐸𝐸𝐷𝐷𝐿𝐿𝐷𝐷𝐷𝐷𝐸𝐸 = 𝜂𝜂 𝑖𝑖𝑖𝑖𝑖𝑖 × ∆𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) × 𝑆𝑆 𝑟𝑟𝑟𝑟𝑟𝑟,𝑖𝑖𝑛𝑛𝑛𝑛 𝑖𝑖𝑖𝑖 ∆𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) > 0 𝐸𝐸 𝐸𝐸𝐸𝐸𝐸𝐸 (𝑡𝑡) 𝐸𝐸𝐷𝐷𝐿𝐿𝐷𝐷𝐷𝐷𝐸𝐸 = ∆𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) × 𝑆𝑆 𝑟𝑟𝑟𝑟𝑟𝑟,𝑖𝑖𝑛𝑛𝑛𝑛 𝜂𝜂 𝑖𝑖𝑖𝑖𝑖𝑖 × 𝜂𝜂 𝐸𝐸𝐸𝐸𝐸𝐸 𝑖𝑖𝑖𝑖 ∆𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) < 0 (4)
From a technical point of view, the lifespan of this type of storage is linked to the number and the depth of the cycles of charges and discharges. The considered model estimates the deterioration of the IOP Publishing doi:10.1088/1742-6596/1343/1/012067 3 state of health (SOH) as a linear relationship between the depth of the discharges and a coefficient of aging Z. ∆𝑆𝑆𝑆𝑆𝑆𝑆, wich corresponds to the diminution of the SOH after a discharge, is given by following equation:

∆𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) = � 𝑍𝑍 × ∆𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) 𝑖𝑖𝑖𝑖 ∆𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) < 0 0 𝑖𝑖𝑎𝑎 𝑜𝑜𝑡𝑡ℎ𝑒𝑒𝑒𝑒 𝑐𝑐𝑎𝑎𝑐𝑐𝑒𝑒 (5)

Optimization

In energy planning, there are numerous methods dedicated to the operating cost optimization [START_REF] Khatamianfar | Improving Wind Farm Dispatch in the Australian Electricity Market With Battery Energy Storage Using Model Predictive Control[END_REF][START_REF] Marano | Application of dynamic programming to the optimal management of a hybrid power plant with wind turbines, photovoltaic panels and compressed air energy storage[END_REF]. Here, we chose the Dynamic programming (DP) because our problem can be convex or concave. Furthermore, [START_REF] Haessig | Computing an Optimal Control Policy for an Energy Storage[END_REF] showed that DP is a good candidate for the optimal management of an ESS. Last, as forecasts could be probabilistic, the use of the stochastic version of the DP will be the next step to achieve a robust ESS management.

The current SOH of a battery depends variation of the SOC and on various random factors such as manufacturing variance. Since our hypothesis does not take into account these random processes, it is assumed that the degradation is simply a function of the SOH. If the SOH reaches the minimum value 𝑆𝑆𝑆𝑆𝑆𝑆 𝑛𝑛𝑖𝑖𝑖𝑖 , the ESS is disabled. The operating cost 𝑆𝑆 𝐸𝐸𝐸𝐸𝐸𝐸 (𝑡𝑡) of the ESS depends on its SOH and on the investment cost 𝐵𝐵𝑖𝑖𝑆𝑆 of the ESS.

𝑆𝑆 𝐸𝐸𝐸𝐸𝐸𝐸 (𝑡𝑡) = 𝐵𝐵𝑖𝑖𝑆𝑆 × � -∆𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) 1 -𝑆𝑆𝑆𝑆𝑆𝑆 𝑛𝑛𝑖𝑖𝑖𝑖 � (6)
Costs of PV 𝑆𝑆 𝑃𝑃𝑃𝑃 (𝑡𝑡) and of purchased electricity from the grid 𝑆𝑆 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 (𝑡𝑡) are calculated using linear relationships based on unitary costs. The production cost of the PV field 𝑆𝑆 𝑃𝑃𝑃𝑃 (𝑡𝑡) is calculated as follow: 𝑆𝑆 𝑃𝑃𝑃𝑃 (𝑡𝑡) = 𝐸𝐸 𝑃𝑃𝑃𝑃 (𝑡𝑡) × 𝑆𝑆𝑢𝑢 𝑃𝑃𝑃𝑃 , where 𝑆𝑆𝑢𝑢 𝑃𝑃𝑃𝑃 is the unitary cost of energy production 𝐸𝐸 𝑃𝑃𝑃𝑃 (𝑡𝑡) of the PV generator . This unitary price of energy produced by the OPV is derived from the levelized cost of electricity (LCOE [START_REF] Branker | A review of solar photovoltaic levelized cost of electricity Renewable and[END_REF]). Considering the economical context of the study case, the unitary price is 𝑆𝑆𝑢𝑢 𝑃𝑃𝑃𝑃 = 0.069 𝐸𝐸𝑢𝑢𝑒𝑒𝑜𝑜𝑐𝑐/𝑘𝑘𝑘𝑘ℎ. In this study we assume constant values of the feed-in-tariff 𝑆𝑆 2 and variable grid cost 𝑆𝑆 1 of electricity are considered (see eq. 7).

𝑆𝑆 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 (𝑡𝑡) = 𝐸𝐸 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 (𝑡𝑡) × 𝑆𝑆𝑢𝑢 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 � 𝑆𝑆𝑢𝑢 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 = 𝑆𝑆 1 𝑖𝑖𝑖𝑖 𝐸𝐸 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 (𝑡𝑡) > 0 𝑆𝑆𝑢𝑢 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 = 𝑆𝑆 2 𝑖𝑖𝑖𝑖 𝐸𝐸 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 (𝑡𝑡) < 0 (7)
The cost function of the optimization problem is the economic costs of the micro-grid operation taking into account the costs of the different sources (i.e. PV, ESS and grid). The optimal operation cost is obtained from the global minimization of the following objective function where the unique decision variable is the ESS energy (𝐸𝐸 𝐸𝐸𝐸𝐸𝐸𝐸 ):

𝐽𝐽 = min � 𝑆𝑆 𝑃𝑃𝑃𝑃 (𝑡𝑡) + 𝑆𝑆 𝐸𝐸𝐸𝐸𝐸𝐸 (𝑡𝑡) + 𝑆𝑆 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 (𝑡𝑡) 𝑇𝑇 𝑟𝑟=1 (8)
Constraints are by nature related to the operation and to physical limitations of the system. The first constraint is the supply-demand balance of the micro-grid, which implies that the sum of the energy flows is null:

𝐸𝐸 𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 (𝑡𝑡) = 𝐸𝐸 𝑃𝑃𝑃𝑃 (𝑡𝑡) + 𝐸𝐸 𝐸𝐸𝐸𝐸𝐸𝐸 (𝑡𝑡) + 𝐸𝐸 𝐷𝐷𝐷𝐷𝐷𝐷𝐿𝐿 (𝑡𝑡) (9)
The system also experiences technical constraints related to ESS limitations and to the grid contribution. Considering an electro-chemical battery, the technology itself implies that it is not possible to use the storage in the extremums (totally empty or full). As a result, an operating range between a minimum SOC 𝑛𝑛𝑖𝑖𝑖𝑖 and a maximum 𝑆𝑆𝑆𝑆𝑆𝑆 𝑛𝑛𝑟𝑟𝑚𝑚 is necessary to avoid damaging the ESS.

𝑆𝑆𝑆𝑆𝑆𝑆 𝑛𝑛𝑖𝑖𝑖𝑖 ≤ 𝑆𝑆𝑆𝑆𝑆𝑆 ≤ 𝑆𝑆𝑆𝑆𝑆𝑆 max (10) As described in section II, the SOH of the ESS gradually decreases with the depths of the discharges. To keep the system working, a minimal level of SOH of the ESS 𝑆𝑆𝑆𝑆𝑆𝑆 𝑛𝑛𝑖𝑖𝑖𝑖 is required.

𝑆𝑆𝑆𝑆𝑆𝑆(𝑡𝑡) > 𝑆𝑆𝑆𝑆𝑆𝑆 min (11)

Implementation

The control of the ESS consists in scheduling the SOC of the ESS with time step of 1 hour. Therefore, the SOC of the ESS is scheduled every hour of the next day. For the study, two management strategy will be compared: instantaneous or ruled based management and controlled with forecasts.

The ruled based is an instantaneous management, depending on the SOC of the battery, the supplydemand imbalance and the charges/discharges of the ESS. The operation of this strategy can be summarized by few rules. The PV can only charge the ESS when PV output excess the load. The ESS supplies the energy to the load when the PV is not enough. If the ESS is empty, the grid supplies the load. And finally, if the ESS is full, the excess of energy is injected to the grid.

This second management mode uses the forecasts as input of a receding horizon method. At 00h00 of simulated day 𝐷𝐷, 3 days of PV and load forecast are produced. Then, the optimization schedules the operation of the ESS for the next 72h of with a 1-hour granularity. Only the first 24 hours are considered to operate the ESS but the use of a longer horizon in the optimization permits to define an optimal SOC at the end of the first day. Without this receding horizon method, the ESS would have been empty at the end of every day. During the realization of the schedule of the ESS, the grid counterbalances the deviations from the forecasts. First, perfect forecasts, corresponding to the recorded historical data, will provide an assessment of the best performance that could be achieved while introducing forecasts to elaborate the scheduling of the ESS. Second, real forecasts, as described in section II, will give realistic results.

The operation cost of the micro-grid is obviously the first indicator generated by the two management strategies. Beside the economic assessment, the evaluation of the quality of the management of the micro-grid, will be done by the following indicators proposed by Simpore [START_REF] Simpore | Modélisation, simulation et optimisation d'un système de stockage à air comprimé couplé à un bâtiment et à une production photovoltaïque[END_REF]:

Self consumption: 𝜏𝜏 𝑐𝑐𝑐𝑐 = ∑ �𝐸𝐸 𝑃𝑃𝑃𝑃-𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 (𝑟𝑟)+𝐸𝐸 𝐸𝐸𝐸𝐸𝐸𝐸 (𝑟𝑟) 𝐶𝐶𝐶𝐶𝐿𝐿𝐶𝐶𝐶𝐶𝐸𝐸 � 𝑇𝑇 𝑡𝑡=1 ∑ 𝐸𝐸 𝑃𝑃𝑃𝑃 (𝑟𝑟) 𝑇𝑇 𝑡𝑡=1 (12)
The rate of injections to the grid:

𝐸𝐸 𝐷𝐷 = ∑ �𝐸𝐸 𝑃𝑃𝑃𝑃-𝐶𝐶𝐶𝐶𝐺𝐺𝐿𝐿 (𝑟𝑟)+𝐸𝐸 𝐸𝐸𝐸𝐸𝐸𝐸-𝐶𝐶𝐶𝐶𝐺𝐺𝐿𝐿 (𝑟𝑟)� 𝑇𝑇 𝑡𝑡=1 ∑ 𝐸𝐸 𝑃𝑃𝑃𝑃 (𝑟𝑟) 𝑇𝑇 𝑡𝑡=1 (13)

Data

The load data come from a building called EnerPOS, which is located in St-Pierre in the island of Reunion, a French overseas territory in the Indian Ocean. It is a building in a tropical environment of the southern hemisphere. The building is intended for administrative and school uses. It is a Net zero energy building [START_REF] Sartori | Net zero energy buildings: A consistent definition framework[END_REF] with integrated photovoltaic systems and a low energy consumption. The meteorological data comes from a meteorological station installed on the same site. The cost of electricity in Reunion Island is subsidized by the state and the selling prices are strongly lower than the real cost of electricity production. Considering these artificially low tariffs, the development of renewables must be grant-aid. In this work, we shifted the current prices applied to the studied building to correspond to the annual and real cost of energy provided by the unique local distribution operator, including taxes (Table 1). The timetable of the peak, off peak and normal hours used to compute the electricity bill of the building can be consulted on EDF website [START_REF]Tarifs et catalogues de prestations EDF Réunion[END_REF].

Results and discussion

For a sample day (see figures 1 and 2), we can see that the ESS operation of the ruled based strategy differs significantly from the control with forecasts. Considering the same initial SOC=0.5, the latter outperforms the ruled based method. The optimal control with forecasts uses the difference of prices between peak and off-peak hours to maximize the gains. The storage only stores the energy required to avoid purchasing of electricity from the grid during the peak hours. Regarding more specifically the use of real forecasts, the behaviour of the ESS is almost the same as for perfect forecasts. But due to forecasting errors, mismatches in supply-demand balance occur and increase the operating cost. As expected, in case of supply-demand imbalance of the micro-grid, the rule-based strategy systematically charges or discharges the ESS. As a consequence, the storage accumulates the extended of energy from the PV till its full and when the PV is not enough, the storage discharges to compensate the deficit. So, the ruled-based management uses intensely the storage and the operation cost is more important because of strong and frequent discharges. The forecast quality [START_REF] David | Outputs and error indicators for solar forecasting models[END_REF] is computed for an entire year of operation of the building. Table 2 gives the yearly metrics of error for the PV, the load and the net-load forecasts. This former corresponds to the net consumption of the building when considering the PV production, 𝐸𝐸 𝑁𝑁𝑟𝑟𝑟𝑟-𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 = 𝐸𝐸 𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 -𝐸𝐸 𝑃𝑃𝑃𝑃 . The forecasts experience a low bias. One can also notice that the PV forecasts are less accurate than the load forecasts with lower RMSE and MAE. Finally, the net-load forecasts are strongly worse than both PV and load forecasts. The evolution of the hourly operation cost as a function of the hourly forecasting error of the net-load indicates that an overestimation of the net-load leads to an increase of the operation cost. Moreover, if the error is close to 0, there are high cost valuers, which mean that at some points, we have to exploit the storage or the network as much as possible. In table 3, annual indexes show that the knowledge of the future can reduce the operating cost by 22% using perfect forecast and 15% with real forecast. So, the quality of the forecast increases the economic gains. Regarding the self-consumption rate, the values are almost the same for the perfect and real forecasts. However, the ruled-based has a higher self-consumption rate because the ESS is systematically charged when there is a surplus of PV production and then this surplus is shifted to the night hours to supply the building. The control with forecasts sells more energy to the grid to increase the gains and thus the injection to the grid is higher than the rule-based management.

Conclusion

This work sets up the optimal control of an ESS with the aim to minimize the operating cost of a real microgrid. The specificity of the approach is to use real forecasts for the load and for the PV production. The use of the forecasts permits establishing the day-ahead schedule of the ESS and to minimize the operating cost. First, the results show that dynamic programming optimization allows detailing efficiently the microgrid features even if they assume non-linear behaviour. Second, the use of the ECMWF forecasts to predict the PV production improves significantly the yearly gain compared to a rule-based management strategy. Then, this study highlights that an underestimation of the future resources (PV) has less effects on the operating cost reduction than an overestimation.

Figure 1 . 2 .

 12 Figure 1. Rule-based management Figure 2. Real forecast scheduling

Figure 3 :

 3 Figure 3: Relationship between hourly forecast error and operation cost of the microgrid.

Table 1 .

 1 French context electricity price from extrapolated value at January 2018

		Fixed part	Peak	Summer (c€/kWh)	Winter (c€/kWh)
		(€/kW)	(c€/kWh)	LRH	NH	LRH	NH
	Average	47,640	41.49	13.83	15.17	18.38	25.87
	Normal hours: NH
	Low rate hours: LRH

Table 2 :

 2 Annual error metrics

		RMSE (Wh)	MAE (Wh)	MBE (Wh)
	Load	0.469	0.305	-0.003
	PV	0.909	0.332	-0.107
	Net-load	2.499	1.834	0.104

Table 3 :

 3 Performances of the microgrid for 1 year of operation

		Self-consumption	Injection to the grid	Max Energy	Annual operating
		τ cs [%]	𝐄𝐄 𝐑𝐑 [%]	from grid	cost J [€]
	Perfect	49.482	38.746	10.488	1086.054
	Forecast	48.215	44.239	14.258	1189.498
	Rule-based	55.758	9.432	3.534	1402.965

CISBAT 2019 Journal of Physics: Conference Series 1343 (2019) 012067