Modelica Change Proposal MCP-0021 Component Iterators Status: Under Evaluation , version v2, #1848

Size: px
Start display at page:

Download "Modelica Change Proposal MCP-0021 Component Iterators Status: Under Evaluation , version v2, #1848"

Transcription

1 Modelica Change Proposal MCP-0021 Component Iterators Status: Under Evaluation , version v2, #1848 Summary It is proposed to generalize iterator expressions so that a class name can be used as loop type. The loop iterates then over all instances of this class available in the simulation model. Applications are (a) to compute total properties (e.g. total center of mass), and (b) automatically check requirements on all instances of a particular class. Revisions Date v2 Dec. 8, 2015 v1 Dec. 2, 2015 Short description of revision Hilding Elmqvist, Hans Olsson, Martin Otter: For-loop only over instances on the same or a lower level. Added changes to the Modelica specification. Hilding Elmqvist, Hans Olsson, Martin Otter: Initial draft. The proposal also includes a slight changed syntax ( in class instead of in ) based on a discussion between Gerd Kurzbach and Hans Olsson. Contributor License Agreement Not yet applicable (since no CLA is available). Table of Contents 1. Rational Proposed Changes in Specification Backwards Compatibility Tool Implementation Experience with Prototype Required Patents References... 5

2 MCP-0021 Component Iterators (Dec. 8, 2015) - page 2 1. Rational This proposal uses text fragments from (Elmqvist et al., 2015) without further explicit citing. In section of the Modelica Specification 3.3 array constructors with iterators are defined. For example, Real v[:] = {i*i for i in 1:10}; generates a vector v with 10 elements and every element is the square of its index. Section Types as Iteration Ranges states The iteration range can be specified as Boolean or as an enumeration type. It is proposed to generalize this scheme, so that a class name can be used as iterator expression and in every iteration the loop-variable is one instance of this class. The loop iterates over all instances of this class available in the simulation model. Example: Real u[:] = {c.v for c in class Class}; To signal clearly that the iteration is over all instances of a class, the in class keyword is used. The original version of this proposal used the syntax {c.v for c in Class}. Gerd Kurzbach pointed out that it should be clearer defined that this is not a standard iterator by adding an additional keyword. This construct can be used for example in the following way: record Observation Data that shall be observed constant String name; parameter Real m; parameter Real v2[3]; Real r2; end Observation; model ObservationModel Model that produces the data parameter Real p=2; parameter Real v[3] = {-1,2.5,6}; Real r; Real w[3]; Boolean b; Integer i; end ObservationModel; model Submodel ObservationModel c1(p=3, v={1,-4,8}); ObservationModel c2; end Submodel; model MyModel Submodel s1; Submodel s2; Integer i2[:] = {c.i+3 for c in class ObservationModel}; Observation obs[:] = {Observation(m=c.p, v2=c.v, r2=c.r, name=c.getinstancename()) for c in class ObservationModel}; Integer i3[:] = {c.i for c in class ClassNotUsedInMyModel}; end MyModel; In every iteration of the for loop, the iterator variable c adopts the name of an instance of class ObservationModel present in MyModel (the model and its submodels are inspected where the iterator expression is present). The built-in operator c.getinstancename() is expanded as the instance name of c. If no instance of a class is present in a model, such as for ClassNotUsedInMyModel, then an array with zero dimensions is generated 1. It is an error, if the class name in the iterator is not known. 1 In order that it is possible to write generic code without knowing which classes are present in the simulation model, no error must be generated when a class is not present that is used as iterator. If this information is needed, it can be easily determined by inquirying the array size (which is zero, if the class is not used in the model).

3 MCP-0021 Component Iterators (Dec. 8, 2015) - page 3 Therefore, the above model is equivalent to the following expanded form (showing that the extension can be formally defined by a rewriting rule): model MyModelExpanded Submodel s1; Submodel s2; Integer i2[:] = {s1.c1.i+3, s1.c2.i+3, s2.c1.i+3, s2.c2.i+3}; Observation obs[:] = {Observation(m=s1.c1.p, v2=s1.c1.v, r2=s1.c1.r, name="mymodelexpanded.s1.c1"), Observation(m=s1.c2.p, v2=s1.c2.v, r2=s1.c2.r, name="mymodelexpanded.s1.c2"), Observation(m=s2.c1.p, v2=s2.c1.v, r2=s2.c1.r, name="mymodelexpanded.s2.c1"), Observation(m=s2.c2.p, v2=s2.c2.v, r2=s2.c2.r, name="mymodelexpanded.s2.c2")}; Integer i3[0] ; end ModelExpanded; It is proposed to have the following restrictions of this new concept of component iterators: As class in the iterator only the specialized classes are possible that allow to construct component instances: model, block, connector, record, operator record, type (but not package, function, operator function). The iteration is only performed over instances of the given class, not over instances of subclasses or classes that inherit from the class. Component iterators can only be used in the specialized classes model and block. An instance iterator inside an outer component is ignored. [Implementation: If { for c in class XYZ} is found during flattening, the evaluation of the for-expression is delayed, until all elements not containing in class are flattened. It is an error, if one of the delayed objects contains XYZ ] Conditionally disabled objects are ignored. Examples: MyRecord rec[5] // every element is an instance in the loop iteration MyRecord rec1(a=4); MyRecord rec2(a=6); MyRecord rec2 = if expr then rec1 else rec2; // Discussions: Henrik: This proposal should be finalized when the flattening process is better defined (in MCP 0019) and then the flattening process should be referenced. Peter: This is a reflective language construct. In Java there is a powerful reflective API. The question is whether this proposal could be treated as a special case of a more general reflective API. Hans: From user point of view the above proposal is fairly easy to use. With a general reflective API it is most likely much more complicated for the user. This new language feature can be used, for example, in the following application areas: Compute total properties of a model (e.g. compute total center of mass from all parts of a satellite). Check that the requirements on a class are fulfilled by all instances of this class present in the model at hand. Such types of examples are discussed in the paper (Elmqvist et al., 2015). These examples are also available in the attached test library TestModels/MetaProperties.mo : MetaProperties.Section_2_1_ComponentIterators.Model MetaProperties.Section_3_1_TotalMass.TotalMassOfRobot MetaProperties.Section_3_1_TotalMass.TotalMassOfRobotWithLog MetaProperties.Section_3_2_TotalCenterOfMass.TotalCenterOfMassOfRobot MetaProperties.Section_4_3_ClassBinding.CheckPumpsOfBatchPlantWithForLoop MetaProperties.Section_4_3_ClassBinding.CheckPumpsOfBatchPlantWithForLoop2 MetaProperties.Section_4_3_ClassBinding.CheckPumpsOfBatchPlantWithForLoop3 MetaProperties.Section_4_4_ClassBindingWithTwoClasses.CheckCoolingSystem MetaProperties.Section_4_4_ClassBindingWithTwoClassesAndID.CheckCoolingSystemWithID

4 MCP-0021 Component Iterators (Dec. 8, 2015) - page 4 The example MetaProperties.Section_3_1_TotalMass.TotalMassOfRobot is sketched below to compute the total mass of a mechanical system. When using the Modelica.Mechanics.MultiBody library, there are only two model classes where the mass of a body are defined: MultiBody.Parts.Body MultiBody.Parts.PointMass All other specialized parts, like Parts.BodyShape, use an instance of Parts.Body and need therefore not to be handled specially. Model TotalMass computes the total mass of all bodies in a system. model TotalMass "Compute total mass of a system" import Modelica.Mechanics.MultiBody.Parts; import SI = Modelica.SIunits; final parameter SI.Mass m_total = sum({b.m for b in class Parts.Body}) + sum({b.m for b in class Parts.PointMass}) // or alternative syntax without class final parameter SI.Mass m_total = sum({b.m for b in Parts.Body}) + sum({b.m for b in Parts.PointMass}) end TotalMass; The assumption made here is that models Parts.Body and Parts.PointMass have a parameter with name m. The sum of the m elements of all instances of Parts.Body and Parts.PointMass is assigned to parameter m_total. This model can be, for example, used to compute the total mass of the r3 robot from the Modelica Standard Library: model TotalMassOfRobot "Compute total mass of r3 robot" extends TotalMass; extends Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.fullRobot; end TotalMassOfRobot; In principal, the total mass can also be computed with Modelica 3.2 language elements via inner/outer: However, this requires to prepare the model beforehand for this action, by adding an outer-declaration in Parts.Body and Parts.PointMass that reports the mass to an inner declaration. With the solution above, the model classes from which information shall be deduced are not modified. Another example is to check the requirements of all pumps in a circuit (MetaProperties.Section_4_3_ClassBinding.CheckPumpsOfBatchPlantWithForLoop3): record PumpObservation "Observation signals needed for one pump" constant String name "Name of pump"; Boolean inoperation "= true, if in operation"; Boolean cavitate "= true, if pump cavitates"; end PumpObservation; PumpRequirements req(obs={pumpobservation(name= c.getinstancename(), inoperation= c.n_in > 0.1, cavitate= c.port_a.p <= 1e4 or c.port_b.p <= 1e4) for c in class Modelica.Fluid.Machines.PrescribedPump}) Here, iterator component c represents all instances of class Modelica.Fluid.Machines.PrescribedPump in this model. Via the PumpObservation record the needed variables are extracted and passed to the requirements model. Therefore, it is checked whether all instances of PrescribedPump fulfills the defined requirements. Again, this operation is carried out without modifying the underlying PrescribedPump model. Open issues In order to build modular systems it is necessary to restrict the iterator to only part of the overall model. Therefore the iteration is here restricted to instances in the model and submodels. This implies that TotalMass must be a base-class (a similar style exists in some other object-oriented languages). Another alternative would be to first go up one level allowing TotalMass to be a normal component, which may seem as better structuring. However, it would also allow multiple TotalMass-components at the same level which is not the intention.

5 2. Proposed Changes in Specification MCP-0021 Component Iterators (Dec. 8, 2015) - page 5 The precise text of the proposed changes with respect to Modelica Specification 3.3 are in the accompanying document MCP-0021_ComponentIterators_SpecChanges.pdf. 3. Backwards Compatibility This proposal is backwards compatible. 4. Tool Implementation 4.1 Experience with Prototype There is a prototype in Dymola. The prototype does not implement exactly the above proposal but deviate in the following aspects (which is uncritical; the prototype will be adapted once agreement is reached): The actually used syntax is {c.v for c in Class} and not {c.v for c in class Class} as proposed above. The for-loop iterates over all intances in the complete simulation model, and not only over the instances on the same or a lower level. There are the following issues: This proposal complicates flattening of a model because all the component iterations have to be performed before flattening of the model parts can be done in which the component iterator is present. 4.2 Required Patents According to our knowledge, no patents are needed to implement this proposal. 5. References Elmqvist H., Olsson H., Otter M. (2015): Constructs for Meta Properties Modeling in Modelica. 11 th International Modelica Conference, Versailles, Sept

Modelica Change Proposal MCP-0019 Flattening (In Development) Proposed Changes to the Modelica Language Specification Version 3.

Modelica Change Proposal MCP-0019 Flattening (In Development) Proposed Changes to the Modelica Language Specification Version 3. Modelica Change Proposal MCP-0019 Flattening (In Development) Proposed Changes to the Modelica Language Specification Version 3.3 Revision 1 Table of Contents Preface 3 Chapter 1 Introduction 3 Chapter

More information

The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language

More information

Modelica Change Proposal MCP-0027 Units of Literal Constants Authors: Francesco Casella, Martin Sjölund Status: In Development version v3

Modelica Change Proposal MCP-0027 Units of Literal Constants Authors: Francesco Casella, Martin Sjölund Status: In Development version v3 Modelica Change Proposal MCP-0027 Units of Literal Constants Authors: Francesco Casella, Martin Sjölund Status: In Development 2017-10-19 version v3 Summary Units of literal Real constants are unspecified

More information

Advanced Modelica Tutorial Exercises

Advanced Modelica Tutorial Exercises Advanced Modelica Tutorial Exercises Hilding Elmqvist, Dynasim Martin Otter, DLR Refine MultiBody/Engine Make Engine example model a reusable component 1. Manage parameters 2. Allow changing number of

More information

Activation Inheritance in Modelica

Activation Inheritance in Modelica Activation Inheritance in Modelica Ramine Nikoukhah INRIA, BP 05, 7853 Le Chesnay, France ramine.nikoukhah@inria.fr Abstract Modelica specifies two types of s: the s defined directly in the "" section,

More information

CP122 CS I. Chapter 6a: Iteration I

CP122 CS I. Chapter 6a: Iteration I CP122 CS I Chapter 6a: Iteration I Supreme Court ruling: Samsung's violation of Apple's iphone patents may only involve components and not whole phone Tech News! Tech News! Supreme Court ruling: Samsung's

More information

The SPL Programming Language Reference Manual

The SPL Programming Language Reference Manual The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming

More information

Interface evolution via public defender methods

Interface evolution via public defender methods Interface evolution via public defender methods Brian Goetz Second draft, May 2010 1. Problem statement Once published, it is impossible to add methods to an interface without breaking existing implementations.

More information

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003 Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an

More information

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107 A abbreviations 17 abstract class 105 abstract data types 105 abstract method 105 abstract types 105 abstraction 92, 105 access level 37 package 114 private 115 protected 115 public 115 accessors 24, 105

More information

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE PART A UNIT I 1. Differentiate object oriented programming from procedure oriented programming. 2. Define abstraction and encapsulation. 3. Differentiate

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Object-Oriented

More information

Hardware Modeling. VHDL Architectures. Vienna University of Technology Department of Computer Engineering ECS Group

Hardware Modeling. VHDL Architectures. Vienna University of Technology Department of Computer Engineering ECS Group Hardware Modeling VHDL Architectures Vienna University of Technology Department of Computer Engineering ECS Group Contents Structural Modeling Instantiation of Components Behavioral Modeling Processes

More information

Student Performance Q&A:

Student Performance Q&A: Student Performance Q&A: 2016 AP Computer Science A Free-Response Questions The following comments on the 2016 free-response questions for AP Computer Science A were written by the Chief Reader, Elizabeth

More information

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and

More information

CS100J, Fall 2003 Preparing for Prelim 1: Monday, 29 Sept., 7:30 9:00PM

CS100J, Fall 2003 Preparing for Prelim 1: Monday, 29 Sept., 7:30 9:00PM CS100J, Fall 2003 Preparing for Prelim 1: Monday, 29 Sept., 7:30 9:00PM This handout explains what you have to know for the first prelim. Terms and their meaning Below, we summarize the terms you should

More information

CS422 - Programming Language Design

CS422 - Programming Language Design 1 CS422 - Programming Language Design Continuation-Passing Style (CPS) Transformation Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign 2 On Data Versus Control Context

More information

Wrapper Classes double pi = new Double(3.14); 3 double pi = new Double("3.14"); 4... Zheng-Liang Lu Java Programming 290 / 321

Wrapper Classes double pi = new Double(3.14); 3 double pi = new Double(3.14); 4... Zheng-Liang Lu Java Programming 290 / 321 Wrapper Classes To treat values as objects, Java supplies standard wrapper classes for each primitive type. For example, you can construct a wrapper object from a primitive value or from a string representation

More information

enum Types 1 1 The keyword enum is a shorthand for enumeration. Zheng-Liang Lu Java Programming 267 / 287

enum Types 1 1 The keyword enum is a shorthand for enumeration. Zheng-Liang Lu Java Programming 267 / 287 enum Types 1 An enum type is an reference type limited to an explicit set of values. An order among these values is defined by their order of declaration. There exists a correspondence with string names

More information

Computing Science 114 Solutions to Midterm Examination Tuesday October 19, In Questions 1 20, Circle EXACTLY ONE choice as the best answer

Computing Science 114 Solutions to Midterm Examination Tuesday October 19, In Questions 1 20, Circle EXACTLY ONE choice as the best answer Computing Science 114 Solutions to Midterm Examination Tuesday October 19, 2004 INSTRUCTOR: I E LEONARD TIME: 50 MINUTES In Questions 1 20, Circle EXACTLY ONE choice as the best answer 1 [2 pts] What company

More information

Another IS-A Relationship

Another IS-A Relationship Another IS-A Relationship Not all classes share a vertical relationship. Instead, some are supposed to perform the specific methods without a vertical relationship. Consider the class Bird inherited from

More information

A Short Summary of Javali

A Short Summary of Javali A Short Summary of Javali October 15, 2015 1 Introduction Javali is a simple language based on ideas found in languages like C++ or Java. Its purpose is to serve as the source language for a simple compiler

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

(a) Assume that in a certain country, tax is payable at the following rates:

(a) Assume that in a certain country, tax is payable at the following rates: 3 1. (Total = 12 marks) (a) Assume that in a certain country, tax is payable at the following rates: 15% on your first $50000 income 25% on any amount over $50000 Write a method that takes in an annual

More information

APCS Semester #1 Final Exam Practice Problems

APCS Semester #1 Final Exam Practice Problems Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

Computer Science 1 Ah

Computer Science 1 Ah UNIVERSITY OF EDINBURGH course CS0077 COLLEGE OF SCIENCE AND ENGINEERING SCHOOL OF INFORMATICS Computer Science 1 Ah Resit Examination Specimen Solutions Date: Monday 1st September 2003 Time: 09:30 11:00

More information

Tail Calls. CMSC 330: Organization of Programming Languages. Tail Recursion. Tail Recursion (cont d) Names and Binding. Tail Recursion (cont d)

Tail Calls. CMSC 330: Organization of Programming Languages. Tail Recursion. Tail Recursion (cont d) Names and Binding. Tail Recursion (cont d) CMSC 330: Organization of Programming Languages Tail Calls A tail call is a function call that is the last thing a function does before it returns let add x y = x + y let f z = add z z (* tail call *)

More information

Timing for Interfaces and Abstract Classes

Timing for Interfaces and Abstract Classes Timing for Interfaces and Abstract Classes Consider using abstract classes if you want to: share code among several closely related classes declare non-static or non-final fields Consider using interfaces

More information

Goal. Generic Programming and Inner classes. Minor rewrite of linear search. Obvious linear search code. Intuitive idea of generic linear search

Goal. Generic Programming and Inner classes. Minor rewrite of linear search. Obvious linear search code. Intuitive idea of generic linear search Goal Generic Programming and Inner classes First version of linear search Input was array of int More generic version of linear search Input was array of Comparable Can we write a still more generic version

More information

The SiMoL Modeling Language for Simulation and (Re-)Configuration

The SiMoL Modeling Language for Simulation and (Re-)Configuration The SiMoL Modeling Language for Simulation and (Re-)Configuration Iulia Nica and Franz Wotawa Technische Universität Graz, Institute for Software Technology 1 Index Motivation SiMoL Definition SiMoL Syntax

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 2 Things to Review Review the Class Slides: Key Things to Take Away Do you understand

More information

1 Lexical Considerations

1 Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler

More information

Semantic Analysis. Role of Semantic Analysis

Semantic Analysis. Role of Semantic Analysis Semantic Analysis Chapter 4 Role of Semantic Analysis Following parsing, the next two phases of the "typical" compiler are semantic analysis (intermediate) code generation The principal job of the semantic

More information

REFERENCE MATERIALS. Assignment, Display, and Input Evaluates expression and assigns the result to the variable a.

REFERENCE MATERIALS. Assignment, Display, and Input Evaluates expression and assigns the result to the variable a. a expression Assignment, Display, and Input Evaluates expression and assigns the result to the variable a. DISPLAY (expression) Displays the value of expression, followed by a space. INPUT () Accepts a

More information

Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7

Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7 Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7 1 Problem Ralph owns the Trinidad Fruit Stand that sells its fruit on the street, and he wants to use a computer

More information

Hybrid dynamics in Modelica: should all events be considered synchronous. Ramine Nikoukhah INRIA. Modelica/Scicos

Hybrid dynamics in Modelica: should all events be considered synchronous. Ramine Nikoukhah INRIA. Modelica/Scicos Hybrid dynamics in Modelica: should all events be considered synchronous Ramine Nikoukhah INRIA EOOLT 2007 Modelica/Scicos Modelica: language for modeling physical systems. Originally continuous-time modeling

More information

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language Categories of languages that support OOP: 1. OOP support is added to an existing language - C++ (also supports procedural and dataoriented programming) - Ada 95 (also supports procedural and dataoriented

More information

Modelica. Language, Libraries, Tools, Workshop and EU-Project RealSim

Modelica. Language, Libraries, Tools, Workshop and EU-Project RealSim Modelica Language, Libraries, Tools, Workshop and EU-Project RealSim by Martin Otter 1, Hilding Elmqvist 2 German Aerospace Center, Oberpfaffenhofen, Germany and Dynasim AB, Lund, Sweden December 18, 2000

More information

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

(800) Toll Free (804) Fax   Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days Course Description This course introduces the Java programming language and how to develop Java applications using Eclipse 3.0. Students learn the syntax of the Java programming language, object-oriented

More information

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1 Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1 Inheritance Consider a new type Square. Following how we declarations for the Rectangle and Circle classes we could declare it as follows:

More information

The design of a programming language for provably correct programs: success and failure

The design of a programming language for provably correct programs: success and failure The design of a programming language for provably correct programs: success and failure Don Sannella Laboratory for Foundations of Computer Science School of Informatics, University of Edinburgh http://homepages.inf.ed.ac.uk/dts

More information

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl...

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl... Page 1 of 13 Units: - All - Teacher: ProgIIIJavaI, CORE Course: ProgIIIJavaI Year: 2012-13 Intro to Java How is data stored by a computer system? What does a compiler do? What are the advantages of using

More information

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple

More information

MWorks: a Modern IDE for Modeling and Simulation of Multidomain Physical Systems Based on Modelica

MWorks: a Modern IDE for Modeling and Simulation of Multidomain Physical Systems Based on Modelica MWorks: a Modern IDE for Modeling and Simulation of Multidomain Physical Systems Based on Modelica FAN-LI Zhou, LI-PING Chen, YI-ZHONG Wu, JIAN-WAN Ding, JIAN-JUN Zhao, YUN-QING Zhang CAD Center, Huazhong

More information

Conditionals and Loops

Conditionals and Loops Conditionals and Loops Conditionals and Loops Now we will examine programming statements that allow us to: make decisions repeat processing steps in a loop Chapter 5 focuses on: boolean expressions conditional

More information

DEPARTMENT OF INFORMATION TECHNOLOGY

DEPARTMENT OF INFORMATION TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY II Year/III Sem CS8392- OBJECT ORIENTED PROGRAMMING Prepared by: Komal Kumar.N, AP/IT, VTHT UNIVERSITY QUESTIONS FROM 2011 to 2018 PART-A 1. What are the advantages

More information

Synchronous Control and State Machines in Modelica

Synchronous Control and State Machines in Modelica Synchronous Control and State Machines in Modelica Hilding Elmqvist Dassault Systèmes Sven Erik Mattsson, Fabien Gaucher, Francois Dupont Dassault Systèmes Martin Otter, Bernhard Thiele DLR Content Introduction

More information

Extending SystemVerilog Data Types to Nets

Extending SystemVerilog Data Types to Nets Extending SystemVerilog Data Types to Nets SystemVerilog extended Verilog by adding powerful new data types and operators that can be used to declare and manipulate parameters and variables. Extensions

More information

Synchronization SPL/2010 SPL/20 1

Synchronization SPL/2010 SPL/20 1 Synchronization 1 Overview synchronization mechanisms in modern RTEs concurrency issues places where synchronization is needed structural ways (design patterns) for exclusive access 2 Overview synchronization

More information

POST GRADUATE DIPLOMA IN LIBRARY AUTOMATION AND NETWORKING (PGDLAN)

POST GRADUATE DIPLOMA IN LIBRARY AUTOMATION AND NETWORKING (PGDLAN) No. of Printed Pages : 6 MLI-007 POST GRADUATE DIPLOMA IN LIBRARY AUTOMATION AND NETWKING (PGDLAN) 00942 Term-End Examination June, 2017 MLI-007 : PROGRAMMING Time 2 hours Maximum Marks : 50 (Weightage

More information

Classes and Methods גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון

Classes and Methods גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון Classes and Methods גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון 2 Roadmap Lectures 4 and 5 present two sides of OOP: Lecture 4 discusses the static, compile time representation of object-oriented

More information

BEng (Hons) Electronic Engineering. BEng (Hons) Telecommunications. Examinations for / Semester 2

BEng (Hons) Electronic Engineering. BEng (Hons) Telecommunications. Examinations for / Semester 2 BEng (Hons) Electronic Engineering BEng (Hons) Telecommunications Cohort: BEE/16B/FT & BTEL/16B/FT Examinations for 2016-2017 / Semester 2 Resit Examinations for BTEL/15B/FT, BEE/13B/FT, BTEL/14B/FT &

More information

A Multi Level Approach for Aircraft Electrical Systems Design

A Multi Level Approach for Aircraft Electrical Systems Design A Multi Level Approach for Aircraft Electrical Systems Design Martin R. Kuhn Martin Otter Loïc Raulin German Aerospace Center (DLR) Airbus France Institute of Robotics and Mechatronics Electrics System

More information

Metamodeling with Metamodels. Using. UML/MOF including OCL

Metamodeling with Metamodels. Using. UML/MOF including OCL Metamodeling with Metamodels Using UML/MOF including OCL Introducing Metamodels (Wikipedia) A metamodel is a model of a model An instantiation of metamodel gives a model Metamodeling is the process of

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Lecture 5: Lazy Evaluation and Infinite Data Structures

Lecture 5: Lazy Evaluation and Infinite Data Structures Lecture 5: Lazy Evaluation and Infinite Data Structures Søren Haagerup Department of Mathematics and Computer Science University of Southern Denmark, Odense October 3, 2017 How does Haskell evaluate a

More information

CSE 341 Section Handout #6 Cheat Sheet

CSE 341 Section Handout #6 Cheat Sheet Cheat Sheet Types numbers: integers (3, 802), reals (3.4), rationals (3/4), complex (2+3.4i) symbols: x, y, hello, r2d2 booleans: #t, #f strings: "hello", "how are you?" lists: (list 3 4 5) (list 98.5

More information

Module 10 Inheritance, Virtual Functions, and Polymorphism

Module 10 Inheritance, Virtual Functions, and Polymorphism Module 10 Inheritance, Virtual Functions, and Polymorphism Table of Contents CRITICAL SKILL 10.1: Inheritance Fundamentals... 2 CRITICAL SKILL 10.2: Base Class Access Control... 7 CRITICAL SKILL 10.3:

More information

3(Paris/Secretariat)18

3(Paris/Secretariat)18 For IEC use only 3(Paris/Secretariat)18 2007-11-21 INTERNATIONAL ELECTROTECHNICAL COMMISSION Technical No. 3 Information structures, documentation and graphical symbols Preliminary compilation s on 3/859B/NP

More information

CPS 506 Comparative Programming Languages. Syntax Specification

CPS 506 Comparative Programming Languages. Syntax Specification CPS 506 Comparative Programming Languages Syntax Specification Compiling Process Steps Program Lexical Analysis Convert characters into a stream of tokens Lexical Analysis Syntactic Analysis Send tokens

More information

Design optimisation of industrial robots using the Modelica multi-physics modeling language

Design optimisation of industrial robots using the Modelica multi-physics modeling language Design optimisation of industrial robots using the Modelica multi-physics modeling language A. Kazi, G. Merk, M. Otter, H. Fan, (ArifKazi, GuentherMerk)@kuka-roboter.de (Martin.Otter, Hui.Fan)@dlr.de KUKA

More information

Java Bytecode (binary file)

Java Bytecode (binary file) Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.

More information

Syntax Intro and Overview. Syntax

Syntax Intro and Overview. Syntax Syntax Intro and Overview CS331 Syntax Syntax defines what is grammatically valid in a programming language Set of grammatical rules E.g. in English, a sentence cannot begin with a period Must be formal

More information

Interfaces. An interface forms a contract between the object and the outside world.

Interfaces. An interface forms a contract between the object and the outside world. Interfaces An interface forms a contract between the object and the outside world. For example, the buttons on the television set are the interface between you and the electrical wiring on the other side

More information

FreePascal changes: user documentation

FreePascal changes: user documentation FreePascal changes: user documentation Table of Contents Jochem Berndsen February 2007 1Introduction...1 2Accepted syntax...2 Declarations...2 Statements...3 Class invariants...3 3Semantics...3 Definitions,

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program Objectives After studying this chapter, you should be able to: Include the selection structure in pseudocode

More information

Deducing the type of variable from its initializer expression (revision 3)

Deducing the type of variable from its initializer expression (revision 3) Deducing the type of variable from its initializer expression (revision 3) Programming Language C++ Document no: N1894=05-0154 Jaakko Järvi Texas A&M University College Station, TX jarvi@cs.tamu.edu Bjarne

More information

Interfaces (1/2) An interface forms a contract between the object and the outside world.

Interfaces (1/2) An interface forms a contract between the object and the outside world. Interfaces (1/2) An interface forms a contract between the object and the outside world. For example, the buttons on remote controls for some machine. As you can see, an interface is a reference type,

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

JOURNAL OF OBJECT TECHNOLOGY

JOURNAL OF OBJECT TECHNOLOGY JOURNAL OF OBJECT TECHNOLOGY Online at www.jot.fm. Published by ETH Zurich, Chair of Software Engineering JOT, 2002 Vol. 1, No. 2, July-August 2002 The Theory of Classification Part 2: The Scratch-Built

More information

Lab 09: Advanced SQL

Lab 09: Advanced SQL CIS395 - BMCC - Spring 2018 04/25/2018 Lab 09: Advanced SQL A - Use Simple Loops with EXIT Conditions In this exercise, you use the EXIT condition to terminate a simple loop, and a special variable, v_counter,

More information

WA1278 Introduction to Java Using Eclipse

WA1278 Introduction to Java Using Eclipse Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc WA1278 Introduction to Java Using Eclipse This course introduces the Java

More information

A Domain-sepcific Langauge for Infopipes

A Domain-sepcific Langauge for Infopipes A Domain-sepcific Langauge for Infopipes Rebekah Leslie Department of Computer Science and Engineering OGI School of Science & Engineering Oregon Health & Science University 20000 NW Walker Road Beaverton,

More information

More About Objects and Methods

More About Objects and Methods More About Objects and Methods Chapter 6 Objectives Define and use constructors Write and use static variables and methods Use methods from class Math Use predefined wrapper classes Use stubs, drivers

More information

CIS 341 Midterm March 2, 2017 SOLUTIONS

CIS 341 Midterm March 2, 2017 SOLUTIONS CIS 341 Midterm March 2, 2017 SOLUTIONS 1 1. True or False (14 points) Mark each statement as either true or false. a. T F The typical compiler consists of several phases, including: lexing, parsing, transformation

More information

Modelica for Embedded Systems

Modelica for Embedded Systems Modelica for Embedded Systems Hilding Elmqvist 1, Martin Otter 2, Dan Henriksson 1, Bernhard Thiele 2, Sven Erik Mattsson 1 1 Dassault Systèmes, Lund, Sweden (Dynasim) 2 German Aerospace Centre (DLR),

More information

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++ No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)

More information

Haskell 98 in short! CPSC 449 Principles of Programming Languages

Haskell 98 in short! CPSC 449 Principles of Programming Languages Haskell 98 in short! n Syntax and type inferencing similar to ML! n Strongly typed! n Allows for pattern matching in definitions! n Uses lazy evaluation" F definition of infinite lists possible! n Has

More information

Instantiation of Template class

Instantiation of Template class Class Templates Templates are like advanced macros. They are useful for building new classes that depend on already existing user defined classes or built-in types. Example: stack of int or stack of double

More information

C# and Java. C# and Java are both modern object-oriented languages

C# and Java. C# and Java are both modern object-oriented languages C# and Java C# and Java are both modern object-oriented languages C# came after Java and so it is more advanced in some ways C# has more functional characteristics (e.g., anonymous functions, closure,

More information

8. Control statements

8. Control statements 8. Control statements A simple C++ statement is each of the individual instructions of a program, like the variable declarations and expressions seen in previous sections. They always end with a semicolon

More information

Object-Oriented Programming

Object-Oriented Programming 13 Object-Oriented Programming Exercises 13.1 Using Java as an example: 13.2 Code reuse: inhertiance, interfaces. In the case of an interface, any class implementing the Comparable interface can be sorted

More information

8/22/2003. Proposal for VPI model PSL assertion extensions

8/22/2003. Proposal for VPI model PSL assertion extensions 8/22/2003 Proposal for VPI model PSL assertion extensions Cadence Design Systems, Inc. 8/22/2003 This proposal has been prepared by Cadence Design Systems, Inc. for consideration by the IEEE 1364 working

More information

RSL Reference Manual

RSL Reference Manual RSL Reference Manual Part No.: Date: April 6, 1990 Original Authors: Klaus Havelund, Anne Haxthausen Copyright c 1990 Computer Resources International A/S This document is issued on a restricted basis

More information

IV Unit Second Part STRUCTURES

IV Unit Second Part STRUCTURES STRUCTURES IV Unit Second Part Structure is a very useful derived data type supported in c that allows grouping one or more variables of different data types with a single name. The general syntax of structure

More information

CS4215 Programming Language Implementation. Martin Henz

CS4215 Programming Language Implementation. Martin Henz CS4215 Programming Language Implementation Martin Henz Thursday 26 January, 2012 2 Chapter 4 The Language simpl In this chapter, we are exting the language epl in order to provide a more powerful programming

More information

Java Primer 1: Types, Classes and Operators

Java Primer 1: Types, Classes and Operators Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,

More information

Deducing the type of variable from its initializer expression (revision 4)

Deducing the type of variable from its initializer expression (revision 4) Deducing the type of variable from its initializer expression (revision 4) Programming Language C++ Document no: N1984=06-0054 Jaakko Järvi Texas A&M University College Station, TX jarvi@cs.tamu.edu Bjarne

More information

Simple Java Programming Constructs 4

Simple Java Programming Constructs 4 Simple Java Programming Constructs 4 Course Map In this module you will learn the basic Java programming constructs, the if and while statements. Introduction Computer Principles and Components Software

More information

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs. Java SE11 Development Java is the most widely-used development language in the world today. It allows programmers to create objects that can interact with other objects to solve a problem. Explore Java

More information

Remarks on the Implementation of the Modelica Standard Tables

Remarks on the Implementation of the Modelica Standard Tables Thomas Beutlich Gerd Kurzbach Uwe Schnabel ITI GmbH Schweriner Straße 1, 067 Dresden, Germany {beutlich, kurzbach, schnabel}@itisim.com Abstract This article reveals some implementation details regarding

More information

YOLOP Language Reference Manual

YOLOP Language Reference Manual YOLOP Language Reference Manual Sasha McIntosh, Jonathan Liu & Lisa Li sam2270, jl3516 and ll2768 1. Introduction YOLOP (Your Octothorpean Language for Optical Processing) is an image manipulation language

More information

CS2104 Prog. Lang. Concepts

CS2104 Prog. Lang. Concepts CS2104 Prog. Lang. Concepts Operational Semantics Abhik Roychoudhury Department of Computer Science National University of Singapore Organization An imperative language IMP Formalizing the syntax of IMP

More information

McGill University School of Computer Science COMP-202A Introduction to Computing 1

McGill University School of Computer Science COMP-202A Introduction to Computing 1 McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

List Functions, and Higher-Order Functions

List Functions, and Higher-Order Functions List Functions, and Higher-Order Functions Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ List Functions, and Higher-Order

More information