OpenModelica/C3/Annotations--in-Modelica/English-timed

From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:01 Welcome to the spoken tutorial on Annotations.
00:05 In this tutorial, we are going to learn how to specify an annotation and how to define a record.
00:14 To record this tutorial, I am using:OpenModelica 1.9.2.
00:20 You may use any of the following operating systems to practice this tutorial.
00:26 To understand and practice this tutorial, you need knowledge of class definition in Modelica.
00:33 Please watch the prerequisite tutorials available on our website.
00:39 Annotations can appear at multiple locations in a class.
00:44 They may be used to: change simulation settings , to add supporting documentation and to add icon and diagram views to a class.
00:56 In the previous tutorials, we used SimulationSetup button in the toolbar, to vary simulation settings.
01:05 experiment is a model annotation that may be used to vary the following: Start Time , Stop Time ,Tolerance and Interval.
01:19 Discussion of Tolerance and Interval are beyond the scope of this tutorial series.
01:25 Shown here is an example, demonstrating the syntax of experiment annotation.
01:32 Now, we shall understand experiment annotation through a class named bouncingBallWithAnnotations.
01:40 Let me switch to OMEdit.
01:43 Please download all the files available on our website.
01:48 Let me open the necessary model files for this tutorial.
01:54 Press Ctrl+O.
01:58 Go to the appropriate location on your Desktop and select color.mo and bouncingBallWithAnnotations.
02:09 These files are now open in OMEdit.
02:13 We will first look into bouncingBallWithAnnotations.
02:18 This model is an extension of the bouncingBall model which we discussed in previous tutorials.
02:25 Please watch the prerequisite tutorials for more information on this model.
02:31 Double-click on bouncingBallWithAnnotations in Libraries Browser.
02:37 Let me shift OMEdit window to the left, for better visibility.
02:42 Switch to text view if the class opens in either Icon/Diagram View.
02:48 The model is now open in Text View.
02:52 Let me scroll-down a little bit.
02:55 Here, we use the experiment annotation to set startTime to 0 and stopTime to 5 units.
03:04 experiment annotation serves the same purpose as Simulation Setup toolbox.
03:11 Click on Simulation Setup button in the toolbar.
03:15 You can see the same stopTime and startTime fields here.
03:21 We changed the values of these fields using experiment annotation.
03:27 Let us simulate the model now.
03:30 Click on Simulate button.
03:33 Select h in variables browser.
03:37 Note that the simulation interval is 5 units.
03:42 This is due to startTime and ‘StopTime fields of experiment annotation.
03:48 Now de-select h and delete the result.
03:54 Click on Modeling button at bottom right.
03:58 Now, let us learn more about adding documentation to a model using annotations.
04:06 The highlighted text appears in Documentation annotation.
04:11 Now, let me show an application of Documentation annotation.
04:17 Go to the top left of modeling area.
04:21 Click on fourth button which is Documentation View.
04:24 You can view the text typed in Documentation annotation in the browser.
04:31 This functionality allows us to add useful information for larger models which require documentation.
04:40 Close Documentation Browser. Let me go back to the slides.
04:46 Record is a specialized class used to define a record data structure.
04:52 For example, bank accounts have records with person’s name, age etc.. as fields.
05:01 Records can only contain variables. They may not contain equations.
05:08 Shown here is an example record named Person.
05:13 It has name and age as its fields.
05:17 Let me switch to OMEdit to demonstrate record definition.
05:23 Let me shift OMEdit window to the right.
05:27 We will now use the file named Color.
05:31 To open it in Textview, double-click on color icon in Libraries Browser.
05:39 This record has three variables named red, blue and green.
05:47 You may see that Simulate button doesn’t appear in the toolbar.
05:53 This indicates that records are not meant to be simulated.
05:58 Now let me go back to slides.
06:01 It is easier to understand annotation elements as records.
06:07 For example, experiment annotation can be considered as a record with StartTime, StopTime, Interval and Tolerance as its fields.
06:19 Graphical elements can be interpreted similarly.
06:23 We will understand more about the interpretation of annotations as records when we discuss icon and diagram views.
06:33 As an assignment,
06:35 Vary the stop time for simulation of bouncingBallWithAnnotations class from 10 to 20 units.
06:42 Use experiment annotation for this purpose.
06:47 Simulate the class after this change.
06:50 Plot h vs time and notice the change in simulation stop time.
06:57 This brings us to the end of this tutorial.
07:00 Watch the video available at the following link.
07:03 It summarises spoken tutorial project.
07:07 We conduct workshops using spoken tutorials .
07:11 We give certificates to those who pass an online test. Please contact us.
07:17 If you have questions from this spoken tutorial, please visit the following website.
07:24 We coordinate coding of solved examples from popular books.
07:29 Please visit the following website.
07:32 We help migrate commercial simulator labs to OpenModelica.
07:38 We give honorarium and certificates to those who do this. Please contact us.
07:43 Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.
07:50 We thank the development team of OpenModelica for their support.
07:56 Thank you for joining me in this tutorial.

Contributors and Content Editors

Jyotisolanki, Sandhya.np14