1
|
<?xml version="1.0" standalone="no"?>
|
2
|
<!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN"
|
3
|
"http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd">
|
4
|
<entity name="Python Actor Disconnected Composite Output" class="ptolemy.actor.TypedCompositeActor">
|
5
|
<property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="8.1.devel">
|
6
|
</property>
|
7
|
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList">
|
8
|
</property>
|
9
|
<property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:gamma.msi.ucsb.edu/OpenAuth/:8025:141:30">
|
10
|
</property>
|
11
|
<property name="TOP Provenance Recorder" class="org.kepler.provenance.ProvenanceRecorder">
|
12
|
</property>
|
13
|
<property name="module-dependencies" class="ptolemy.kernel.util.StringAttribute" value="provenance">
|
14
|
</property>
|
15
|
<property name="Reporting Listener" class="org.kepler.module.reporting.ReportingListener">
|
16
|
</property>
|
17
|
<property name="SDF Director" class="ptolemy.domains.sdf.kernel.SDFDirector">
|
18
|
<property name="iterations" class="ptolemy.data.expr.Parameter" value="1">
|
19
|
</property>
|
20
|
<property name="vectorizationFactor" class="ptolemy.data.expr.Parameter" value="1">
|
21
|
</property>
|
22
|
<property name="allowDisconnectedGraphs" class="ptolemy.data.expr.Parameter" value="false">
|
23
|
</property>
|
24
|
<property name="allowRateChanges" class="ptolemy.data.expr.Parameter" value="false">
|
25
|
</property>
|
26
|
<property name="constrainBufferSizes" class="ptolemy.data.expr.Parameter" value="true">
|
27
|
</property>
|
28
|
<property name="period" class="ptolemy.data.expr.Parameter" value="0.0">
|
29
|
</property>
|
30
|
<property name="synchronizeToRealTime" class="ptolemy.data.expr.Parameter" value="false">
|
31
|
</property>
|
32
|
<property name="timeResolution" class="ptolemy.actor.parameters.SharedParameter" value="1E-10">
|
33
|
</property>
|
34
|
<property name="Scheduler" class="ptolemy.domains.sdf.kernel.SDFScheduler">
|
35
|
<property name="constrainBufferSizes" class="ptolemy.data.expr.Parameter" value="constrainBufferSizes">
|
36
|
</property>
|
37
|
</property>
|
38
|
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
|
39
|
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
|
40
|
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Steve Neuendorffer</configure></property>
|
41
|
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
|
42
|
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure> <p>The SDF Director is often used to oversee fairly simple, sequential workflows in which the director can determine the order of actor invocation from the workflow. Types of workflows that would run well under an SDF Director include processing and reformatting tabular data, converting one data type to another, and reading and plotting a series of data points. A workflow in which an image is read, processed (rotated, scaled, clipped, filtered, etc.), and then displayed, is also an example of a sequential workflow that requires a director simply to ensure that each actor fires in the proper order (i.e., that each actor executes only after it receives its required inputs).</p> <p>The SDF Director is very efficient and will not tax system resources with overhead. However, this efficiency requires that certain conditions be met, namely that the data consumption and production rate of each actor in an SDF workflow be constant and declared. If an actor reads one piece of data and calculates and outputs a single result, it must always read and output a single token of data. This data rate cannot change during workflow execution and, in general, workflows that require dynamic scheduling and/or flow control cannot use this director. Additionally, the SDF Director has no understanding of passing time (at least by default), and actors that depend on a notion of time may not work as expected. For example, a TimedPlotter actor will plot all values at time zero when used in SDF. </p> <p>By default, the SDF Director requires that all actors in its workflow be connected. Otherwise, the director cannot account for concurrency between disconnected workflow parts. Usually, a PN Director should be used for workflows that contain disconnected actors; however, the SDF Director's allowDisconnectedGraphs parameter may also be set to true. The SDF Director will then schedule each disconnected "island" independently. The director cannot infer the sequential relationship between disconnected actors (i.e., nothing forces the director to finish executing all actors on one island before firing actors on another). However, the order of execution within each island should be correct. Usually, disconnected graphs in an SDF model indicate an error.</p> <p>Because SDF Directors schedule actors to fire only after they receive their inputs, workflows that require loops (feeding an actor's output back into its input port for further processing) can cause "deadlock" errors. The deadlock errors occur because the actor depends on its own output value as an initial input. To fix this problem, use a SampleDelay actor to generate and inject an initial input value into the workflow.</p> <p>The SDF Director determines the order in which actors execute and how many times each actor needs to be fired to complete a single iteration of the workflow. This schedule is calculated BEFORE the director begins to iterate the workflow. Because the SDF Director calculates a schedule in advance, it is quite efficient. However, SDF workflows must be static. In other words, the same number of tokens must be consumed/produced at every iteration of the workflow. Workflows that require dynamic control structures, such as a BooleanSwitch actor that sends output on one of two ports depending on the value of a 'control', cannot be used with an SDF Director because the number of tokens on each output can change for each execution.</p> <p>Unless otherwise specified, the SDF Director assumes that each actor consumes and produces exactly one token per channel on each firing. Actors that do not follow the one-token-per-channel firing convention (e.g., Repeat or Ramp) must declare the number of tokens they produce or consume via the appropriate parameters. </p> <p>The number of times a workflow is iterated is controlled by the director's iterations parameter. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. A value of 1, meaning that the director will run the workflow once, is often the best setting when building an SDF workflow. </p> <p>The amount of data processed by an SDF workflow is a function of both the number of times the workflow iterates and the value of the director's vectorizationFactor parameter. The vectorizationFactor is used to increase the efficiency of a workflow by increasing the number of times actors fire each time the workflow iterates. If the parameter is set to a positive integer (other than 1), the director will fire each actor the specified number of times more than normal. The default is 1, indicating that no vectorization should be performed. Keep in mind that changing the vectorizationFactor parameter changes the meaning of a nested SDF workflow and may cause deadlock in a workflow that uses it. </p> <p>The SDF Director has several advanced parameters that are generally only relevant when an SDF workflow contains composite components. In most cases the period, timeResolution, synchronizeToRealTime, allowRateChanges, timeResolution, and constrainBufferSizes parameters can be left at their default values.</p> <p>For more information about the SDF Director, see the Ptolemy documentation (http://ptolemy.eecs.berkeley.edu/papers/05/ptIIdesign3-domains/ptIIdesign3-domains.pdf).</p> </configure></property>
|
43
|
<property name="prop:allowDisconnectedGraphs" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether to allow disconnected actors in the workflow (by default, all actors are required to be connected). If disconnected actors are permitted, the SDF Director will schedule each disconnected 'island' independently. Nothing "forces" the director to finish executing all actors on one island before firing actors on another. However, the order of execution within each island should be correct. Usually, disconnected graphs in an SDF workflow indicate an error.</configure></property>
|
44
|
<property name="prop:allowRateChanges" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether dynamic rate changes are permitted or not. By default, rate changes are not permitted, and the director will perform a check to disallow such workflows. If the parameter is selected, then workflows that require rate parameters to be modified during execution are valid, and the SDF Director will dynamically compute a new schedule at runtime. This is an advanced parameter that can usually be left at its default value.</configure></property>
|
45
|
<property name="prop:constrainBufferSizes" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether buffer sizes are fixed. By default, buffers are fixed, and attempts to write to the buffer that cause the buffer to exceed its scheduled size result in an error. This is an advanced parameter that can usually be left at its default value.</configure></property>
|
46
|
<property name="prop:timeResolution" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The time precision used by this director. All time values are rounded to the nearest multiple of this number. The value is a double that defaults to "1E-10" (which is 10-10). This is an advanced parameter that can usually be left at its default value.</configure></property>
|
47
|
<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. A value of 1, meaning that the director will run the workflow once, is often the best setting when building an SDF workflow. </configure></property>
|
48
|
<property name="prop:vectorizationFactor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vectorizationFactor is used to increase the efficiency of a workflow by increasing the number of times actors fire each time the workflow iterates. If the parameter is set to a positive integer (other than 1), the director will fire each actor the specified number of times more than normal. The default is 1, indicating that no vectorization should be performed. Keep in mind that changing the vectorizationFactor parameter changes the meaning of a nested SDF workflow and may cause deadlock in a workflow that uses it. </configure></property>
|
49
|
<property name="prop:synchronizeToRealTime" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether the execution should synchronize to real time or not. By default, the director does not synchronize to real time. If synchronize is selected, the director will only process the workflow when elapsed real time matches the product of the period parameter and the iteration count. Note: if the period parameter has a value of 0.0 (the default), then selecting this parameter has no effect. This is an advanced parameter that can usually be left at its default value.</configure></property>
|
50
|
<property name="prop:period" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The time period of each iteration. The value is a double that defaults to 0.0, which means that the director does not increment workflow time. If the value greater than 0.0, the actor will increment workflow time each time it fires. This is an advanced parameter that can usually be left at its default value. </configure></property>
|
51
|
</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:gamma.msi.ucsb.edu/OpenAuth/:8025:160:2">
|
52
|
</property>
|
53
|
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.domains.sdf.kernel.SDFDirector">
|
54
|
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:directorclass:1:1">
|
55
|
</property>
|
56
|
</property>
|
57
|
<property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Director">
|
58
|
</property>
|
59
|
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Director">
|
60
|
</property>
|
61
|
<property name="_location" class="ptolemy.kernel.util.Location" value="{85, 120}">
|
62
|
</property>
|
63
|
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:director:1:1">
|
64
|
</property>
|
65
|
</property>
|
66
|
<property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={241, 0, 1039, 1092}, maximized=false}">
|
67
|
</property>
|
68
|
<property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[727, 942]">
|
69
|
</property>
|
70
|
<property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="1.0">
|
71
|
</property>
|
72
|
<property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{363.5, 471.0}">
|
73
|
</property>
|
74
|
<entity name="CompositeActor" class="ptolemy.actor.TypedCompositeActor">
|
75
|
<property name="_location" class="ptolemy.kernel.util.Location" value="[150.0, 215.0]">
|
76
|
</property>
|
77
|
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList">
|
78
|
</property>
|
79
|
<property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:gamma.msi.ucsb.edu/OpenAuth/:8025:156:24">
|
80
|
</property>
|
81
|
<port name="port" class="ptolemy.actor.TypedIOPort">
|
82
|
<property name="output"/>
|
83
|
<property name="_location" class="ptolemy.kernel.util.Location" value="[505.0, 185.0]">
|
84
|
</property>
|
85
|
</port>
|
86
|
<entity name="Expression" class="ptolemy.actor.lib.Expression">
|
87
|
<property name="expression" class="ptolemy.kernel.util.StringAttribute" value=""text"">
|
88
|
<property name="_hide" class="ptolemy.data.expr.Parameter" value="true">
|
89
|
</property>
|
90
|
</property>
|
91
|
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
|
92
|
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
|
93
|
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Xiaojun Liu, Edward A. Lee, Steve Neuendorffer</configure></property>
|
94
|
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
|
95
|
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Expression actor evaluates a specified expression (e.g., an addition or multiplication operation), which may reference the values of user-specified input ports, the current time, or the actor's iteration count. The actor outputs the value of the evaluated expression. </p> <p>Expressions are specified in the Ptolemy expression language via the expression parameter. For more information about the expression language, see http://ptolemy.eecs.berkeley.edu/papers/05/ptIIdesign1-intro/ptIIdesign1-intro.pdf. </p> <p>By default, the expression parameter is empty, and attempting to execute the actor without first specifying an expression generates an error. Expressions can refer to the values of inputs by the port name; to the current time by the identifier "time"; and to the current iteration count by the identifier "iteration." </p> <p>Input ports are created by the user and correspond to variables used in the specified expression. Currently, the Expression actor does not support input multiports. The actor requires all of its inputs to be present. If inputs are not all present, then the actor will generate an error. </p> <p>Note: the Expression actor can be used instead of many of the arithmetic actors, such as AddSubtract, MultiplyDivide, and TrigFunction. However, those actors will be usually be more efficient, and sometimes more convenient to use.</p></configure></property>
|
96
|
<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the value of the evaluated expression. The actor automatically determines the type based on the type of the input.</configure></property>
|
97
|
<property name="prop:expression" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An expression to evaluate. Expressions are specified in the Ptolemy expression language. For more information about the expression language, see http://ptolemy.eecs.berkeley.edu/papers/05/ptIIdesign1-intro/ptIIdesign1-intro.pdf. By default, the parameter is empty, and attempting to execute the actor without first specifying an expression generates an error. Expressions can refer to the values of inputs by the port name; to the current time by the identifier "time"; and to the current iteration count by the identifier "iteration."</configure></property>
|
98
|
</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:gamma.msi.ucsb.edu/OpenAuth/:8025:158:1">
|
99
|
</property>
|
100
|
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.Expression">
|
101
|
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:950:1">
|
102
|
</property>
|
103
|
</property>
|
104
|
<property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#MathOperationActor">
|
105
|
</property>
|
106
|
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#GeneralPurpose">
|
107
|
</property>
|
108
|
<property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
|
109
|
<property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="expression">
|
110
|
</property>
|
111
|
<property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
|
112
|
</property>
|
113
|
</property>
|
114
|
<property name="_location" class="ptolemy.kernel.util.Location" value="[125.0, 175.0]">
|
115
|
</property>
|
116
|
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:75:1">
|
117
|
</property>
|
118
|
</entity>
|
119
|
<entity name="Python Actor" class="ptolemy.actor.lib.python.PythonScript">
|
120
|
<property name="script" class="ptolemy.kernel.util.StringAttribute" value="# This is a simple actor that copies the input to the output. # You can remove the ports, add new ports, and modify the script. class Main : "Copy the inputs to the output." def fire(self) : token = self.input.get(0) self.output.broadcast(token) return ">
|
121
|
</property>
|
122
|
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
|
123
|
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
|
124
|
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Xiaojun Liu</configure></property>
|
125
|
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
|
126
|
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure> This actor executes a Python script. The default script has an input port and an output port. To view or edit the script, double-click on the actor. <p> As an example, a simplified version of the Scale actor can be implemented by the following script: </p> <pre> 1. class Main : 2. "scale" 3. def fire(self) : 4. if not self.input.hasToken(0) : 5. return 6. s = self.scale.getToken() 7. t = self.input.get(0) 8. self.output.broadcast(s.multiply(t)) </pre> Line 1 defines a Python class Main. This name is fixed. An instance of this class is created when the actor is initialized. Line 2 is a description of the purpose of the script. Lines 3-8 define the fire() method. In the method body, <i>input</i> and <i>output</i> are ports that have been added to the actor, and <i>scale</i> is a parameter added to the actor (these can be added in the XML that defines the actor instance in an actor library). The Main class can provide other methods in the Executable interface as needed. <p> In the script, use <code>self.actor</code> to access the actor. For example, <code>self.actor.getDirector()</code> returns the current director of the actor. For debugging, use <code>self.actor.debug(someMessage)</code>. The final message sent to the debug listeners of the actor will have the string "From script: " inserted at the beginning. To avoid generating the debug message when there are no listeners, use: <pre> if self.actor.isDebugging() : self.actor.debug(someMessage) </pre> <p> This class relies on Jython, which is a Java implementation of Python. </p> Follow the links below for more information about the Python language, licensing, downloads, etc. <p><a href="http://www.python.org" target="_top">Python</a></p> <p><a href="http://www.jython.org" target="_top">Jython</a></p> <p><a href="http://www.jython.org/docs/differences.html">Differences between Jython and the C version of Python</a></p> <p><a href="http://www.jython.org/Project/userguide.html#the-jython-registry">The Jython Registry</a> - information about how to set the search path. </p> </configure></property>
|
127
|
</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:545:1">
|
128
|
</property>
|
129
|
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.python.PythonScript">
|
130
|
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:545:1">
|
131
|
</property>
|
132
|
</property>
|
133
|
<property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#GeneralPurpose">
|
134
|
</property>
|
135
|
<property name="_editorFactory" class="ptolemy.vergil.toolbox.TextEditorConfigureFactory">
|
136
|
<property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="script">
|
137
|
</property>
|
138
|
</property>
|
139
|
<property name="_location" class="ptolemy.kernel.util.Location" value="{210, 185}">
|
140
|
</property>
|
141
|
<port name="input" class="ptolemy.actor.TypedIOPort">
|
142
|
<property name="input"/>
|
143
|
</port>
|
144
|
<port name="output" class="ptolemy.actor.TypedIOPort">
|
145
|
<property name="output"/>
|
146
|
</port>
|
147
|
</entity>
|
148
|
<relation name="relation" class="ptolemy.actor.TypedIORelation">
|
149
|
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
|
150
|
</property>
|
151
|
</relation>
|
152
|
<relation name="relation2" class="ptolemy.actor.TypedIORelation">
|
153
|
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
|
154
|
</property>
|
155
|
</relation>
|
156
|
<link port="port" relation="relation2"/>
|
157
|
<link port="Expression.output" relation="relation"/>
|
158
|
<link port="Python Actor.input" relation="relation"/>
|
159
|
<link port="Python Actor.output" relation="relation2"/>
|
160
|
</entity>
|
161
|
</entity>
|