8 research outputs found

    Using CasADi for Optimization and Symbolic Linearization/Extraction of Causality Graphs of Modelica Models via JModelica.Org

    No full text
    The Modelica language has become a handy modeling tool for multi-domain complex physical systems. Its object-oriented and equation-based approach eases the modeling process to a great extent. Dynamic models which are scripted according to the Modelica standards demand a simulation environment. There are many simulation tools such as OpenModelica, Dymola, JModelica.org, OPTIMICA Studio, etc. OpenModelica and JModelica are two examples of free Modelica-based simulation environments. Dynamic Optimization is also an important aspect in control engineering. JModelica.org, among others, provides support of Dynamic Optimization and it is free. Apart from being freeware, there are many other attractive features in it. Python, which is again free, is the scripting language used in the JModelica.org platform and it is possible to integrate various Python libraries on demand so as to get required functionalities that we seek. Often used Python libraries are Numpy, Scipy, MatPlotLib, etc. The JModelica.org installer installs those necessary packages automatically. More interestingly, JModelica interfaces to CasADi which is a symbolic framework for Automatic Differentiation and Nonlinear Optimization. The JModelica.org-CasADi interface is at our main interest in this report due to two main reasons: (1) it is possible to translate Modelica/Optimica models into a symbolic representation via the JModelica.org-CasADi interface and use the power of CasADi to find Jacobian matrices both symbolically and numerically - this can be used to linearize dynamic models and in particular symbolic Linearization is possible to use in analyzing structural properties of dynamic systems, and (2) CasADi is already interfaced with state of the art nonlinear optimizers (e.g. IPOPT.), integrators (e.g. SUNDIALS.), etc. and consequently, JModelica.org freely inherit those well-known integrators/nonlinear solvers so that we can use them in Python. The report treats three main tasks: (1) interfacing nonlinear optimizers and integrators | like IPOPT, CVODES, etc. - into Python, (2) linearization of Modelica models at a given operating point, and (3) extracting causality of Modelica models. All these objectives are achieved via JModelica.org within its limitations. Most of the content of this report depends on the JModelica.org-CasADi interface. Therefore a good understanding of CasADi is a prerequisite. Chapter 2 gives an introduction to basic symbolic manipulation in CasADi with several examples. Here defining and usage of symbolic expressions and functions are explained. A discussion on how to use built-in optimizers and integrators available in CasADi is given in Chapter 3. Chapters 2 and 3 cover tasks (1) and (2). Several modifications are made in the Python script casadi_interface.py (which is available in the JModelica.org installation directory.) to linearize Modelica models both symbolically and numerically as well as to do structural observability analysis, system decompositions, etc. This is given Chapter in 4. It is assumed that JModelica.org has been installed

    Structural Observability Analysis of Large Scale Systems Using Modelica and Python

    No full text
    State observability of dynamic systems is a notion which determines how well the states can be inferred from input-output data. For small-scale systems, observability analysis can be done manually, while for large-scale systems an automated systematic approach is advantageous. Here we present an approach based on the concept of structural observability analysis, using graph theory. This approach can be automated and applied to large-scale, complex dynamic systems modeled using Modelica. Modelica models are imported into Python via the JModelica.org-CasADi interface, and the Python packages NetworkX (for graph-theoretic analysis) and PyGraphviz (for graph layout and visualization) are used to analyze the structural observability of the systems. The method is demonstrated with a Modelica model created for the Copper production plant at Glencore Nikkelverk, Kristiansand, Norway. The Copper plant model has 39 states, 11 disturbances and 5 uncertain parameters. The possibility of estimating disturbances and parameters in addition to estimating the states are also discussed from the graph-theory point of view. All the software tools used on the analysis are freely available

    Parameter and State Estimation of Large-Scale Complex Systems Using Python Tools

    No full text
    This paper discusses the topics related to automating parameter, disturbance and state estimation analysis of large-scale complex nonlinear dynamic systems using free programming tools. For large-scale complex systems, before implementing any state estimator, the system should be analyzed for structural observability and the structural observability analysis can be automated using Modelica and Python. As a result of structural observability analysis, the system may be decomposed into subsystems where some of them may be observable --- with respect to parameter, disturbances, and states --- while some may not. The state estimation process is carried out for those observable subsystems and the optimum number of additional measurements are prescribed for unobservable subsystems to make them observable. In this paper, an industrial case study is considered: the copper production process at Glencore Nikkelverk, Kristiansand, Norway. The copper production process is a large-scale complex system. It is shown how to implement various state estimators, in Python, to estimate parameters and disturbances, in addition to states, based on available measurements

    Structural observability analysis and EKF based parameter estimation of building heating models

    No full text
    Research for enhanced energy-efficient buildings has been given much recognition in the recent years owing to their high energy consumptions. Increasing energy needs can be precisely controlled by practicing advanced controllers for building Heating, Ventilation, and Air-Conditioning (HVAC) systems. Advanced controllers require a mathematical building heating model to operate, and these models need to be accurate and computationally efficient. One main concern associated with such models is the accurate estimation of the unknown model parameters. This paper presents the feasibility of implementing a simplified building heating model and the computation of physical parameters using an off-line approach. Structural observability analysis is conducted using graph-theoretic techniques to analyze the observability of the developed system model. Then Extended Kalman Filter (EKF) algorithm is utilized for parameter estimates using the real measurements of a single-zone building. The simulation-based results confirm that even with a simple model, the EKF follows the state variables accurately. The predicted parameters vary depending on the inputs and disturbances

    Evaluation of Future Climate and Potential Impact on Streamflow in the Upper Nan River Basin of Northern Thailand

    No full text
    Water resources in Northern Thailand have been less explored with regard to the impact on hydrology that the future climate would have. For this study, three regional climate models (RCMs) from the Coordinated Regional Downscaling Experiment (CORDEX) of Coupled Model Intercomparison Project 5 (CMIP5) were used to project future climate of the upper Nan River basin. Future climate data of ACCESS_CCAM, MPI_ESM_CCAM, and CNRM_CCAM under Representation Concentration Pathways RCP4.5 and RCP8.5 were bias-corrected by the linear scaling method and subsequently drove the Hydrological Engineering Center-Hydrological Modeling System (HEC-HMS) to simulate future streamflow. This study compared baseline (1988–2005) climate and streamflow values with future time scales during 2020–2039 (2030s), 2040–2069 (2050s), and 2070–2099 (2080s). The upper Nan River basin will become warmer in future with highest increases in the maximum temperature of 3.8°C/year for MPI_ESM and minimum temperature of 3.6°C/year for ACCESS_CCAM under RCP8.5 during 2080s. The magnitude of changes and directions in mean monthly precipitation varies, with the highest increase of 109 mm for ACESSS_CCAM under RCP 4.5 in September and highest decrease of 77 mm in July for CNRM, during 2080s. Average of RCM combinations shows that decreases will be in ranges of −5.5 to −48.9% for annual flows, −31 to −47% for rainy season flows, and −47 to −67% for winter season flows. Increases in summer seasonal flows will be between 14 and 58%. Projection of future temperature levels indicates that higher increases will be during the latter part of the 20th century, and in general, the increases in the minimum temperature will be higher than those in the maximum temperature. The results of this study will be useful for river basin planners and government agencies to develop sustainable water management strategies and adaptation options to offset negative impacts of future changes in climate. In addition, the results will also be valuable for agriculturists and hydropower planners
    corecore