List[Null, Null, Null, Null, Null, Null, Null, Notebook[List[Cell[CellGroupData[List[Cell["Exercise 1 - Package", "Title"], Cell[CellGroupData[List[Cell["Question", "Section"], Cell["What is a Package?", "Text"], Cell[CellGroupData[List[Cell["Answer", "Subsection"], Cell["A package is a restricted and enhanced class that is primarily used to manage name spaces and organize Modelica code. A package has the restrictions of only containing declarations of classes, including all kinds of restricted classes, and constants. Variable declarations are not allowed. ", "Text"]], Closed]]], Open]], Cell[CellGroupData[List[Cell["Creating a Package", "Section"], Cell[TextData[List["Create a package that contains a division function (that divides two ", StyleBox["Real", Rule[FontFamily, "Courier"]], " numbers) and a constant k = 5."]], "Text"], Cell["", "ModelicaInput"], Cell["\nCreate a class, containing a variable x. The variable gets its value from the division function inside the package, which divides 10 by 5.", "Text"], Cell["", "ModelicaInput"], Cell["\nSimulate the class x and test the class by writing variableName[time], as below (let's choose time = 0):", "Text"], Cell[BoxData[RowBox[List["x", "[", "0", "]"]]], "Input"], Cell[CellGroupData[List[Cell["Answer", "Subsection"], Cell["package MyPackage\n  \n  function division\n    input Real a;\n    input Real b;\n    output Real result;\n  algorithm\n    result := a / b;\n  end division;\n  \n  constant Integer k = 5;\n  \nend MyPackage;", "ModelicaInput"], Cell["", "Text"], Cell["class MyPackInst\n  Real x = MyPackage.division(10, 5);\nend MyPackInst;", "ModelicaInput"], Cell[CellGroupData[List[Cell["Simulation of MyPackage", "Subsubsection"], Cell["simulate( MyPackage );", "ModelicaInput"], Cell[BoxData["\"<SimulationData: \\!\\(MyPackage\\) : 2004-2-2 13:5:31.6418228 : \\!\\({0.`, 1.`}\\) : 502 data points : 1 events : 3 variables>\\n\\!\\({\\*TagBox[\\\"\[UnderBracket]derdummy\\\", HoldForm], \\*TagBox[\\\"\[UnderBracket]dummy\\\", HoldForm], \\*TagBox[\\\"k\\\", HoldForm]}\\)\""], "Output"], Cell["simulate( MyPackInst );", "ModelicaInput"], Cell[BoxData["\"<SimulationData: \\!\\(MyPackInst\\) : 2004-2-2 13:5:37.3292864 : \\!\\({0.`, 1.`}\\) : 502 data points : 1 events : 3 variables>\\n\\!\\({\\*TagBox[\\\"\[UnderBracket]derdummy\\\", HoldForm], \\*TagBox[\\\"\[UnderBracket]dummy\\\", HoldForm], \\*TagBox[\\\"x\\\", HoldForm]}\\)\""], "Output", Rule[GeneratedCell, False], Rule[CellAutoOverwrite, False]], Cell[BoxData[RowBox[List["x", "[", "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[873, 907]], Rule[WindowMargins, List[List[0, Automatic], List[Automatic, 0]]], Rule[StyleDefinitions, "MathModelica.nb"]], Null, Null, Null, Null, Null]