Home
Real Time Control Tools User Manual
Contents
1. this block can be defined in RTC Tools directly or externally in Matlab Figure 1 6 Architecture and interfaces of RTC Tools Architecture and supported interfaces The software does not aim at a detailed and complete simulation of large water resources systems Therefore it does not include any GUI or case management support However it is intended to solve specific RTC related problems which we may want to integrate into larger models or forecasting systems To support this feature the software provides interfaces to the forecasting system Delft FEWS PI XML interface and modeling packages such as SOBEK and Delft3D via OpenMI The latter enables a user to combine the operating rules and controllers of RTC Tools with more detailed hydraulic modeling components founds in the hydraulic modeling packages mentioned above see Figure 1 6 The modeling components of RTC Tools includes another important interface to OpenDA for applying data assimilation techniques in order to improve the system state of the modeling components This feature may be used in the context of forecasting and predictive control application for improving the system state at forecast time and therefore also the lead time accuracy of the forecast itself The set up of MPC can be done in RTC Tools directly by using one of the integrated optimiz ers Alternatively a user may choose to externalize this part and use his preferred optimizer and optimization probl
2. Integrated application with sophisticated hydraulic model via OpenMI Gregersen et al 2007 Typical hydraulic models such as SOBEK Mike11 or HEC RAS have on board features for modeling the real time control of hydraulic structures If more advanced features beyond the available ones are required APIs may enable the user to link external code Fig ure 1 4 A main advantage of RTC Tools against a dedicated user programming is the availability of a wide range of already existing and tested features the option for extending or modifying them easily and the overall framework with file io and interfaces o Predictive control of hydraulic structures In particular in forecasting system MPC provides an advanced option for supervisory control and decision making for example for scheduling pump actions in polder systems or the release of reservoirs The set up consisting of an optimization of the hydraulic structure by MPC included the embedded representation of the water resources system Figure 1 5 Deltares 3 RTC Tools Reference Manual Triggers Rules Controllers Network Components control active path input active path control isi 2 gt o D x KO s o a 1 2 3 sequential or hierachical sequential evaluation of sequential execution of execution of triggers active rules non modeling components triggered rules are sub components may be always evaluated executed in parallel Figure 1 3 RTC
3. where x is an external time series or output of a previous model timeRelative This rule reads y x 2 47 where 7 is a relative time reference When the rule is switched on the relative time is i put to zero ii put to a value based on an existing y for which equation 2 47 is fulfilled Triggers deadBandTrigger The dead band trigger checks the input data for an upper or lower threshold crossing The trigger is active in case of an up crossing of the upper threshold condition 1 It is inactive in case of a down crossing of the lower threshold condition 2 In the range in between the trigger keeps its former state The rule reads I er y O PEA 2 48 y otherwise where x1 x2 X3 14 are either constant values or time series The following operators are supported gt gt lt lt Dead band triggers are used to switch on and off pumps or turbines and the dead band ensures that the device is not switched on or off too often The dead band trigger as well as the standard trigger see section 2 5 6 may include other triggers which are evaluated in case of an active or inactive trigger state This feature enables a user to build complex decision trees for selecting unique rules for controlling a structure Figure 2 4 Rules which are referenced in a trigger and are associated with an inactive path will be deac tivated This procedure supports that a hydraulic structure is controlled by a unique control
4. 0QE hE ag 2 23 1 0 Q6 At 8Qi h9 where 0 5 lt 0 lt 1 0 is the time weighting coefficient of the Theta scheme shifting gradually from a more accurate second order Crank Nicholson method for 0 0 5 to a more robust first order Backward Euler scheme for 0 1 0 14 Deltares 2 3 8 Simulation components reservoirCompact This is a dedicated component for hydropower reservoirs with gated spillways Depending on the availability of a forebay elevation input zs the mass balance equation is either used to compute the new reservoir storage s or the reservoirs mass balance residuum rf In the case of no forebay elevation input the new storage is computed by sh sk At QF n 05 n 2 24 rk 0 where Q7 and Qo are reservoir inflows and outflow respectively and At is the time step In the case of an available forebay elevation the mass balance is used to compute the mass balance residuum by k k k p S 270 aight E x gt Vin 00 2 25 The first mode is primarily used to simulate reservoirs or optimize them in a seguential mode check details in Chapter 3 The second mode serves to run the reservoir in update mode in case of having inflow outflow and forebay elevation available and checking the reservoir s mass balance Furthermore it is used in the simulaneous optimization mode The forebay elevation zf directly depends on the storage given by zty fis s 2 26 where the level
5. g k STGT Ak 2 2 31 QS TGT 100 QO 2 31 The turbine flow Qr at an aggregated project level is bounded by the requirement of a mini mum power production and the maximum turbine capacity in term of a maximum power pro duction or an external maximum turbine flow O7 x ext provided by Qiu fro P r h Ox min fpo Px hk Oh x eat where Qrm and Qrx are the minimum and maximum turbine flows respectively Pm Px are the power production bounds and the function fpo provides the relations between power head and the turbine flow The function fpo and its corresponding inverse function fop are derived from information about the turbine efficiency which is either provided by a lookup table as a head dependent efficiency unit power discharge or by a two dimensional lookup table as a dependency on head and flow dimensionless 2 32 The spill target and the turbine flow bounds in combination with an embedded prioritized re lease policy enables us to split the total outflow into spill and turbine flow The minimum generation reguirements in effect for voltage support are the highest priority objective Addi tional outflow is allocated for the spill target then for additional power generation up to the maximum turbine capacity and finally directed again to the spill This implicit outflow distribu tion enables us to keep the total outflow as a single optimization variable without the need for optimizing spill and turbine flow sep
6. Introduction For conjunctive modelling of real time control with hydraulic processes RTC Tools is equipped with an interface according to the OpenMI standard Applications of such conjunctive mod elling have been described by Becker et al 2012 Schwanenberg et al 2011 and Becker 2013 Detailed technical information for an OpenMI composition consisting of RTC Tools and SOBEK is given by Schwanenberg et al 2011 and Becker 2013 The OMI file Below an example of an omi file is given The keyword Assembly refers to the location of the dynamic link library with the RTC Tools computational core This DLL must provide the OpenMI interface definition LinkableComponent refers to Deltares RtcToolsWrapper RtcToolsLinkableComponent this is hard coded in the OpenMI interface definition Table A 2 explains the meaning of the argument keys lt xml version 1 0 gt lt LinkableComponent Type Deltares RtcToolsWrapper RtcToolsLinkableComponent Assembly RTCToolsOpenMI bin Deltares RtcToolsWrapper dll xmlns http www openmi org LinkableComponent xsd gt lt Arguments gt lt Argument Key modelDirectory ReadOnly true Value RtcTools lt Argument Key MissingValue ReadOnly true Value 0 gt lt Argument Key 0penMiTimeStepSkip ReadOnly true Value 144 lt Argument Key SchemaLocation Read0nly true Value RTCTools xsd gt lt Arguments gt lt LinkableComponent gt Table A 2 Ope
7. It reads y a A a 2 51 The following operators are supported A AND V OR XOR If more than two terms needs to be combined the set can be used recursively by defining another set as one of the two terms Therefore the expression y xf A 28 Vrh is represented by a hierarchy of two sets check the example in the configuration chapter spreadsheet The spreadsheet trigger enables the definition of a new trigger state based on its old state and a maximum number of three additional inputs Besides off 0 on 1 states all other positive integer values larger than 1 can be processed Figure 2 6 shows an application of the trigger to the combination of alarm levels for Lake Thun Canton Bern Switzerland Deltares 21 2 5 6 2 5 7 RTC Tools Reference Manual Seestand m M A ROT 558 00 558 00 557 90 557 80 557 70 557 60 557 50 557 40 557 30 5 10 15 20 25 Ver nderung Seestand mm h Figure 2 5 Example for the application of the polygon trigger to the definition of warning levels for controlling a lake release at Lake Thun Canton Bern Switzerland Standard The standard trigger compares two input values and returns true 1 or false 0 k 1 ite Sa 2 52 Y 0 otherwise 2 52 Beside the gt operator that is used in Equation 2 52 the following operators are supported gt gt 3 A lt lt Expression The expression trigger works like the expressio
8. RTC Tools implements feedback control and advanced Model Predictive Control MPC for implementing state of the art control strategies aiming at a safe energy and cost aware integral management of water resources systems Control methods Feedback and feedforward Feedback is a control principle where the control error i e the difference between target value and actual value is measured and used to determine control actions Feedforward uses observed disturbances from somewhere else in the system to determine control actions Schuurmans 1997 Figure 1 1 shows an example of these technigues In both cases the operator aims to main tain the water level at target by adjusting the downstream gate position In Figure 1 1b the operator controls the water level using information on the offtake structure flow The offtake structure flow cannot be controlled by the operator and can therefore be considered a distur bance When measurements of disturbances are used to form control decisions the control method is called feedforward In Figure 1 1a the operator checks the deviation of the wa ter level from the target level The water level is the controlled parameter This operation technigue is called feedback control Schuurmans 1997 Deltares 1 RTC Tools Reference Manual feedback feedforward disturbance flow rate mn _ target level e 3 X controlled Output water level a feedback control b fee
9. Tools configuration in typical simulation set up triggers reactive oper ating rules and controllers network components Triggers Rules Controllers active path feedback active path OpenMI DeltaShell exchange layer Figure 1 4 RTC Tools configuration in typical simulation set up triggers reactive oper ating rules and controllers linked with a hydraulic model via OpenMI 4 Deltares 1 4 Introduction Optimizer Optimization Problem Modeling Components control input variables cost function value and gradient constraint values parallel execution and Jacobian simulation results 1 2 embedded or external MPC problem definition optimization algorithms including input variables constraints and cost function Figure 1 5 RTC Tools configuration in typical Model Predictive Control set up optimizer optimization problem definition and network components History The RTC Tools software package originates from the integration of several project specific reservoir simulation modules in flood forecasting systems for river basins in Austria Germany and Pakistan Its original design in Java in 2007 also referred to as the Delft FEWS Reser voir Module aims at the simulation of pool routing in reservoirs including related feedback controllers and operating rules Features for supporting a sequential nonlinear version of Model Predictive Control MPC were introduced in 2008 and e
10. release respectively For defining an eguality constraint on the residuum r we consider a bound constraints with nam Tmax 0 and define a state constraint referring to the two optimization variables s and Qouz the modeling component above and N 2 time steps note that the storage at sf and sf contributes to the mass balance equation Example 2 Let s add a tailwater curve to the reservoir given by tw f Q 4 3 8 and define two constraints for i Keeping a minimum tailwater level and ii limiting the maximum tailwater rate of change k i tw lt twmi N min u 3 9 ii Atwmin lt tw tw lt Atwmax The implementation of the first constraint considers the variable Qouz refers to the modeling components 3 8 and requires N 1 The second constraint works in the same way except for the need for looking back an additional time step in time leading to N 2 Note that the Matlab interface provides a platform for defining more general constraints via a user programming 28 Deltares 3 3 3 3 4 Optimization components Cost function terms RTC Tools supports the following cost function terms absolute difference related to a set point T J wY fubu sp k 1 where w is a weighting coefficient usp is a constant or time dependent set point The abso lute term can be applied either on a control state or dependent variable The configuration supports the neglection of the upper branch u gt
11. schema directory gt workDir lt path to work directory gt RTC Tools in Delft FEWS We recommend the following setup of the file system for implementing RTC Tools under Delft FEWS lt Delft FEWS regional home gt lt Modules gt lt RTCTools gt lt bin gt including the executables and XSD schemas rtcDataConfig xml configuration of time series and file io rtcRuntimeConfig xml configuration of runtime settings rtcToolsConfig xml configuration of the modeling components run bat batch file for executing a model run state_import xml timeseries_import xml Note that the files above represent the minimum set of a RTC Tools model The following hints summaries our recommended best practice for implementing RTC Tools model in Delft FEWS Use a consistent naming convention between Delft FEWS and RTC Tools We recom mend to define the RTC Tools Id by lt locationld gt lt parameterld gt where the location and parameter ids are the ones in Delft FEWS Try to avoid an additional the mapping in Delft FEWS and use the one in the rt cDataConfig xml Make sure that you use the same units in Delft FEWS and RTC Tools There will be no unit conversion Put the configuration files rt cXXXConfig xml into a module dataset Start with a time series exchange by pure XML then switch it to the XML bin option later for efficiency A 5 RTC Tools in OpenMI 36 Deltares A 5 1 A 5 2 A 5 3 Configuration
12. status gt lt output gt 42 Deltares B 4 Errors and unexpected results Example 2 the target time series of an expression is not specified lt y gt lt y gt Example 3 an input time series is not specified lt x1Series ref IMPLICIT gt Instance document parsing failed Error message The file diag xml says error instance document parsing failed level 1 Reason A file is missing Possible solution Check if all files are available Most likely the file state import xml is missing Deltares 43 RTC Tools Reference Manual 44 Deltares C Programming in RTC Tools draft version C 1 Preface Contributions to RTC Tools are welcome The source code is available in an Apache Sub version repository SVN repository https svn oss deltares nl repos rtc tools We recommend to use a subversion client for example Tortoise SVN to checkout the source code from the repository To request read write access contact the RTC Tools product man agement We use Microsoft Visual Studio to compile RTC Tools code Microsoft Visual Studio projects are provided within the source code package We ask developers for the following To make sure that the new feature fit fits well into the RTC Tools architecture we encour age developers to contact the principal developer or RTC Tools product management to discuss the ideas Prepare a small test model that illustrates the new feature and add it to
13. storage relation fj can be configured as a piecewise linear lookup table or a polynominal function The reservoirCompact component implements several options for computing the tailwater elevation zz according to the equations 2 100 2 27 Zu a bat Gg 08 2 28 N ed EF a QF OB ext 2 29 where ftw in Equation 2 27 is a piecewise linear table with the relation between the outflow of the reservoir and the tailwater elevation Note that this formulation is not taking into account backwater effects from downstream projects Equation 2 28 is a tailwater equation which considers the reservoir s outflow and the forebay elevation z fp of a downstream reservoir It includes the parameters a b c and d Equation 2 29 makes use of an external tailwater forecast 21 cat for a given outflow trajectory Qo ex The simulated tailwater is computed by a linear variation of the provided external tailwater and the products of a parameter a and the difference between the simulated and external outflow Furthermore the tailwater can be provided by an external time series or modeling component The head h of the turbines is computed by hk 2k 2h 2 30 Deltares 15 RTC Tools Reference Manual Environmental obligations may require spill operations In this case the spill is either pro vided as an absolute flow Qs rer or provided by a spill rate gsrar which is computed as percentage of the total outflow Qo according to k
14. summation term in 2 19 is empty and hence should be taken as zero Deltares 13 2 3 7 2 3 7 1 2 3 7 2 RTC Tools Reference Manual reservoir Mathematical model The basic equation for pool routing in a reservoir is ds I Q h dt ach 2 20 h f s where I inflow into the reservoir O release of the reservoir s storage in the reservoir state variable h water level in the reservoir t time We assume the relation f between storage s and water level h to be a function or a piece wise linear lookup table The release from the reservoir can be further subdivided into an into a controlled release Qc and an uncontrolled release Q according to Q h dg Qe h dg Qu h 2 21 where dg is the setting of a hydraulic structure Whereas the controlled release is a function of the water level h under assumption that its maximum capacity depends on the water level in the reservoir and the setting of the structure dg The uncontrolled release is only a function of the reservoir s water level h representing for example an uncontrolled spillway with a fixed crest level Numerical schematization The explicit schematization also referred to as Forward Euler for the pool routing equation reads sh sh At I OHK ag QE he 2 22 and is conditionally stable for sufficiently small time steps The unconditionally stable implicit version is sE s LL AHA 14 01 1 09051 101 dg
15. the examples in the svn repository RTC Tools is provided in a dual license model o as open source under the GNU public license version 2 GPL2 o under a proprietary license The dual license model is necessary to be able to provide features like commercial solvers or built in interfaces to commercial software which is conflictual to GPL2 Developers must transfer their intellectual property rights for the added code to Deltares Deltares in return guarantees to provide RTC Tools under GPL2 license C 2 Implementing a new feature to RTC Tools Below the main working steps to implement new features to RTC Tools are given Modify the XML schema definition XSD file xsd If you want to add a new hydrological model component newModel in rtcToolsConfig xml go to rtcToolsConfig xsd o Define the elements and attributes you need In most cases they will be of Complex Type or SimpleType o Specify the minimum and maximum number of occurrences minOccurs maxOccurs where minOccurs 0 means optional o Maintain alphabetical order 0 Add the newly defined elements to a feasible place in the main tree Our hydrological model newModel should be added to the components group o Validate the xsd file Run the script update_XSD bat This script translates the XSD into C class files Open the source code and go to the files that have been changed by the script update_XSD bat o Create a h file newModel h for the new class de
16. variable may includes optional bounds for the according to Umin lt u lt Umax In case of the TIMEINSTANT of the TIO MPC the minimum and maximum bounds are compulsary and represent the two states of the control variable At each time instant the state is switches from one value to the other Each optimization variable can include a scaling factor It is good practice to scale all variables in such a way that they are in the same order of magnitude For example if variables cover both reservoir levels and releases the scaling factor of the level should be defined in such as way that its range i e the difference between maximum and minimum operating levels of the reservoirs multiplied by the scaling factor is in the range of the releases User defined scaling usually outperformed automatic built in scaling options of the optimizers The time step of the control variable u and the simulation can be different This enables a courser discretization in the optimization compared to the simulation for example in case of using an explicit model with severe time step restrictions At this moment the following aggregation options are supported o BLOCK keeping the the recent value persistent until a new value is specified o LINEAR conducting a linear interpolation of the control variable between two instants at which it is defined by the optimization algorithm Deltares 27 3 3 2 RTC Tools Reference Manual Constraints RTC Tools take
17. 1 Deltares iii RTC Tools Reference Manual 25 8 PolyogonLookup lt lt i aoa nennen ren 21 a GEE A mli ee a Kit ea ee da er Sa ST JP es E 21 2 5 5 spreadsheet o ee ee 21 2500 SANOA oe ek a ae a a ne ARA 22 car BAGBAG sen 126 a eee wt el ae si Kes ee mat 22 Optimization components 25 3 1 Introduction and deterministic optimization setup 25 3 2 Multi stage stochastic optimization setup 26 3 3 Set up of the optimization problem 0 27 3 3 1 Controlvarables lt lt lt 234 ka 00 ikea ER NAE WG 27 332 CONSTRAINS 3 sarace ee A BME 28 3 3 3 Cost function terms AA 29 34 Adieintmodels 2 224 e be bet a masta mare Bp eas 29 References 33 Configuration 35 A 1 Model setup in KML 200 0200 002 eee ee eee 35 A 2 Initial conditions state handling boundary conditions 35 A 3 Command line options a 36 A 4 RTC Tools in Delft FEWS CL aaa 36 A 5 RTC Tools in OpenMl lt lt nA 36 ASI Iniroduction lt a N RT UE sin 37 A52 The OMbfile lt ocara aa kon lt lt knn KANG 37 A 5 3 OpenMI exchange items se 37 Errors and unexpected results 41 B 1 Time series from expression components used in triggers give unexpected FESTE ey ae ne Rs ok n an UG s hke e oi A See te ne a ee ae an E 41 B 2 Values from an import time series do not appear in the result file 41 B 3 Index not found in time series Model 2 2 2m nm a 42 B 4 Instance docum
18. Leeuwe P498 lt elementId gt lt quantityId gt water level lt quantityld gt lt unit gt m lt unit gt lt OpenMIExchangeltem gt lt timeSeries gt lt timeSeries id Bergum_P499 H gt lt PITimeSeries gt lt locationId gt Bergum P499 lt locationId gt lt parameterId gt H lt parameterld gt lt interpolationOption gt BLOCK lt interpolationOption gt lt PITimeSeries gt lt OpenMIExchangeltem gt lt elementId gt Bergum P499 lt elementId gt lt quantityId gt water level lt quantityld gt 38 Deltares Configuration lt unit gt m lt unit gt lt OpenMIExchangeltem gt lt timeSeries gt lt importSeries gt lt exportSeries gt lt CSVTimeSeriesFile gt lt timeSeries id gemiddeldeBoezempeil out gt lt OpenMIExchangeltem gt lt elementId gt gemiddeldeBoezempeil lt elementId gt lt quantityId gt water level lt quantityld gt lt unit gt m lt unit gt lt OpenMIExchangeltem gt lt timeSeries gt lt exportSeries gt lt rtcDataConfig gt Deltares 39 RTC Tools Reference Manual 40 Deltares B 1 B 2 Errors and unexpected results Time series from expression components used in triggers give unexpected results Error description A standard trigger condition evaluates a time series provided by an expression model compo nent section 2 2 2 The trigger reacts unexpected Reason Triggers are always evaluated first in the RTC Tools programme procedure The result of the expr
19. RTC Tools Software Tools for Modeling Real Time Control Reference Manual Dirk Schwanenberg Bernhard Becker Version 1 2 000000 Revision 386 22 July 2014 RTC Tools Reference Manual Published and printed by Deltares telephone 31 88 335 82 73 Boussinesqweg 1 fax 31 88 335 85 82 2629 HV Delft e mail info deltares nl P O Box 177 www http www deltares nl 2600 MH Delft The Netherlands Contact Bernhard Becker Dirk Schwanenberg telephone 31 88 335 8507 telephone 31 88 335 8447 fax 31 88 335 8582 fax 31 88 335 8582 e mail rtc tools deltares nl www http oss deltares nl web rtc tools Copyright O 2014 Deltares All rights reserved No part of this document may be reproduced in any form by print photo print photo copy microfilm or any other means without written permission from the publisher Deltares Contents Contents 1 Introduction 1 1 1 Management of water systems 0A 1 12 Control methods nn sms s badi 8 eh wae le 1 1 2 1 Feedback and feedforward aoao a 1 1 2 2 Model Predictive Control 2 2 22 aa eee ee es 2 1 3 Fields of application a 3 14 Me ac we a a ch 5 1 5 Architecture and supported interfaces L 6 18 Content ok this document o gt lt ba eee ee 2 a d MASK AA 6 2 Simulation components 7 21 TORN ee ee 7 2 2 General purpose components a 8 22 1 SOSUMMIRABOR lt lt Olalla e na een 8 2 22 EXPIESSION lt lt u a a nn 8 2 23
20. a single model execution is the set up of an adjoint model for each modeling component The RTC Tools framework takes care for integrating these models both in the simulation mode as well as the reverse adjoint mode The set up of an adjoint model is outlined for the explicit version of the diffusive wave model presented in section 3 2 1 Consider the mass balance equation given by st ght At Fs 38 1 del 3 12 where s represent the storage at the node of interest and s is the storage at a connected node i and the function f denotes the flow contribution of a flow branch or hydraulic structure A straightforward way for the derivation of an adjoint model of an explicit calculation workflow is the application of algorithmic differentiation in reverse mode It is basically a conseguent Deltares 29 RTC Tools Reference Manual application of the chain rule leading to 2 Of s ty si dat lt k 1 ak 9 Yi S pray GA k 1 ck 1 Jk gb gf L aN 3 13 Si er k 1 k1 Jok ag SON 22G i vd Odg where is the adjoint variable of u We compute the cost function gradient according to the following procedure 1 Model simulation 3 12 for computing all states and dependent variables 2 Initialization of the adjoint variables by the partial derivatives of the objective function ak OJ u x y du with respect to control variables states and dependent vari ables 3 Model execution in adjoint
21. al Figure 2 1 Example flow chart with feedback control General purpose components accumulation The component accumulates an input x to the state y The equation of the accumulation components reads y sy Hat 2 1 expression The expression consists of a mathematical equation of the form y n IVk a 2 2 The following operators are supported summation subtraction multiplication division min minimum max maximum The recursive use of expressions another expression as one of the two terms or for both enables the implementation of more complex mathematical expressions check the example in the configuration section 8 Deltares 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 3 2 3 1 Simulation components gradient The governing equation of the gradient reads W gE yksi 2 3 y ne 2 3 lookupTable The rule supplies a piecewise linear 1D lookup table according to y f a N 2 4 This rule is a simpler version of the dateLookupTable section 2 4 2 lookup2DTable The rule supplies a piecewise linear 2D lookup table according to y jo a s 2 5 mergerSplitter The merger rule provide a simple data hierarchy by choosing the output y egual to the first of several input values 21 2 which is non missing Furthermore additional output includes the sum of all input values unitDelay The unit delay operator is an auxiliary tool for making da
22. arately together with constraints for enforcing a release procedure The related eguations for the spill and turbine flow become k k k k k k k do Orx Quise if QO gt OT x Qsr Ka Qrsc a y 0 L tr Aut 039 o Arm Misc OTmu QSr gt 90 gt Arm 0 else Of x if 06 gt Oh x OSr gk 06 QSr Quisc if Qx zu Qer gt Qo gt m Q r 2 34 QTM E OTM POST Q6 gt ATM Q6 z Qluisc else Finally the power generation of a project is computed by PE fop Qh hf 2 35 The component can handle Sl as well as imperial units The two options are summarized in Table 2 2 16 Deltares 2 3 9 2 4 2 4 1 2 4 2 2 4 3 Simulation components Table 2 2 Units of inputs and outputs of the reservoirCompact component Variable Option 1 SI Option 2 Imperial flows m3 s kefs kilo cubic feet per second elevations m ft feet storage m3 kcfs day kcfs over one day turbine efficiency option 1 MW m3 s MWikcfs turbine efficiency option 2 power MW MW unitHydrograph Unit hydrograph provides a rainfall runoff modeling based on the concept of the unit hydro graph Operating rules and controllers constant This simple rule defines a user defined constant output y according to y const 2 36 It is typically applied in combination with triggers see next section for switching between several predefined states of a structure e g fully opened or fully closed dateLookupTable The date
23. ble branches or scenarios This lead to a reformulation of Seguential MPC approach of Eguation 3 2 as M N 3 j J j k j k N j k E IN F JN 3 IN 34 atin A AA j 1 k 1 where p is the probability of the scenario j 1 M and M is the total number of scenar ios Whereas the disturbance d as well as the model states x and outputs y are treated inde pendently in each scenario the control variable u is the key to the properties of the stochastic optimization approach The most general formulation is achieved by the use of scenario trees One way for its definition is the scenario tree nodal partition matrix P j k with the dimen sions m x n The matrix assigns the control at time step k of scenario 7 to the control vector u This enables us to define a common control trajectory for all scenarios at the beginning of the forecast horizon when future system states are still uncertain When uncertainty gets resolved over the forecast horizon for example when a forecasted precipitation is finally observed we introduce branching points to receive an independent control in each scenario at the end of the forecast horizon Eguation 3 5 presents an example of a nodal partition matrix for a simple tree with two scenarios and a branching point at the second time step 123 4 SE 2 5 J pa The introduction of multiple branching points at several time steps leads to a multi stage stochastic optimization From a technical perspective the solutio
24. claration Add the variables that are needed to the class declaration The class variables need to be fed with values from the file in our case rtcToolsConfig xml o Open the schematization cpp rtc tools deltares n1 2Dirk Schwanenberg dirk schwanenberg deltares n1 Deltares 45 RTC Tools Reference Manual 0 Add the file newModel h to the list of include files Maintain alphabetical order 0 Add code to read the data and assign it to the variables Create a file newModel cpp and add the logic of the new feature 46 Deltares
25. ction provides some hints on choosing the proper model and how to set it up Diffusive wave model The flow in one dimension is described by the De Saint Venant equations consisting of mass continuity and momentum conservation The continuity equation reads DO gi 2 8 while the non conservative form of the momentum equation is defined by Ov Ov Oh v v Et ag 9g 04 2 9 with A wetted area m Q discharge m s Mat lateral discharge per unit length m s m h water level m above reference level v flow velocity m s g acceleration due to gravity m s m hydraulic radius m may be approximated to water depth for large rivers C Chezy coefficient m 2 s cf dimensionless bottom friction coefficient The diffusive wave equations can be derived from the complete system 2 8 2 9 by ne glecting the terms for inertia term 1 and convection term 2 By additional substitution of v Q A equation 2 9 becomes Oh IQQ T OF Alan 2 10 and can be converted to Q sign On CA Ob m 2 11 Ox Ox 10 Deltares Simulation components Figure 2 2 Spatial schematization of the kinematic wave model on a staggered grid The continuity equation 2 8 stays unchanged Under assumption of a representative cross section for a river reach both variables A and m become a geometrical function of water level h By equalizing water level and energy head hydraulic structures are represented by a s
26. de The discharge in a flow branch is schematized based on eguation 2 11 by k k Men Ni Ax k 1 k k hk u hE Lk Tk Q m F hdown Rup sign Ke 2 C h A h m hk 2 17 in which Ak P own trip In a branch with a hydraulic structure the flow branch is replaced by the formula of the hy draulic structures modeled by an arbitrary equation in the form QU Fhdoun hup dg 2 18 Stability of this method turns out to be reasonable as long as the Courant Friedrichs Lewy CFL condition is fulfilled Kinematic versus diffusive wave routing The fact that the diffusive wave model takes into account more terms of the full dynamic Saint Venant model does not mean that it is always preferred over the simpler kinematic wave approach Simplicity and computational performance of the latter may have advantages in particular if results of both approaches are the same e g in river reaches with steep gradients The following aspects may guide you to the proper approach Is the slope of your river reach smaller than TODO xxx Is backwater a relevant effect you need to consider Do you want to consider hysteresis If you answer one of these questions with Yes consider the diffusive wave approach Oth erwise you may try the kinematic wave method first Note that you can mix both methods by defining the related tag in each flow branch Model set up The spatial schematization of your routing networ
27. dforward control Figure 1 1 Feedback control and feedforward control Schuurmans 1997 1 2 2 Model Predictive Control While feedback control means to operate a water system based on the current state of the system model predictive control MPC predicts future state trajectories e g for anticipating on approaching flood events within current control actions This reguires internal modelling of the controlled water system for assessing and optimizing the impact of control actions on the system and its control performance While in Figure 1 1 the operaters base their decision on the current system state the operator in Figure 1 2 takes also the future behaviour of the water system into account Figure 1 2 Model predictive control Schuurmans 1997 2 Deltares Introduction 1 3 Fields of application The RTC Tools package aims at the simulation of various real time control and decision sup port technigues in application to water resources systems It includes feedback control strate gies with triggers operating rules and controllers as well as advanced Model Predictive Con trol MPC setups based on a combination of forecasting and optimization The MPC based predictive control strategies reguire internal modeling of the controlled water system in the optimization procedure Therefore the package includes a number of simple hydrological and hydraulic models as well as various other simulation components for setting up wate
28. em definition in Matlab or GAMS Content of this document Section 2 3 provides background on the modeling components governing equations and its numerical schematization Section 2 4 and 2 5 covers the hierarchy of triggers and controllers operating rules for setting up reactive control of a water system In chapter 3 we present the concept of Model Predictive Control MPC Details on the configuration of RTC Tools in xml are discussed in Appendix A 6 Deltares 2 Simulation components 2 1 Overview Modelling components in RTC Tools represent water resources systems and cover the sim ulation of rainfall runoff and routing based on physically based conceptual or data driven approaches Hydraulic structures in these components can be controlled by i operating rules and controllers in combination with triggers or ii by predictive control techniques The first option is based on simulation as well so that the triggers operating rules and controllers become part of an overall simulation model The configuration of RTC Tools distinguishes three layers for 1 triggers 2 operating rules and controllers and 3 modeling components Table 2 1 This chapter covers all three layers of simulation components 1 3 as well as general purpose simulation components such as the lookup table which are used in more than one layer According to our definition a trigger implements conditions for defining when an operating rule contro
29. ent parsing failed se 43 Programming in RTC Tools draft version 45 Cl FIEBER ee 805 205 K ee a S os dn a NG DR PG ee 45 C 2 Implementing a new feature to RTC Tools 2 2 2 onen 45 Deltares 1 1 1 2 1 2 1 Introduction Management of water systems Water management means to operate a water system in such a way that it meets one or multiple objectives for example drinking water supply navigation irrigation water supply environmental flow hydroelectricity production flood protection 0000 0 0 Stakeholders implement the management by taking control of hydraulic structures such as weirs pumps hydro turbines or water intakes In this context real time control RTC refers to the automation of hydraulic structures in water systems whereas decision support suggests a control and leaves it over to the operating staff to implement it or not RTC Tools Real Time Control Tools is an open source modular toolbox dedicated to the simulation of real time control and decision support of hydraulic structures It can be used standalone or in combination with hydraulic models for general modelling studies as decision support component in operational forecasting and decision support systems for example for drought management water allocation flood mitigation or the dispatch of hydro power assets as a real time control component in SCADA systems supervisory control and data ac guisition systems in which
30. ession component time series is not available for the trigger Possible solutions o Usea trigger of type expression section 2 5 7 o Define the input time series explicitely lt x1Series ref EXPLICIT gt The trigger will use the expression result from the previous time step Values from an import time series do not appear in the result file Error description Values of a time series from the timeseries import xml do not appear in the result file timeseries 0000 csv The column header is present but the column is empty Possible reasons The time series is not referenced to in the file rtcDataConfig xml under lt importSeries gt o The begin and end time properties lt startDate gt and lt endDate gt in the time series header lt header gt do not match the simulation time properties given in rtcRuntimeConfig xml No extrapolation and interpolation options are given in rtcDataConfig xml o Acombination of lt locationId gt and lt parameterId gt is used twice in rt cDataConfig xml The simulation runs under OpenMI and the attribute TimeSeries xsi schemaLocation directs to a location that is not valid for example badFolder pi_timeseries xsd Solution Check the list above and adjust the configuration accordingly When using OpenMI change the schema location path attribute TimeSeries xsi schemaLocation in such a way that it points towards a valid location by preference to the location of the binarie
31. for flooding and drying violating this condition may result in negative water depth at nodes and problems with robustness If you use the upwind schematization together with the level storage relation derived from it this condition is already fulfilled Flow branches require a cross section You may again aim at deriving an aggregated cross section from the available data of the branch The simpler approach is again the selection of a typical cross section Depending on the spatial schematization see 3 4 3 select a typical cross section close to the upstream node for the upwind option and one halfway along the branch for the central option hydrologicalModel This model is currently under development lorentGrevers This model is currently under development neuralNetwork We use a recurrent neural network formulation given by the following equations for the sum of neuron u and the nonlinear transfer function p 1 k _ unger ok neuron ako 14 tu k Yu vt gt Ea v 1 2 19 k Ty hy ad where ak is the value of neuron v at time step k VR is the weighted sum of inputs to neuron u at time step k Was is the weighting given to neuron v when calculating the sum for neuron p wp is the weighting given to input v when calculating the sum for neuron p uk is the value of input v at time step k K is the number of neurons L is the number of inputs hu is the activation function for neuron 4 Note that the for u 1 the first
32. gedient lt A 6 nur eaa aa a MA KG 9 224 look plable lt 2 7 20 Rd we eS we wae re Be 9 223 INN DR gt i ess a ae a ec a ae ka 9 226 mergerSpliter lt lt a a ee 9 2 27 OSIN lt lt lt e Cope Ka kul bee ee G Xe p i 9 2 3 Modeling components me 9 Lal NA es 2 ane der anan snk ee a a RAA KOE eS 9 292 GO cria Ee ee NG ee SURIN A a a 10 233 hydraulicModel lt ia ks Rox be eee a 10 2331 NUON 1 1202 000 dP e ed oe 10 2 3 3 2 Diffusive wave model o 500 10 2 3 3 3 Kinematic versus diffusive wave routing 12 2 3 3 4 Model set up o e een 12 2 3 4 hydrologicalModel 0 o eee een 13 2 3 5 loreniGrevers 04 sun na nn ne an anna 13 238 neuralNelwork lt 22822 22208 a ade aa 13 Bad WSSBIEIF ci Be ee kann a da O 14 2 3 7 1 Mathematical model 14 2 3 7 2 Numerical schematization 14 20 8 TOSEPDIOOMPACE lt 1 ea eld Fehr ae 15 23 9 UNICO pha BAKLA ee a ee 17 2 4 Operating rules and controllers se 17 24 1 ULAP 17 2 4 2 dateLookupTable 2 17 2 4 3 deadBandValue KVL 17 244 GNOSSANA o es sece 10 bee eae ed ak 18 EO IMEE errea a Na KA KA sil LAN Goa a KALA NA 18 ZAIR A ee 19 247 DR a ra a Ad ew Be X Ob eee 19 24 8 timeAbsolute a u s 06 005 808 aa a AG 20 2 49 timeRelative L 20 20 GETS 0 en a ee e AA 20 231 Gib re me sad A met rer 20 252 deadBandlime a lt p gt ee A a ON KG RE 2
33. he input exchange items In this example the RTC Tools model gets time series data via OpenMI or from a Delft FEWS PI time series from the file timeseries import xml If RTC Tools runs under OpenMI priority is given to OpenMI this means that data from OpenMI overwrites data from the Delft FEWS PI time series file If the model does not run under OpenMI the data from the Delft FEWS PI time series file is taken So this RTC Tools model can also run standalone this is useful to identify bugs in the RTC Tools model Output data is both provided as OpenMI exchange item and written in the standard csv output file lt xml version 1 0 encoding UTF 8 gt lt edited with XMLSpy v2012 rel 2 spi http www altova com by zws 2 Stichting Deltares gt lt rtcDataConfig xmlns xsi http www w3 org 2001 XMLSchema instance xmlns rtc http www wldelft nl fews xmlns http www wldelft nl fews xsi schemaLocation http www wldelft nl fews xsd rtcDataConfig xsd gt lt importSeries gt lt PITimeSeriesFile gt lt timeSeriesFile gt timeseries_import xml lt timeSeriesFile gt lt useBinFile gt false lt useBinFile gt lt PITimeSeriesFile gt lt timeSeries id Leeuwe_P498 H gt lt PITimeSeries gt lt locationId gt Leeuwe P498 lt locationId gt lt parameterId gt H lt parameterld gt lt interpolationOption gt BLOCK lt interpolation0Option gt lt PITimeSeries gt lt OpenMIExchangeltem gt lt elementId gt
34. ime or provided by a time series e g from an external input or a result from the execution of a prior rule A typical application of the rule is the enforcement of a reservoir storage s between a cer tain range and the use of the available storage for equalizing the release If the storage is approaching or down crossing the lower storage limit Smin the release is set to the minimum flow zero is no minimum flow is defined If the storage is approaching or up crossing the upper limit Smax the release is set to maximum capacity interval The interval controller is a simple feedback controller according to the control law Ymax f rT gt sph 5D ysi Ymin fa lt sp 5D 2 40 yht otherwise where x is an input variable sp is a setpoint D is a dead band around the setpoint and y is the controller output 18 Deltares 2 4 6 2 4 7 Simulation components limiter In contrary to the deadBand rule defined above the discrete limiter rule restricts the change of a variable to a relative threshold p It reads 1 p a if z 1 ps y lt 1 p a if z gt 1 p x 2 41 a otherwise where p is the maximum relative rate of change The configuration also accounts for an absolute rate of change according to the condition x lt Apx where Ap is the absolute rate of change Atypical application of the rule is the limitation of release changes from a reservoir for avoiding too steep flow gradie
35. implified structure formula with the general form Q f hup hdown dg 2 12 in which dg gate or weir setting in case of a controlled structure The hydraulic structures are modeled by the following formulas for a weir and an orifice with fully opened gates ws 29 h Z8 if Pup 2s gt 3 down 725 Q 2 13 Ws Ndown 25 2g hup hdown otherwise in which ws width of the structure zs crest level In the case of a partially or fully closed gate hup 2s gt 5dg we apply o fwe dg 29 hup zs udg if haown lt Zs dg 7 Wohl dg 28 hp hdown otherwise 2 14 in which dg gate setting yy contraction coefficient The spatial schematization of the kinematic wave model is done on a staggered grid Com putation nodes include the state variable storage s Branches always connect two nodes and include the auxiliary variable discharge Q a major difference to the full hydraulic model where Q is another state variable The numerical solution of the continuity equation 2 8 is resulting in k 1 A h 1 A h i x SE O get At Az lat 2 15 By substituting s h A h Az we may transform equation 2 15 into a water balance in the domain of a node and get SHET s h AQU Qum QI er down Deltares 11 2 3 3 3 2 3 3 4 RTC Tools Reference Manual in which s storage at a node state variable Qj is the total lateral inflow into the domain of the no
36. k is a trade off between accuracy a higher resolution means more accuracy and CPU time For flow routing purposes only already a very course spatial schematization may achieve the reguired accuracy from the control point of view We recommend the following procedure for defining your routing network 1 Indicate all nodes you need to include boundary conditions upstream and downstream node of hydraulic structures stream flow gauges bifurcations and confluences nodes with lateral inflows or extractions can be also lumped into neighboring nodes 2 Place additional nodes between the existing ones if reguired for accuracy All nodes reguire a level storage relation One way to get those is a detailed analysis of the surrounding channel network typically halfway to the next node in terms of the area 12 Deltares 2 3 4 2 3 5 2 3 6 Simulation components and storage at different elevations An easier and often sufficient option is the selection of a typical cross section at the node and its multiplication by the length of the reaches around If you selected the upwind schematization see section 3 4 3 take the cross section you are using in the flow branch If you routing network includes flooding and drying take care that the lowest level of your level storage table or equation in your node is lower than the lowest elevation in the cross sections around Since the model implementation does not include any dedicated procedure
37. ler or rule 20 Deltares 2 5 2 2 5 3 2 5 4 2 5 5 Simulation components deadBandTime The dead band time trigger checks a time series for a number of subsequent up crossings Nup Or down crossing Ndown from its current value If the crossing is observed for at least the user defined number of time steps the new value is used The trigger reads ah fg et eh gt at gk ar if ah ndownt hh lt rf down 2 49 a 1 otherwise An application for this trigger is the activation or deactivation of alarm levels The increase of alarm level may happen immediately nup 0 whereas the decrease of an alarm level could be done only after a number of n time steps have passed ngown N without further threshold crossings polygonLookup The polygon lookup trigger checks if a point is inside of a set of polygons If this is the case it returns the user defined value of the specific polygon The point is defined by the values of two time series referred to as the x and x2 coordinate of the point The rule reads Y if af 1VR R 1Vk EP k 1Vk 1Vk 2 50 Yn ila a ech Yde fault otherwise where y is the result of the rule and P Pa is a set of polygons Figure 2 5 presents an example for the application of the trigger to the definition of warning level for controlling a lake release in Canton Bern Switzerland set The trigger enables a logical combination of other triggers combined by a logical operator
38. ller or another trigger is applied returning true or false e g if a threshold is crossed or not Operating rules and controllers define how a structure operates o return a value for a control parameter e g a gate opening or turbine release which is picked up in one of the modeling components The combination of triggers with operating rules and controllers may form binary decision trees such as given in Figure 2 1 for representing hierarchical conditions leading to unigue control actions From a mathematical point of view all features in this chapter compute their outputs from available data either from the previous time step k 1 or from output of previous components of the same time step k Note that triggers always are evaluated first before rules and modeling components Table 2 1 Layers of triggers operating rules controllers modeling components and gen eral purpose components available in more than one of the layers mentioned before Triggers Rules Controllers Modeling Components General deadBand constant arma accumulation deadBandTime dateLookupTable hbv expression polygonLookup deadBandValue hydraulicModel gradient set guideBand hydrologicalModel lookupTable spreadsheet interval lorentGevers lookup2D Table standard limiter neuralNetwork mergerSplitter pid reservoir unitDelay timeAbsolute reservoirCompact timeRelative unitHydrograph Deltares 7 2 2 2 2 1 2 2 2 RTC Tools Reference Manu
39. lookup table is a 2D lookup table with the time axis as one of its dimensions lts discrete form reads y f t 2 1 2 37 The resolution of the time axis t is in days of the year The value axis x may have any range A typical application of the rule would be the definition of a minimum release of a reservoir as a function of the day of the year and the water level of the reservoir deadBandValue The dead band value rule is a discrete rule for suppressing the output of another rule until its rate of change becomes higher than a certain threshold It reads z a 2 38 k art if l k x lt threshold x otherwise It is often applied to limit the number of adjustments to movable elements of hydraulic struc tures in order to increase their life time Deltares 17 2 4 4 2 4 5 RTC Tools Reference Manual Ymax Ymin X min X max Figure 2 3 Graphical representation of guideBand rule guideBand The guide band rule provides a linear interpolation from input x to output y if x is between two input threshold nin and max Otherwise the output is limited to defined minimum and maximum output threshold ymin and y The rule reads Ymin aa lt Tmin k Ymi k 1Vk YES Ymin nem if tin lt 7 lt Tmax 2 39 Ymax Tmax lt gh ive A graphical representation of the rule is presented in Figure 2 3 The input and output thresholds Tmin max Ymin Ymax CAN be constant a function of t
40. mode 3 13 in reverse order with respect to the time loop and the execution of subsequent modeling components After conducting the steps above the resulting adjoint variables represent the total derivatives of the cost function d J u x y du i e the cost function gradient The computation of the constraint Jacobian is similar The following procedure holds for a single constraint at a specific time step k 1 ditto once for all constraints 2 Initialization of the adjoint variables by the partial derivatives of the constraint ak Oh u x y d du with respect to control variables states and dependent variables 3 Model execution in adjoint mode 3 13 over N time steps which contribute to the non zero Jacobian entries of the specific constraint Adjoint systems are still not implemented for all available components in RTC Tool An overview about the status of implementation is given in Table 3 2 30 Deltares Optimization components Modeling components Table 3 2 Implementation status of adjoint models Adjoint available Comments accumulation yes arma yes expression yes gradient yes hydraulicModel yes implementation is only available for the ex plicit scheme implicit scheme will become available soon hydrologicalModel no merger yes neuralNetwork yes N reservoir yes reservoirBPA yes N unitDelay yes unitHydrograph yes Rules all no the adjoint of smo
41. ms can be set up either in a sequential or simultaneous way Furthermore both methods can be mixed leading to the so called multiple shooting approach The choice depends on the setup of the specific modelling components For example the pool routing in a reservoir can be configured in such a way that the control variable is the release only and the reservoir level is a result of a simulation Alternatively the optimizer may provide both release and reservoir level for computing the mass balance residuum which becomes an Deltares 25 3 2 RTC Tools Reference Manual Table 3 1 Model predictive control features implemented in RTC Tools Optimizer MPC problem definition IPOPT embedded constraints MINOS Matlab TOMLAB min max bounds and rate of change limits SNOPT Matlab TOMLAB for optimization variables system states outputs cost function terms rate of change with variable exponent absolute with variable exponent several performance indicators equality constraint of the optimization problem It is obvious that the first setup corresponds to the seguential 3 2 the second one to the simultaneous approach 3 3 Multi stage stochastic optimization setup The extension of the deterministic to a stochastic optimization is achieved by replacing the single trace forecast by a forecast ensemble and computing the objective function values J and E as the probability weighted sum of the objective function terms of the individual ensem
42. n component in section 2 2 2 But since trig gers are evaluated before components within the time step simulation it can make sense to use the expression trigger instead of an expression component in order to prepare data of the current time step 29 Deltares Simulation components 5 Mabuawssnynz Gunvabiais WY ebauoyBundmesuspon WY J usbuewissnynz HYH Mabuwswssnynz Sunbird wy wsbauoyBun gesuspog Hy usBuawssnynz Wy Figure 2 6 Spreadsheet for combining alarm levels Lake Thun Canton Bern Switzer land 23 Deltares RTC Tools Reference Manual 24 Deltares 3 Optimization components 3 1 Introduction and deterministic optimization setup We consider a discrete time dynamic system according to ak f a ak ur df k k k yk 3 1 y g x u d where x y u d are respectively the state dependent variable control and disturbance vec tors and f g are functions representing an arbitrary linear or nonlinear water resources model If being applied in Model Predictive Control MPC 3 1 is used for predicting future trajectories of the state x and dependent variable y over a finite time horizon represented by k 1 N time instants in order to determine the optimal set of controlled variables u by an optimization algorithm Under the hypothesis of knowing the realization of the disturbance d over the time horizon i e the trajectory ay a Sequential MPC approach also refer
43. n of the multi stage stochas tic optimization Equation 3 4 is very similar to the solution of the deterministic setup of Equation 3 2 The main difference is the number of dimensions of the optimization prob lem According to our experience it is typically increasing by a factor of 5 20 if we derive the scenario tree from a meteorological ensemble forecast 26 Deltares 3 3 3 3 1 Optimization components The extension of the Simultaneous MPC approach to a multi stage stochastic optimization is idetical to the one of the sequential approach presented above An addition is the handling of hard constraints on system states and outputs These are executed independently on every branch of the tree Set up of the optimization problem Control variables The setup of the optimization problem starts with the definition of the input variables of the op timizer i e the control u in the seguential setup as well as the optional state x and dependent variable y in the simultaneous setup Each variable can be of the types o CONTINUOUS representing a continuous variable o INTEGER representing an integer variable Note that there is still no RTC Tools internal solver supporting Mixed Integer Nonlinear Programming MINLP therefore this options depends on interfacing a suitable solver via the Matlab or GAMS interfaces TIMEINSTANT for the setup of a Time Instant Optimization MPC TIO MPC experimental version The optimization
44. nMI argument keys for RTC Tools models argument key description modelDirectory Relative or absolute path from the location of the omi file to the directory of RTC Tools input file MissingValue If this value is provided to RTC Tools via the Get Values method RTC Tools will treat it as not existent OpenMiTimeStepSkip 1 means data exchange at every RTC Tools time step 2 means data exchange every second time step and so on The default value is 1 SchemaLocation The relative path from the location of the RTC Tools model di rectory to the directory with xsd schema definition files If this argument key is not given RTC Tools looks for the xsd files in the RTC Tools work directory where the xml files are located OpenMI exchange items OpenMI exchange items are interpreted as an alternative to pre defined time series e g a Delft FEWS PI time series in timeseries import xml Consequently OpenMI input ex change items and OpenMI output exchange items are defined in the file rt cDataConfig xml In the example below the following exchange items are defined Deltares 37 RTC Tools Reference Manual input exchange items import time series o water level at Leeuwe P498 o water level at Bergum P499 output exchange item export time series o gemiddeldeBoezempeil This RTC Tools model runs connected with a SOBEK model so the corresponding node in the SOBEK model schematisation has been added to the elementld of t
45. nts downstream pid The Proportional Integral Derivative controller PID controller is a generic feedback controller including an optional disturbance term commonly used in industrial control systems It reads e t x t splt 2 42 y t Kpe t pa an mar Ka eli e t Kyd t om where e t is the difference between a process variable x t and a setpoint sp t Kp Ki Ka are the proportional integral and derivate gains respectively the optional feed forward term consists of a multiplicator K and an external disturbance d t y t is the controller output The discrete form of equation 2 42 in RTC Tools reads gil pl k mka k E E Ate 2 43 k k k ek ek k Y Kye K E a rr Krd where EF is the integral of e The implentation includes a limitation of the maximum velocity according to 1 AIN paa if yf lt 1 KEN aan y AA ify AA 2 44 y otherwise Furthermore the integral part is corrected by a wind up correction according to sk pk 1 Ymax Kyo K E Ken Kyd eI lt Ki 2 45 ejk gt Ymin Kyek K Ek Katze Kd gt K if the minimum and maximum settings of the actuator are met Deltares 19 2 4 8 2 4 9 2 5 2 5 1 RTC Tools Reference Manual ETUAAN EE AINIIN active path active path control PEE IA Figure 2 4 Hierarchical definition of deadBand and standard triggers timeAbsolute This rule reads yh ak 2 46
46. or file required io in memory data exchange etc rtcObjectiveConfig xml definition of the optimization problem including the optional control variables constraints and cost function terms rtcParameterConfig xml set of externalized parameters for modification in optional external applications such as Delft FEWS or Mat lab rtcRuntimeConfig xml definition of runtime relevant info time step size required simulation time file names if deviating from stan dard naming convention run mode simulation optimization etc logging information etc rtcScenarioTreeConfig xml definition of a scenario for the Tree Based MPC optional option rtcToolsConfig xml RTC Tools schematization including the modeling required components rules and controllers as well as trig gers of the model All configuration files are expected in the same working directory We highly recommend to validate all XML files against the corresponding XSD schema definitions during the model setup We suggest using validating XML editors such as XMLSpy http www altova com xml editor XML Notepad http xmlnotepad codeplex com or oXygen http www oxygenxml com The most efficient way to explore configuration options is to check the XSD schemas in an editor such as XMLSpy Alternatively the configuration options are documented in rtf pdf format in the separate configuration manual A 2 Initial conditions state handling boundary conditions The primary file in
47. oth rules such as the PID controller may become implemeneted in the future for modeling mixed systems with MPC and feedback control Triggers all no triggers switching on external input will be supported in the future Deltares 31 RTC Tools Reference Manual 32 Deltares 4 References Becker B 2013 Inzet RTC Tools voor het boezemmodel Wetterskip Frysl n Report 1205773 000 Deltares Delft In Dutch 37 Becker B P J D Schwanenberg T Schruff and M Hatz 2012 Conjunctive real time control and hydrodynamic modelling in application to Rhine River In Proceedings of 10th International Conference on Hydroinformatics TuTech Verlag TuTech Innovation GmbH Hamburg Germany 37 Gregersen J P Gijsbers and S Westen 2007 OpenMI Open modelling Interface Journal of Hydroinformatics 9 3 175 191 3 Schuurmans J 1997 Control of Water Levels in Open Channels Ph D thesis Technische Universiteit Delft 1 2 Schwanenberg D B Becker and T Schruff 2011 SOBEK Grobmodell des staugeregelten Oberrheins Report no 1201242 000 2WS 0014 Deltares In German 37 Deltares 33 RTC Tools Reference Manual 34 Deltares A Configuration A 1 Model setup in XML The RTC Tools schematization is specified in a set of XML files according to Table A 1 Table A 1 RTC Tools configuration files File Content Use rtcDataConfig xml time series definitions interface definitions f
48. put and output formats of RTC Tools for time series and model states are the Delft FEWS PI XML formats pi timeseries xsd pi_state xsd and the OpenDA treeVector xsd format The user is responsible to supply the initial condition of a model run in the file state import xml according to the OpenDA treeVector xsd format Note that no further meta data about date and time of the state is reguired since the run period of the model is already defined in the runtime settings check above The state export xml is generated by RTC Tools and includes the state of the last time step again in the OpenDA treeVector xsd format and meta information for Delft FEWS for picking it up in the statePI xm1 file described in pi state xsd Deltares 35 A 3 A 4 RTC Tools Reference Manual Import and export time series comply with the PI XML format pi_timeseries xsd Both version of the format are supported i pure XML ii a combination of XML and binary files more efficient but less readable The time series of the PI XML XML file are linked to the time series in the RTC Tools see file rtcDataConfig xml by the unique combination of locationld parameterld and ensemblelndex Command line options RTC Tools expects the XSD schemas in the directory of the binaries Furthermore it assumes its working directory in the folder from where it is executed Both assumption can be overruled by the following command line options o schemaDir lt path to
49. r resources models The model implementation reflects the requirements of the opti mization procedure by supplying both a simulation mode and an adjoint mode for computing first order model derivatives Having in mind its application in operational forecasting systems the software pays special attention to state handling This includes by definition the system states of all existing components such as triggers controllers operating rules and modeling components RTC Tools is designed for stand alone use or serves as a building block in a larger system architecture We pay special attention to various interfaces for integration it into frameworks such as Delft FEWS Matlab or OpenDA Furthermore the OpenMI interface enables its on line coupling to a wide range of hydraulic modeling packages The following examples present three typical applications of RTC Tools Stand alone use as a forecasting model in Delft FEWS Assume we reguire a forecasting model for a medium sized river basin including an HBV style conceptual rainfall runoff model a simple hydraulic routing components and the in tegration of several controlled flood detention polders Although many other models sup ply the reguired features the application of RTC Tools can be advantageous because it enables the complete representation of the system in a single model Figure 1 3 and integrates seamless into Delft FEWS with a minimum configuration effort and a maximum of interaction
50. red to as Single Shooting can be formulated as follows N min J amp u d JE uf E EN u d JY aN ain ICAA sd Tu a subject to h u d 7 u d lt 0 k 1 N where 7 u d y are the simulation results J is a cost function associated with each state transition E is an additional cost function associated to the final state condition and h are hard constraints In the corresponding simultaneous or collocated optimization approach the states x become additional variables of the optimization problem and the process model 3 1 gets an eguality constraint of the optimization problem according to Jar ElaN yN ul vin yu El subjectto h x y u dF lt 0 k 1 N 3 3 a fatal x ur af 0 yh g a u d 0 Both methods lead to identical solutions but have pros and cons for specific optimization problems in terms of runtime performance The sequential approach 3 2 is more efficient if hard constraints are defined on the control variables u only and gets inefficient for hard constraints on states x Because of the state dependency on all prior control variables u the constraint Jacobian becomes dense in the lower trianglar matrix In this case the simultane ous approach 3 3 shows better efficiency since states become an input of the optimizer and the constraint Jacobian gets sparse RTC Tools does not strictly distinguish between one and the other approach In fact opti mization proble
51. s bin pi_timeseries xsd Deltares 41 B 3 RTC Tools Reference Manual Error description Some output variables are missing in the result file timeseries_0000 csv although they are listed in the file rtcDataConfig xml under lt exportSeries gt Possible reasons o The export time series is defined twice as import and as export time series Possible solutions The limited memory option is switched on in rtcRuntimeConfig xml Set it to false lt mode gt lt simulation gt lt limitedMemory gt false lt limitedMemory gt lt simulation gt lt mode gt Index not found in time series model Error message The file diag xml says int main int argc char argv error int timeSeriesBasics getScalarIndex string s index not found in time series model No name is given for the time series RTC Tools can not find Reason RTC Tools looks for a time series with an empty name which it cannot find in rt cDataConfig xml Possible solution Look for incomplete items where RTC Tools writes output for in the file rt cToolsConfig xml and specify an output time series Make sure that the time series names appear in the file rtcDataConfig xml under lt importSeries gt Do not specify a time series without name in rtcDataConfig xml Examples for incomplete items are given below Example 1 the time series where the status of a standard trigger is to be written is empty lt output gt lt status gt lt
52. s into account constraints in two ways i as a soft constraint in the objective function or ii as a hard constraint This section covers the definition of hard constraint either as an inequality constraint or equality constraint of the optimization problem The next section provides more details on the definition of soft constraints and the objective function in general Hard constraints are available for control variables states or dependent variables In all cases the entity may have bounds and a maximum rate of change according to k Umin SU lt Umax 3 6 Amin ayo yt lt A Umax n k N k 1 where N is the number of time steps of the rate of change constraint looking back in time The definition of constraints on control variables is straightforward both in the sequential and simultaneous optimization setup and requires no additional information Constraints on states and dependent variables is only efficient in the simultaneous setup and require information on how these are traced back to optimization variables This includes the definition of the related optimization variables the modeling components involved and the number of time steps looking back in time Example 1 Consider a reservoir represented by the mass balance equation below in simultaneous opti mization mode represented by pag NOE ES 3 7 out where r is the residuum of the mass balance s and Oot are the two optimization variables for reservoir storage and
53. ta from time steps prior to the previous time step available in the simulation By using this operator we can refer to a historical release for example in an operating rule without abandoning the restarting features of the model based on the system state of a single time step It reads yt ak 2 6 Modeling components arma The arma model just an ar 1 model at the moment reads k E Gs if a is available e Cae otherwise 2 7 k k k Y Tsim e where Tops is an external observation sim a simulation e is the difference between obser vation and simulation Car is the auto regression coefficient Deltares 9 2 3 2 2 3 3 2 3 3 1 2 3 3 2 RTC Tools Reference Manual hbv This model is currently under development hydraulicModel Introduction Hydraulic routing compared to the hydrological routing techniques presented above is amore accurate approach and may include the simulation of hysteresis and backwater effects On the other hand hydraulic routing has more demands with respect to the numerical solution computational effort and may become unstable if not properly implemented and set up RTC Tools includes a hydraulic routing method based on a mixed kinematic and diffusive wave approach The most relevant decisions to make are the choice of an appropriate routing kinematic diffusive spatial schematization central upwind and time stepping scheme explicit implicit The following se
54. usp or lower branch u lt usp of the value range primarily for implementing a soft constraint on a variable up crossing or down crossing a threshold a 3 10 rate of change difference of two subsequent values T a J wY fut ul usp 3 11 k 1 where u is either a control state or dependent variable w is a weighting coefficient and Usp is an optional set point for the rate of change The latter is again primarily used within soft constraints in combination with the neglection of the upper branch u u gt Usp or lower branch u uk lt usp of the value range Furthermore additional objective function terms of arbitrary types can be defined in Matlab Adjoint models Gradient based solvers of the Sequential Quadratic Programming SQP or Interior Point IP types require the gradient vector of the cost function dJ x u du and the constraint Jacobian dh x u du for performing efficiently The computation of these first order derivatives by numerical differentiation is a straighforward approach but requires at least n nnz 1 model execution for an optimization problem of n control variables and nnz non zero entries in the constraint Jacobian It becomes computationally inefficient for several hundreds or thousands of dimensions and disqualifies the approach from being applied in an operational setting A significantly more efficient method for computing the derivatives at computational costs in the order of
55. xtended in 2009 and beyond This includes the implementa tion of simplified hydraulic models such as the kinematic wave or diffusive wave models as additional internal model for the predictive controller as well as the introduction of adjoint sys tems for selected modeling components The latter resulted in significant speed ups of these controllers In 2010 the concept of triggers for switching on and off controllers and operating rules was introduced for enabling the simulation of more sophisticated heuristic control schemes The software was redesign in C and enhanced by a C OpenMI DeltaShell wrapper for inte gration into modeling packages such as SOBEK or Delft3D Furthermore the new formats for saving states and externalize parameters were introduced for compliant with OpenDA for implementing automatic calibration and data assimilation applications In 2011 the software has been integrated further into Delta Shell for replacing existing RTC functionality in SOBEK in the context of Deltares Next Generation Hydrosoftware develop ment The decision to release RTC Tools within an open source project has been made in 2012 Deltares 5 1 5 1 6 RTC Tools Reference Manual Delft FEWS integration OpenDA DATools data assimilation for RTC Tools osa 3 real time control on any OpenMI achieving optimum system states compliant modelling package such as SOBEK Delft3D hydraulic structures
Download Pdf Manuals
Related Search
Related Contents
380VDC 6-Lamp Ballast Retrofit Installation and User`s Manual RCA F25649 User's Manual SPV 6 - Lankhaar Techniek Rapport d_`activité 2014-2015 - Site d`aide de l`offre SPIP 20121211-221438(678 KB pdfファイル) Copyright © All rights reserved.
Failed to retrieve file