List[Null, Null, Null, Null, Null, Null, Null, Notebook[List[Cell[CellGroupData[List[Cell["Exercise 2", "Title"], Cell[CellGroupData[List[Cell["Using the Extends Clause in Redeclarations", "Section"], Cell[TextData[List["The next exercise will test if you know how to use an ", StyleBox["extends clause", Rule[FontSlant, "Italic"]], " when redeclaring."]], "Text"], Cell[TextData[List["\nFirst write a class ", StyleBox["A", Rule[FontFamily, "Courier"]], " with a ", StyleBox["Real", Rule[FontFamily, "Courier"]], " parameter salt."]], "Text"], Cell["", "ModelicaInput"], Cell[TextData[List["\n\nWe also need a class ", StyleBox["Asub", Rule[FontFamily, "Courier"]], " , extending ", StyleBox["A", Rule[FontFamily, "Courier"]], " and having two ", StyleBox["Real", Rule[FontFamily, "Courier"]], " parameters: ", StyleBox["pepper", Rule[FontFamily, "Courier"]], " and ", StyleBox["basil", Rule[FontFamily, "Courier"]], ". The parameter ", StyleBox["salt", Rule[FontFamily, "Courier"]], " shall be set to 20."]], "Text"], Cell["", "ModelicaInput"], Cell[TextData[List["\n\nThen we need a class ", StyleBox["AInst", Rule[FontFamily, "Courier"]], ", containing a variable ", StyleBox["a", Rule[FontFamily, "Courier"]], ", which is an instance of ", StyleBox["A", Rule[FontFamily, "Courier"]], ", in which you should set ", StyleBox["salt", Rule[FontFamily, "Courier"]], " to 100."]], "Text"], Cell["", "ModelicaInput"], Cell[TextData[List["\n\nWrite a class ", StyleBox["AIred", Rule[FontFamily, "Courier"]], ", extending ", StyleBox["AInst", Rule[FontFamily, "Courier"]], ". Also, change the ", StyleBox["type", Rule[FontSlant, "Italic"]], " of the component ", StyleBox["a", Rule[FontFamily, "Courier"]], " to ", StyleBox["AIsub", Rule[FontFamily, "Courier"]], " and set the ", StyleBox["pepper", Rule[FontFamily, "Courier"]], " parameter to 200."]], "Text"], Cell["", "ModelicaInput"], Cell[TextData[List["\n\nWrite a similar class ", StyleBox["AIred", Rule[FontFamily, "Courier"]], "2 that instead of extending ", StyleBox["AInst", Rule[FontFamily, "Courier"]], ", declares a component of type ", StyleBox["AInst", Rule[FontFamily, "Courier"]], ". As above, the ", StyleBox["type", Rule[FontSlant, "Italic"]], " of component ", StyleBox["a", Rule[FontFamily, "Courier"]], " should be changed to ", StyleBox["AIsub", Rule[FontFamily, "Courier"]], "."]], "Text"], Cell["", "ModelicaInput"], Cell[CellGroupData[List[Cell["Answer", "Subsection"], Cell[CellGroupData[List[Cell["Class A", "Subsubsection"], Cell["class A\n  parameter Real salt;\nend A;", "ModelicaInput"]], Closed]], Cell[CellGroupData[List[Cell["Class Asub", "Subsubsection"], Cell["class Asub\t\t\t\t\t\t\t\t\t\t// A2 is a subtype of A\n  extends A(salt = 20);\n  parameter Real pepper;\n  parameter Real basil;\nend Asub;  ", "ModelicaInput"]], Closed]], Cell[CellGroupData[List[Cell["Class AInst", "Subsubsection"], Cell["class AInst\n  replaceable A a(salt = 100);\t\t\t\t\t\nend AInst;", "ModelicaInput"]], Closed]], Cell[CellGroupData[List[Cell["Class AIred", "Subsubsection"], Cell["class AIred\n  extends AInst(redeclare Asub a(pepper = 200));\t// The result after redeclaration is \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Asub a(salt = 1, pepper = 200) \nend AIred;", "ModelicaInput"]], Closed]], Cell[CellGroupData[List[Cell["Class Ared", "Subsubsection"], Cell["class AIred2\n   AInst t(redeclare Asub a(pepper = 200));\nend AIred2", "ModelicaInput"]], Closed]], Cell[CellGroupData[List[Cell["Simulation of AIred", "Subsubsection"], Cell["simulate( AIred );", "ModelicaInput"], Cell[BoxData["\"<SimulationData: \\!\\(AIred\\) : 2004-1-30 12:44:25.5869219 : \\!\\({0.`, 1.`}\\) : 502 data points : 1 events : 5 variables>\\n\\!\\({\\*TagBox[\\(a . basil\\), HoldForm], \\*TagBox[\\(a . pepper\\), HoldForm], \\*TagBox[\\(a . salt\\), HoldForm], \\*TagBox[\\\"\[UnderBracket]derdummy\\\", HoldForm], \\*TagBox[\\\"\[UnderBracket]dummy\\\", HoldForm]}\\)\""], "Output"]], Closed]]], Closed]]], Open]]], Open]]], Rule[FrontEndVersion, "5.1 for Microsoft Windows"], Rule[ScreenRectangle, List[List[0, 1280], List[0, 951]]], Rule[WindowSize, List[911, 924]], Rule[WindowMargins, List[List[0, Automatic], List[Automatic, 0]]], Rule[StyleDefinitions, "MathModelica.nb"]], Null, Null, Null, Null, Null]