Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'DrModelica/' from commit '4aebc12187da9e57445cec7f37d41bd99709bf47'
- Loading branch information
Showing
207 changed files
with
48,188 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<!DOCTYPE OMNotebook> | ||
<Notebook> | ||
<GroupCell closed="false" > | ||
<GroupCell closed="false" > | ||
<TextCell style="Title" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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;">Exercise 1</p></body></html></Text> | ||
</TextCell> | ||
<GroupCell closed="false" > | ||
<TextCell style="Section" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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;">Access Control</p></body></html></Text> | ||
</TextCell> | ||
<TextCell style="Text" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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;"><br />Complete the classes <span style=" font-family:Courier New;">Access </span>and<span style=" font-family:Courier New;"> Acc </span>below. The variable <span style=" font-family:Courier New;">acc</span> is an instance of the class <span style=" font-family:Courier New;">Acc</span>, which contains the variables <span style=" font-family:Courier New;">a, b, c, d</span> and <span style=" font-family:Courier New;">e</span>, where <span style=" font-family:Courier New;">d</span> and <span style=" font-family:Courier New;">e</span> are protected. Where can the variables be set? Set a = 7.4 in the class Access.</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="true" > | ||
<Input>class Access | ||
... | ||
equation | ||
... | ||
end Access;</Input> | ||
<Output></Output> | ||
</InputCell> | ||
<TextCell style="Text" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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;"></p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="true" > | ||
<Input>class AccessInst | ||
Access acc; | ||
end AccessInst;</Input> | ||
<Output></Output> | ||
</InputCell> | ||
<GroupCell closed="false" > | ||
<TextCell style="Subsection" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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;">Answer</p></body></html></Text> | ||
</TextCell> | ||
<TextCell style="Text" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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 public variables <span style=" font-family:Courier New;">a, b</span> and <span style=" font-family:Courier New;">c</span> can be set in either class, while <span style=" font-family:Courier New;">d</span> and <span style=" font-family:Courier New;">e</span> must be set in class <span style=" font-family:Courier New;">Acc</span>. The variable a must be a parameter, since we want to change it in the class Access.</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="false" > | ||
<Input>class Access | ||
parameter Real a; | ||
Real b; | ||
Real c; | ||
protected | ||
Integer d, e; | ||
equation | ||
b = 2.0; | ||
c = 1.3; | ||
d = 5; | ||
e = 7; | ||
end Access;</Input> | ||
<Output>Ok</Output> | ||
</InputCell> | ||
<TextCell style="Text" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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;"><br />Since a is a parameter it can not be changed during simulation, so it can not be modified in the equation section.</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="false" > | ||
<Input>class AccessInst | ||
Access acc(a = 7.4); | ||
end AccessInst;</Input> | ||
<Output>Ok</Output> | ||
</InputCell> | ||
<TextCell style="Text" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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;"></p></body></html></Text> | ||
</TextCell> | ||
<GroupCell closed="false" > | ||
<TextCell style="Subsubsection" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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:12pt; font-weight:600; color:#000000;">Simulation of Access and AccessInst</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="false" > | ||
<Input>simulate( Access );</Input> | ||
<Output>[done]</Output> | ||
</InputCell> | ||
<TextCell style="Output" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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:Courier New; font-size:11pt; color:#000000;"></p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="false" > | ||
<Input>simulate( AccessInst );</Input> | ||
<Output>[done]</Output> | ||
</InputCell> | ||
<TextCell style="Output" > | ||
<Text><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"><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:Courier New; font-size:11pt; color:#000000;"></p></body></html></Text> | ||
</TextCell> | ||
</GroupCell> | ||
</GroupCell> | ||
</GroupCell> | ||
</GroupCell> | ||
</GroupCell> | ||
</Notebook> |
Oops, something went wrong.