Hi Ravi, I wrote:
I've created a test that illustrates the bug, which is attached and can be found at $PTII/ptolemy/actor/lib/test/auto/RecordMultiplication.xml in the devel tree.It will take me a day or two to get around to looking at this.
I had a look, and created the attached model, which replicates your image, has a Const with {a=12.3, b=14.4} and a Const with 10.2 both connected to a MultiplyDivide. This model fails in a similar fashion for me under Ptolemy II 5.0.1, 6.0.2 and 7.0.1. The workaround is to change the second Const to {a=10.2, b=10.2}, which will scale both records by 10.2. I agree that this is a little odd, but look at the section in the Expressions Chapter in volume 1 of the Ptolemy design doc: --start--The arithmetic operators +, --, *, /, and \% can be applied to records. If the records do not have identical fields, then the operator is applied only to the fields that match, and the result contains only the fields that match. Thus, for example,
{foodCost=40, hotelCost=100} + {foodCost=20, taxiCost=20} yields the result {foodCost=60}You can think of an operation as a set intersection, where the operation specifies how to merge the values of the intersecting fields. You can also form an intersection without applying an operation. In this case, using the \index{intersect function} intersect() function, you form a record that has only the common fields of two specified records, with the values taken from the first record. For example,
>> intersect({a=1, c=2}, {a=3, b=4}) {a=1} --end-- In your example one way to think of it is that you are multiplying two different types, a RecordToken and a Scalar. The argument can be made that the Scalar should multiply any elements of the Record that have the same type as the Scalar. One could construct a special actor that did this. The details about the tradeoffs of the design are somewhat murky, but through a random walk and discussion, the current implementation was what we arrived at. If you have an example that worked in 6.0 and fails in 7.0.1, then I could take a look. However, it could be that there was a bug fix that changed the behaviour between 6.0 and 7.0.1. I'm sorry I don't have a more exact answer, the complexities of the type system are many. _Christopher Saripalli, Ravi wrote:
I recently upgraded to "Ptoleny II Version 7.0.1" from version 6.0In earlier version, multiplying/addition of a RecordToken with an Integer or double worked well.But now I get the following error."Conversion is not supported from ptolemy.data.RecordToken .... the type string"Looks as though implementation of TypeResolution has changed somewhere. Can some one explainthe reason for this change. Image of test configuration in vergil is attached for clarity. regards Dr. Ravi Sankar Saripalli Senior Engineer (MIEAust., CPEng.) Aircraft Signature Management Air Vehicles Division Defence Science and Technology Organization (DSTO) 506 Lorimer Street, Vic. Tel: (613) 9626 7353 Fax: (613) 9626 7083 email: [EMAIL PROTECTED]*IMPORTANT:* This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email.------------------------------------------------------------------------
-- Christopher Brooks (cxh at eecs berkeley edu) University of California CHESS Executive Director US Mail: 337 Cory Hall Programmer/Analyst CHESS/Ptolemy/Trust Berkeley, CA 94720-1774 ph: 510.643.9841 fax:510.642.2718 (Office: 545Q Cory) home: (F-Tu) 707.665.0131 (W-F) 510.655.5480
<?xml version="1.0" standalone="no"?> <!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN" "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd"> <entity name="RecordMultiplication" class="ptolemy.actor.TypedCompositeActor"> <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="7.1.devel"> </property> <property name="SDF Director" class="ptolemy.domains.sdf.kernel.SDFDirector"> <property name="iterations" class="ptolemy.data.expr.Parameter" value="3"> </property> <property name="_location" class="ptolemy.kernel.util.Location" value="{175, 75}"> </property> </property> <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={571, 71, 813, 510}, maximized=false}"> </property> <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[600, 400]"> </property> <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="1.0"> </property> <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{300.0, 200.0}"> </property> <entity name="Const2" class="ptolemy.actor.lib.Const"> <property name="value" class="ptolemy.data.expr.Parameter" value="10.2"> </property> <doc>Create a constant sequence.</doc> <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon"> <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value"> </property> <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60"> </property> </property> <property name="_location" class="ptolemy.kernel.util.Location" value="{120, 230}"> </property> </entity> <entity name="MultiplyDivide" class="ptolemy.actor.lib.MultiplyDivide"> <property name="_location" class="ptolemy.kernel.util.Location" value="{370, 185}"> </property> </entity> <entity name="Test" class="ptolemy.actor.lib.Test"> <property name="correctValues" class="ptolemy.data.expr.Parameter" value="{{a=125.4, b=146.8}, {a=125.4, b=146.8}, {a=125.4, b=146.8}}"> </property> <property name="trainingMode" class="ptolemy.actor.parameters.SharedParameter" value="false"> </property> <property name="_location" class="ptolemy.kernel.util.Location" value="[490.0, 185.0]"> </property> </entity> <entity name="Const" class="ptolemy.actor.lib.Const"> <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE"> </property> <property name="value" class="ptolemy.data.expr.Parameter" value="{a=12.3, b=14.4}"> </property> <doc>Create a constant sequence.</doc> <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon"> <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value"> </property> <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60"> </property> </property> <property name="_location" class="ptolemy.kernel.util.Location" value="[100.0, 155.0]"> </property> </entity> <relation name="relation2" class="ptolemy.actor.TypedIORelation"> <property name="width" class="ptolemy.data.expr.Parameter" value="1"> </property> </relation> <relation name="relation3" class="ptolemy.actor.TypedIORelation"> <property name="width" class="ptolemy.data.expr.Parameter" value="1"> </property> </relation> <relation name="relation" class="ptolemy.actor.TypedIORelation"> <property name="width" class="ptolemy.data.expr.Parameter" value="1"> </property> </relation> <link port="Const2.output" relation="relation2"/> <link port="MultiplyDivide.multiply" relation="relation"/> <link port="MultiplyDivide.multiply" relation="relation2"/> <link port="MultiplyDivide.output" relation="relation3"/> <link port="Test.input" relation="relation3"/> <link port="Const.output" relation="relation"/> </entity>
<<inline: model-1.jpg>>