Hi Hans,

Sorry for the delay on getting back to you, the Tutorial and
Miniconference took up all my time and then some.

You wrote:
> From: <[EMAIL PROTECTED]>
> To: <ptolemy-hackers@bennett.EECS.Berkeley.EDU>
> Subject: Classes, instances and the user library again
> Date: Mon, 5 Feb 2007 17:57:44 +0100
> 
> Hello all,
> 
> this is yet another question regarding classes and instances. I am
> still not happy how the user library and classes are handled and I
> intend to achieve the following behavior:
> 
> After creating a model, i have an option to convert it to a class,
> save it to a file and then add an instance to the user library. Now
> i can build models using the classes (instances) from the user
> library and when changing the base class, all instances will change
> as well (no matter if they are opened or not). Furthermore,
> instances must be able to override attributes of the contained
> elements (e.g. mapping information), but elements from the instances
> should be removed whenever they are removed from the base class.
> 
> Problems now occur when editing the base class after instances have been
> created in other models:
> 
> - First, after changing the base class, changes are not propagated to
> all instances (as they don't defer to an actual entity but rather to the
> file on disk). Thus, every entity with a "source" attribute should look
> up in the actual file every time it is accessed. Or, this is easier, all
> open models should be "reloaded" after changing a base class.

I think that this has to do with having the class in the user library
instead of in the model.

If I:
1. Drag in a ramp actor
2. Set the step to 2
3. Rename the Ramp to RampTwo
4. Select "convert to class"
5. Select "Save Actor in library"

Then I have a class "RampTwo" in the user library.

If I create a model by dragging the RampTwo icon from the user library
into a new blank graph editor, then changing the RampTwo master
does not change the instances.

1. Create a new empty graph
2. Drag from UserLibrary -> RampTwo to the empty graph
3. Hook up a Display and add a SDF Director (iterations 5)
4. Edit the base class by right clickin on the UserLibrary
and select Open For Editing
5. Change the step to 2.5

The bug is that in our preexisting model, the step should change also.

I'm not so sure this is a bug, but perhaps is more a feature.  If the
class is in the model, then the changes propagate to the instances.

If the class is in the library, then we are working with an instance
of the class, so changing the master in the library does not change
all the instances.

I can see why you would want to be able to change all the instances
in this way, but it would add complexity and make classes in the
library behave differently than regular actors.  For example,
if you copy a regular actor into the library and then change parmeters
of the regular actor in the librar, should the parameter changes
propagate to the instances?  Probably not.

> - Second, when an element is removed from the class definition, it
> should not occur even if it has overridden some parameters before. Thus,
> when loading an instances, Ptolemy should check whether the
> entity/component is still present in the base class and delete it from
> the instance if necessary.

I'm not sure I totally understand.

If I have a  Composite Actor two ramps connected to an adder:

Ramp1 --> |
          | AddSubtract -->
Ramp2 --> |

and I convert it to a class,
and then create instances of the class,
I can't delete Ramp1, Ramp2 or AddSubtract.

BTW - one thing would be to be sure that you are using Ptolemy II
6.0.2.

Let me know what you think here,

_Christopher


> Maybe you can give me some suggestions,
> Hans
> 
> 
> ----------------------------------------------------------------------------
> Posted to the ptolemy-hackers mailing list.  Please send administrative
> mail for this list to: [EMAIL PROTECTED]

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to