“…The constraint in (6) assures the power balance between the generation and consumption: the left-side terms represent the total generation forecast (P t Ftg ), discharging of the flexibility (x t dis P t flex,dis ), total import (y t i P t ti ) powers, while the right-side terms represent the total consumption forecast (P t Ftc ), charging of the fleixbility (x t ch P t flex,ch ), and total export (y t e P t te ) powers from the REC. Additionally, the discrete variables of x t dis , x t ch and y t i , y t e ensure respectively that for each t, the simultaneous discharging/charging of the flexibility and import/export of power to/from the REC will not occur; this is formulated mathematically in (7). The flexibility-related constraints are formulated in ( 8)- (11).…”