Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed some small bugs in OMNotebook
* updated Mathematica parser in OMNotebook * updated the OMNotebookHelp.onb documentation * converted DrModelica to OMNotebook // Anders Fernström git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk/OMNotebook/DrModelica@2247 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
x05andfe
committed
Mar 24, 2006
0 parents
commit 17aeedc
Showing
207 changed files
with
27,968 additions
and
0 deletions.
There are no files selected for viewing
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,120 @@ | ||
<!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;">Demonstration of 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 />Members of a Modelica class can have two levels of visibility: <span style=" font-family:Courier New;">public</span> or <span style=" font-family:Courier New;">protected</span>. The default is <span style=" font-family:Courier New;">public</span> if nothing else is specified. Publically declared variables can be can be read or updated by any code with access to that class. Variables that are declared protected can be reched only by code inside the class as well as code in classes that inherit this class. However, only code inside the class is allowed access to the same instance of a protected variable. You can read more about <a href="Inheritance/ProtectedElements.onb | ||
"><span style=" text-decoration: underline; color:#0000ff;">Private and Protected Elements</span></a>.</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;">AccessDemo</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 variables <span style=" font-family:Courier New;">a, x, z </span>and <span style=" font-family:Courier New;">u3</span> is public and <span style=" font-family:Courier New;">w, u </span>and <span style=" font-family:Courier New;">u2</span> are protected in the <span style=" font-family:Courier New;">AccessDemo</span> class</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="true" > | ||
<Input>class AccessDemo "Illustration of access prefixes" | ||
parameter Real a = 2; | ||
public Real x, z; | ||
parameter Real y; | ||
protected | ||
parameter Real w, u; | ||
Real u2; | ||
public Real u3; | ||
equation | ||
x = 2; // Legal, since code inside the class | ||
z = 5; // Legal, since code inside the class | ||
u2 = 5; // Legal, since code inside the class | ||
u3 = 8; // Legal, since code inside the class | ||
end AccessDemo; | ||
</Input> | ||
<Output></Output> | ||
</InputCell> | ||
</GroupCell> | ||
<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;">Simulation of AccessDemo</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="true" > | ||
<Input>simulate( AccessDemo );</Input> | ||
<Output></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 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;">A</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;">In <span style=" font-family:Courier New;">A</span> an illegal modification is done, since <span style=" font-family:Courier New;">w</span> is protected it can not be modified if <span style=" font-family:Courier New;">AccessDemo</span> is not inherited.</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="true" > | ||
<Input>class A | ||
AccessDemo ad(a = 2, y = 7, w = 7); // Illegal, since AccessDemo is not inherited | ||
end A; | ||
</Input> | ||
<Output></Output> | ||
</InputCell> | ||
</GroupCell> | ||
<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;">Simulation of AccessDemo, A and B</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;">Here we can see that if we try to simulate class <span style=" font-family:Courier New;">A</span> with the erroneous modification"w = 7" we get a warning for trying to modify a protected variable.</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="true" > | ||
<Input>simulate( A );</Input> | ||
<Output></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="true" > | ||
<Input>getLog();</Input> | ||
<Output></Output> | ||
</InputCell> | ||
<TextCell style="" > | ||
<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-size:8pt;"><span style=" font-family:Times New Roman; font-size:12pt; color:#000000;">ShowLog::shlg: "\\!\\(\"Instantiation started\\\<br />Warning: Modifier for protected component w. This is not legal Modelica.\\\<br /> File: c:\\\\\\\\cvsroot\\\\\\\\mathmo~1\\\\\\\\workdir\\\\\\\\model.mo, line 90\\\<br /> Context: A.ad.w\\\<br />Original declaration of w:\\\<br /> File: c:\\\\\\\\cvsroot\\\\\\\\mathmo~1\\\\\\\\workdir\\\\\\\\model.mo, line 101\\\<br /> Context: AccessDemo.w\\\<br />\\\<br />Logged connection equations:\\\<br /> 0 default connections generated.\\\<br />- savelog\\\<br />- translateModel(\\\\\"A\\\\\")\\\<br />Translation started\\\<br /> \\\<br />STATISTICS\\\<br /> \\\<br />Original Model\\\<br /> Number of components: 2\\\<br /> Variables: 8\\\<br /> Constants: 0\\\<br /> Parameters: 4 (4 scalars)\\\<br /> Unknowns: 4 (4 scalars)\\\<br /> Differentiated variables: 0\\\<br /> Equations: 4\\\<br /> Nontrivial : 0\\\<br />\\\<br /> \\\<br />Translated Model\\\<br /> Constants: 4 scalars\\\<br /> Free parameters: 4 scalars\\\<br /> Parameter depending: 0\\\<br /> Inputs: 0\\\<br /> Outputs: 0\\\<br /> Continuous time states: 0\\\<br /> Time-varying variables: 0\\\<br /> Alias variables: 0\\\<br /> Number of mixed real/discrete systems of equations: 0\\\<br /> Sizes of linear systems of equations: { }\\\<br /> Sizes after manipulation of the linear systems: { }\\\<br /> Sizes of nonlinear systems of equations: { }\\\<br /> Sizes after manipulation of the nonlinear systems: { }\\\<br /> Number of numerical Jacobians: 0\\\<br /> \\\<br />Warning: The following parameter has no default value\\\<br /> ad.u\\\<br />Finished\\\<br />- savelog\\\<br />\"\\)."</span></p></body></html></Text> | ||
</TextCell> | ||
</GroupCell> | ||
<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;">B</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;">In the class B <span style=" font-family:Courier New;">AccessDemo</span> is inherited, then it is legal to change the value u<span style=" font-family:Courier New;">2</span>.</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="true" > | ||
<Input>class B | ||
extends AccessDemo; | ||
Real p, q; | ||
equation | ||
u2 = p; // Legal, since AccessDemo is inherited | ||
u3 = q; // Legal, since u3 is public | ||
end B; | ||
</Input> | ||
<Output></Output> | ||
</InputCell> | ||
</GroupCell> | ||
<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;">Simulation of B</p></body></html></Text> | ||
</TextCell> | ||
<InputCell style="Input" closed="true" > | ||
<Input>simulate( B );</Input> | ||
<Output></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> | ||
</Notebook> |
Oops, something went wrong.