Daes, Modelica
Total Page:16
File Type:pdf, Size:1020Kb
Equation-Based Object-Oriented Languages for Acausal Modeling and Simulation Lecture 12a in EECS 144/244 University of California, Berkeley April 17, 2013 David Broman [email protected] EECS Department University of California, Berkeley, USA and Linköping University, Sweden Some of the slides are based OSMC tutorials and contributed by Peter Fritzson (Based on book and lecture nodes), David Broman, Emma Larsdotter Nilsson, Peter Bunus, Adrian Pop, Jan Brugård, Mohsen Torabzadeh-Tari, and Adeel Asghar. Copyright © Open Source Modelica Consortium. 2 Agenda [email protected] Part I Part II EOO Languages for CPS Modelica Overview Platform 1 Physical Actuator Interface Physical Plant 2 Network Physical Platform 2 Interface Sensor Computation 1 Delay 1 Computation 4 Computation 2 Sensor Platform 3 Physical Delay 2 Interface Computation 3 Physical PPhhyyssicicaall Pllannt t1 2 Interface Actuator Part III Part IV OpenModelica Demo Modelyze – a research language Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 3 [email protected] Part I EOO Languages for CPS Platform 1 Physical Actuator Interface Physical Plant 2 Network Physical Platform 2 Interface Sensor Computation 1 Delay 1 Computation 4 Computation 2 Sensor Platform 3 Physical Delay 2 Interface Computation 3 Physical PPhhyyssicicaall Pllannt t1 2 Interface Actuator Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 4 Cyber-Physical Systems (CPS) [email protected] Aircraft Industrial Robots Power Plants Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 5 Modeling and Simulating Cyber-Physical Systems [email protected] Platform 1 Physical Actuator Physical Plant 2 Interface Network Physical Platform 2 Interface Sensor Computation 1 Delay 1 Computation 4 Computation 2 Sensor Platform 3 Physical Delay 2 Simulation with Interface Computation 3 Physical Physical Plant 1 timing properties Physical Plant 2 Interface Actuator Model Various models of computation (MoC) Equation-based model Hardware-in-the-loop Modeling (HIL) simulation Modeling Physical system available? Sensors System Actuators Physical system (the plant) Cyber system: Computation (embedded) + Networking Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 6 Equation-Based Object-Oriented (EOO) Languages [email protected] Domain-Specific Language (DSL) Models and Objects • Object in e.g., Java, C++: • Primarily domain: object = data + methods Modeling of physical Equation-Based systems Object-Oriented • Objects in EOO languages: (EOO) object = data + equations • Multiple physical domains: e.g., mechanical, electrical, hydraulic Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 7 Equation-Based Object-Oriented (EOO) Languages [email protected] Domain-Specific connections! objects (components)! Language (DSL) Models and Objects • Object in e.g., Java, C++: • Primarily domain: object = data + methods Modeling of physical Equation-Based systems portsObject-Oriented! • Objects in EOO languages: (EOO) object = data + equations • Multiple physical domains: e.g., mechanical, electrical, hydraulic EOO model (textual) EOO model (graphical) Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 8 Equation-Based Object-Oriented (EOO) Languages [email protected] Domain-Specific Language (DSL) Models and Objects • Object in e.g., Java, C++: • Primarily domain: object = data + methods Modeling of physical Equation-Based systems Object-Oriented • Objects in EOO languages: (EOO) object = data + equations • Multiple physical domains: e.g., mechanical, electrical, hydraulic • At the equation-level u = R * i Acausality • At the object connection level Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 9 Equation-Based Object-Oriented (EOO) Languages [email protected] Domain-Specific Direction not determined at modeling time! Language (DSL) Models and Objects • Object in e.g., Java, C++: • Primarily domain: object = data + methods Modeling of physical Equation-Based systems acausal (non-causal) Object-Oriented • Objects in EOO languages: (EOO) object = data + equations • Multiple physical domains: e.g., mechanical, electrical, hydraulic • At the equation-levelPhysical topology ! u = Ris * lost i ! Acausality • At the object connection level causal Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 10 Equation-Based Object-Oriented (EOO) Languages [email protected] Domain-Specific Language (DSL) Models and Objects • Object in e.g., Java, C++: • Primarily domain: object = data + methods Modeling of physical Equation-Based systems acausal (non-causal) Object-Oriented • Objects in EOO languages: (EOO) object = data + equations • Multiple physical domains: e.g., mechanical, electrical, hydraulic • At the equation-level u = R * i Acausality • At the object connection level causal Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 11 Equation-Based Object-Oriented (EOO) Languages [email protected] Domain-Specific Language (DSL) Models and Objects • Object in e.g., Java, C++: • Primarily domain: object = data + methods Modeling of physical Equation-Based systems Object-Oriented • Objects in EOO languages: (EOO) object = data + equations • Multiple physical domains: e.g., mechanical, electrical, hydraulic • Modelica • VHDL-AMS • At the equation-level • gPROMS u = R * i Acausality • Modelyze • At the object connection level • … Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 12 [email protected] Part II Modelica Overview Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 13 What is Modelica? [email protected] A language for modeling of complex physical systems • Robotics • Automotive • Aircrafts • Satellites • Power plants • Systems biology Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 14 What is Modelica? [email protected] A language for modeling of complex physical systems Primary designed for simulation, but there are also other usages of models, e.g. optimization. Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 15 What is Modelica? [email protected] A language for modeling of complex physical systems i.e., Modelica is not a tool Free, open language specification: Available at: www.modelica.org Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 16 Modelica Tools [email protected] Commercial Environments Free Environments Dymola by Dassault Systemes OpenModelica supported by OSMC SimulationX by ITI GmbH Jmodelica.org supported by Modelon LMS Imagine.Lab AMESim by LMS Modelicac (part of Scilab) MapleSim by Maplesoft SimForge MOSILAB by Fraunhofer FIRST CyModelica by CyDesign Labs OPTIMICA Studio by Modelon AB MWorks by Suzhou Tongyuan Wolfram SystemModeler by Wolfram Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 17 What is special about Modelica? [email protected] Multi-Domain Modeling Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 18 What is special about Modelica? [email protected] Multi-Domain Visual Acausal Modeling Keeps the physical structure! Component ! Modeling Acausal model (Modelica) Causal block-based model (Simulink) Part I ! Part II ! Part III Part IV EOO Languages! Modelica OpenModelica! Modelyze – a! for CPS! Overview! Demo! Research language! 19 What is special about Modelica? [email protected] Hierarchical system Multi-Domain Visual Acausal modeling Modeling Component k2 i Modeling axis6 qddRef cut joint qdRef qRef k1 r3Control r3Motor r3Drive1 tn 1 1 i 1 S S qd axis5 q: angle qd: angular velocity qdRef Kd qdd: angular acceleration S 0.03 rel joint=0 Jmotor=J spring=c axis4 S qRef pSum Kv sum wSum rate2 rate3 iRef gear=i +1 b(s) 340.8 0.3 - +1 - a(s) S fric=Rv0 axis3 rate1 tacho2 tacho1 b(s) b(s) PT1 a(s) a(s) g5 axis2 q Ra=250 qd Rp2=50 C=0.004*D/w m Rd1=100 Rp1=200 La=(250/(2*D*w m)) axis1 Rd2=100 Ri=10 - - - + + diff + pow er cut in OpI Vs Rd4=100 emf iRef g3 y g1 Rd3=100 x hall2 inertial Courtesy of Martin Otter hall1 w r g4 g2 qd q Part I ! Part II ! Part III Part IV EOO Languages! OpenModelica! Modelyze – a! Modelica for CPS! Overview! Demo! Research language! 20 What is special about Modelica? [email protected] Multi-Domain Visual Acausal Modeling A textual class-based language Component OO primary used for as a structuring concept Modeling Behaviour described declaratively using • Differential