List[Null, Null, Null, Null, Null, Null, Null, Notebook[List[Cell[BoxData[FormBox["", TraditionalForm]], "Input"], Cell[CellGroupData[List[Cell["Exercise 1", "Title"], Cell[CellGroupData[List[Cell["Question", "Section"], Cell["Packages are nice to use in Modelica, but what exactly is a package?", "Text"], Cell[CellGroupData[List[Cell["Answer", "Subsection"], Cell["A package is simply a container or name space for names of classes, functions, constants, and other allowed definitions. A package is also one or the restricted classes.", "Text"]], Closed]]], Open]], Cell[CellGroupData[List[Cell["Question", "Section"], Cell["Why use the word encapsulated when creating pakages?", "Text"], Cell[CellGroupData[List[Cell["Answer", "Subsection"], Cell["Adding the word encapsulated to the package keeps the package well structured as well as being easier to understand and maintain.", "Text"]], Closed]]], Open]], Cell[CellGroupData[List[Cell["Creating a Package", "Section"], Cell[TextData[List["Create a package that contains a constant ", StyleBox["PI", Rule[FontFamily, "Courier"]], ", a type ", StyleBox["Distance", Rule[FontFamily, "Courier"]], ", a function ", StyleBox["RectangleArea", Rule[FontFamily, "Courier"]], ", a function ", StyleBox["TriangleArea", Rule[FontFamily, "Courier"]], ", a function ", StyleBox["CirclePerimeter", Rule[FontFamily, "Courier"]], " and a function ", StyleBox["CircleArea", Rule[FontFamily, "Courier"]], ".\n"]], "Text"], Cell["", "ModelicaInput"], Cell[TextData[List["\n\nWrite a class, ", StyleBox["GeometryUser", Rule[FontFamily, "Courier"]], ",  that uses the package and calls the functions."]], "Text"], Cell["", "ModelicaInput"], Cell[CellGroupData[List[Cell["Answer", "Subsection"], Cell[CellGroupData[List[Cell["package Geometry", "Subsubsection"], Cell["package Geometry\n  constant Real PI = 3.1415926536;\n\n  type Distance = Real(unit = \"m\");\n\n  function RectangleArea\n    input Distance B;\n    input Distance H;\n    output Distance area;\n  algorithm\n    area := B*H;  \n  end RectangleArea;\n\n\n  function TriangleArea\n    input Distance B;\n    input Distance H;\n    output Distance area;\n  algorithm \n    area := RectangleArea(B, H)/2;  \n  end TriangleArea;\n  \n  \n  function CirclePerimeter\n    input Distance radius;\n    output Distance perimeter;\n  algorithm\n    perimeter := 2*PI*radius;  \n  end CirclePerimeter;\n  \n  \n  function CircleArea\n    input Distance radius;\n    output Distance area;\n  algorithm\n     area := PI*radius^2;\n  end CircleArea;\n\nend Geometry;", "ModelicaInput"]], Closed]], Cell[CellGroupData[List[Cell["Simulation of Geometry", "Subsubsection"], Cell["simulate( Geometry );", "ModelicaInput"], Cell[BoxData["\"<SimulationData: \\!\\(Geometry\\) : 2004-1-30 15:38:29.5507648 : \\!\\({0.`, 1.`}\\) : 502 data points : 1 events : 3 variables>\\n\\!\\({\\*TagBox[\\\"\[UnderBracket]derdummy\\\", HoldForm], \\*TagBox[\\\"\[UnderBracket]dummy\\\", HoldForm], \\*TagBox[\\\"PI\\\", HoldForm]}\\)\""], "Output"]], Closed]], Cell[CellGroupData[List[Cell["GeometryUser", "Subsubsection"], Cell["class GeometryUser\n  Geometry.Distance rectangleArea \t= Geometry.RectangleArea(4, 5); \n  Geometry.Distance triangleArea \t= Geometry.TriangleArea(4, 5);\t\n  Geometry.Distance circlePerimeter = Geometry.CirclePerimeter(3.5);\n  Geometry.Distance circleArea \t\t= Geometry.CircleArea(3.5);\nend GeometryUser;", "ModelicaInput"]], Closed]], Cell[CellGroupData[List[Cell["Simulation of GeometryUser", "Subsubsection"], Cell["simulate( GeometryUser );", "ModelicaInput"], Cell[BoxData["\"<SimulationData: \\!\\(GeometryUser\\) : 2004-1-30 15:38:41.2381152 : \\!\\({0.`, 1.`}\\) : 502 data points : 1 events : 6 variables>\\n\\!\\({\\*TagBox[\\\"circleArea\\\", HoldForm], \\*TagBox[\\\"circlePerimeter\\\", HoldForm], \\*TagBox[\\\"\[UnderBracket]derdummy\\\", HoldForm], \\*TagBox[\\\"\[UnderBracket]dummy\\\", HoldForm], \\*TagBox[\\\"rectangleArea\\\", HoldForm], \\*TagBox[\\\"triangleArea\\\", HoldForm]}\\)\""], "Output"], Cell[BoxData[RowBox[List["{", RowBox[List[RowBox[List["rectangleArea", "[", "0", "]"]], ",", " ", RowBox[List["triangleArea", "[", "0", "]"]], ",", " ", RowBox[List["circlePerimeter", "[", "0", "]"]], ",", " ", RowBox[List["circleArea", "[", "0", "]"]]]], "}"]]], "Input"]], Closed]]], Closed]]], Open]]], Open]]], Rule[FrontEndVersion, "5.1 for Microsoft Windows"], Rule[ScreenRectangle, List[List[0, 1280], List[0, 951]]], Rule[WindowSize, List[817, 897]], Rule[WindowMargins, List[List[6, Automatic], List[Automatic, 4]]], Rule[StyleDefinitions, "MathModelica.nb"]], Null, Null, Null, Null, Null]