<!DOCTYPE OMNotebook>
<Notebook>
 <GroupCell closed="false" >
  <GroupCell closed="false" >
   <TextCell style="Title" >
    <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Arial; font-size:38pt; font-weight:600; color:#000000;">Modification Prefix Replaceable and Redeclare&lt;/p>&lt;/body>&lt;/html></Text>
   </TextCell>
   <GroupCell closed="false" >
    <TextCell style="Section" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:18pt; font-weight:600; color:#000000;">Replaceable&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <TextCell style="Text" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">A declared element of a class must have the prefix replaceable in oder to be redeclared, apart from redeclarations that only chnge the attribute value and/or restricts the variability and possibly the dimension sizes. The main motivation for this rule is that a class need to be &lt;span style=" font-style:italic;">designed&lt;/span> for inheritance that includes redeclaration. Otherwise unexpected errors may occur. &lt;br />&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>class MicroCircuit
  replaceable Resistor R1;
end MicroCircuit;
</Input>
     <Output></Output>
    </InputCell>
   </GroupCell>
   <GroupCell closed="true" >
    <TextCell style="Section" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:18pt; font-weight:600; color:#000000;">Connector Classes&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>type Voltage = Real(unit = "V");</Input>
     <Output></Output>
    </InputCell>
    <TextCell style="Text" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>type Current = Real(unit = "A");</Input>
     <Output></Output>
    </InputCell>
    <TextCell style="Text" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>connector Pin
  Voltage     v;
  flow Current   i;
end Pin;        </Input>
     <Output></Output>
    </InputCell>
   </GroupCell>
   <GroupCell closed="true" >
    <TextCell style="Section" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:18pt; font-weight:600; color:#000000;">Resistor and TempResistor&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>model Resistor  
  Pin       p, n                "Positive and Negative Pins";
  Voltage     v;
  Current     i;
  parameter Real R(unit = "Ohm")          "Resistance";
equation 
  v = R*i;
end Resistor;</Input>
     <Output></Output>
    </InputCell>
    <TextCell style="Text" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>model TempResistor                  "Temperature dependent Resistor"
  Pin       p, n                "Positive and Negative Pins";
  Voltage     v;
  Current     i;
  parameter Real R(unit = "Ohm")          "Resistance at reference Temperature";
  parameter Real RT(unit = "Ohm/degC")   = 0     "Temperature dependent Resistance";
  parameter Real Tref(unit = "degC")   = 20    "Reference Temperature";
  Real        Temp           = 20    "Actual Temperature";
equation 
  v = i*(R + RT*(Temp - Tref));
end TempResistor;</Input>
     <Output></Output>
    </InputCell>
    <TextCell style="Text" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>model SuperTempResistor                "Temperature dependent Resistor"
  Pin       p, n                "Positive and Negative Pins";
  Voltage     v;
  Current     i;
  parameter Real R(unit = "Ohm")          "Resistance at reference Temperature";
  parameter Real RT(unit = "Ohm/degC")   = 0     "Temperature dependent Resistance";
  parameter Real Tref(unit = "degC")   = 20    "Reference Temperature";
  Real        Temp           = 20    "Actual Temperature";
  parameter Boolean Super         = true;
equation 
  v = i*(R + RT*(Temp - Tref));
end TempResistor;</Input>
     <Output></Output>
    </InputCell>
   </GroupCell>
   <GroupCell closed="false" >
    <TextCell style="Section" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:18pt; font-weight:600; color:#000000;">Redeclare&lt;/p>&lt;/body>&lt;/html></Text>
     <Rule name="CellTags" >Redeclare</Rule>
    </TextCell>
    <TextCell style="Text" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">The &lt;span style=" font-family:Courier New;">redeclare&lt;/span> prefix is used at the front of a modifier containing a new variable or type declaration&lt;span style=" font-family:TimesNewRoman;"> t&lt;/span>hat &lt;span style=" font-style:italic;">replaces&lt;/span> the original variable or type declaration element in the modified class.The reason for requiring a special keyword like &lt;span style=" font-family:Courier New;">redeclare&lt;/span> is to reduce the risk for accidental programming errors that otherwise might occur when whole declarations are replaced by declarations of different types. &lt;br />&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>class TempMicroCiruit = MicroCircuit(redeclare TempResistor R1);
</Input>
     <Output></Output>
    </InputCell>
    <TextCell style="Text" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">&lt;br />In order to allow further redeclaration of a redeclared element the replaceable prefix should be present also in the modifier.&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>class TempMicroCiruit2 = MicroCircuit(redeclare replaceable TempResistor R1);
</Input>
     <Output></Output>
    </InputCell>
    <TextCell style="Text" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">&lt;br />In the class &lt;span style=" font-family:Courier New;">SuperTempMicroCircuit&lt;/span> the keyword &lt;span style=" font-family:Courier New;">replaceable&lt;/span> is left out, which means that no further redeclaration is possible.&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>class SuperTempMicroCiruit = TempMicroCiruit2(redeclare SuperTempResistor R1);
</Input>
     <Output></Output>
    </InputCell>
    <GroupCell closed="false" >
     <TextCell style="Subsection" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:14pt; font-weight:600; color:#000000;">GetFlatDefinition on MicroCircuit, TempMicroCiruit2&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <GroupCell closed="false" >
      <InputCell style="Input" closed="true" >
       <Input>GetFlatDefinition[ MicroCircuit ]
//ToModelica
</Input>
       <Output></Output>
      </InputCell>
      <TextCell style="Output" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">"model MicroCircuit\&lt;br />   Real(unit=\\"V\\") R1.p.v;\&lt;br />   flow Real(unit=\\"A\\") R1.p.i;\&lt;br />   Real(unit=\\"V\\") R1.n.v;\&lt;br />   flow Real(unit=\\"A\\") R1.n.i;\&lt;br />   Real(unit=\\"V\\") R1.v;\&lt;br />   Real(unit=\\"A\\") R1.i;\&lt;br />   parameter Real R1.R(unit=\\"Ohm\\") \\"Resistance\\";\&lt;br />   \&lt;br />equation\&lt;br />   R1.v = R1.R*R1.i ;\&lt;br />   \&lt;br />equation\&lt;br />   R1.p.i = 0;\&lt;br />   R1.n.i = 0 ;\&lt;br />end MicroCircuit;"&lt;/p>&lt;/body>&lt;/html></Text>
       <Rule name="GeneratedCell" >False</Rule>
       <Rule name="CellAutoOverwrite" >False</Rule>
      </TextCell>
     </GroupCell>
     <GroupCell closed="false" >
      <InputCell style="Input" closed="true" >
       <Input>GetFlatDefinition[TempMicroCiruit2]
//ToModelica
</Input>
       <Output></Output>
      </InputCell>
      <TextCell style="Output" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">"model TempMicroCiruit2\&lt;br />   Real(unit=\\"V\\") R1.p.v;\&lt;br />   flow Real(unit=\\"A\\") R1.p.i;\&lt;br />   Real(unit=\\"V\\") R1.n.v;\&lt;br />   flow Real(unit=\\"A\\") R1.n.i;\&lt;br />   Real(unit=\\"V\\") R1.v;\&lt;br />   Real(unit=\\"A\\") R1.i;\&lt;br />   parameter Real R1.R(unit=\\"Ohm\\") \\"Resistance at reference Temperature\\";\&lt;br />   parameter Real R1.RT(unit=\\"Ohm/degC\\")=0 \\"Temperature dependent Resistance\\";\&lt;br />   parameter Real R1.Tref(unit=\\"degC\\")=20 \\"Reference Temperature\\";\&lt;br />   Real R1.Temp=20 \\"Actual Temperature\\";\&lt;br />   \&lt;br />equation\&lt;br />   R1.v = R1.i*(R1.R+R1.RT*(R1.Temp-R1.Tref)) ;\&lt;br />   \&lt;br />equation\&lt;br />   R1.p.i = 0;\&lt;br />   R1.n.i = 0 ;\&lt;br />end TempMicroCiruit2;"&lt;/p>&lt;/body>&lt;/html></Text>
       <Rule name="GeneratedCell" >False</Rule>
       <Rule name="CellAutoOverwrite" >False</Rule>
      </TextCell>
     </GroupCell>
     <GroupCell closed="false" >
      <InputCell style="Input" closed="true" >
       <Input>GetFlatDefinition[SuperTempMicroCiruit]
//ToModelica
</Input>
       <Output></Output>
      </InputCell>
      <TextCell style="Output" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">"model SuperTempMicroCiruit\&lt;br />   Real(unit=\\"V\\") R1.p.v;\&lt;br />   flow Real(unit=\\"A\\") R1.p.i;\&lt;br />   Real(unit=\\"V\\") R1.n.v;\&lt;br />   flow Real(unit=\\"A\\") R1.n.i;\&lt;br />   Real(unit=\\"V\\") R1.v;\&lt;br />   Real(unit=\\"A\\") R1.i;\&lt;br />   parameter Real R1.R(unit=\\"Ohm\\") \\"Resistance at reference Temperature\\";\&lt;br />   parameter Real R1.RT(unit=\\"Ohm/degC\\")=0 \\"Temperature dependent Resistance\\";\&lt;br />   parameter Real R1.Tref(unit=\\"degC\\")=20 \\"Reference Temperature\\";\&lt;br />   Real R1.Temp=20 \\"Actual Temperature\\";\&lt;br />   parameter Boolean R1.Super=true;\&lt;br />   \&lt;br />equation\&lt;br />   R1.v = R1.i*(R1.R+R1.RT*(R1.Temp-R1.Tref)) ;\&lt;br />   \&lt;br />equation\&lt;br />   R1.p.i = 0;\&lt;br />   R1.n.i = 0 ;\&lt;br />end SuperTempMicroCiruit;"&lt;/p>&lt;/body>&lt;/html></Text>
       <Rule name="GeneratedCell" >False</Rule>
       <Rule name="CellAutoOverwrite" >False</Rule>
      </TextCell>
     </GroupCell>
    </GroupCell>
   </GroupCell>
  </GroupCell>
 </GroupCell>
</Notebook>
