StereoSystem: Why the startObjectBehavior actions?

Moderator: Moderators

StereoSystem: Why the startObjectBehavior actions?

Postby yshragai.firmware@gmail.com » Tue Jul 20, 2021 7:50 am

Hi,
In the StereoSystem example in MD 19.0:

The StereoSystem class has properties comprising 2 instances of Speaker class ("big", "small") and 1 instance of Player class ("dvd player").
And, the StereoSystem class has starting behavior "System init". In this behavior, it gets the property instances, and does a startObjectBehavior action on each one.

However, the property objects are already started as soon as the StereoSystem class is instantiated - apparently, as soon as you start the simulation, all of the start behaviors are started: For StereoSystem, for the "big" Speaker, for the "small" Speaker, and the "dvd player" Player.
And so, by the time the simulation gets to the startObjectBehavior actions in the "System init" activity, it doesn't (seem to) accomplish anything.

Attached is the Console log from running with Debug logging level.

Am I missing something?

Thanks!
You do not have the required permissions to view the files attached to this post.
yshragai.firmware@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 17
Posts Rating:0
Joined: Fri May 07, 2021 2:35 pm

Re: StereoSystem: Why the startObjectBehavior actions?

Postby saulius_p » Tue Jul 20, 2021 9:06 am

Hello,

Good to talk to you. Yes it is optional. Older style of modeling. You can actually treat all objects as active in simulation config so no need to activate them. You can delete whole System Init activity. Just do not forget to set sim config properties as identified in screenshot.

Kind regards,
Saulius

Capture.PNG
You do not have the required permissions to view the files attached to this post.
Best regards,
Saulius Pavalkis
User avatar
saulius_p
No Magic
No Magic
 
Posts: 310
Posts Rating:12
Joined: Fri Dec 04, 2009 5:37 am
Full name: Saulius Pavalkis

Re: StereoSystem: Why the startObjectBehavior actions?

Postby yshragai.firmware@gmail.com » Tue Jul 20, 2021 9:45 am

Thank you. Between your response and looking at the help pages (https://docs.nomagic.com/display/CST185 ... stereotype) and trying to piece things together, I (think I) get it now.

There's the SimulationConfig object, in the "simulation" package in the model. If you start the simulation via that simulation config (right click the SimulationConfig object, or (didn't even notice this) click play where it says "Stereo System" in the top left just under the menu bar), it actually starts things in the right sequence.
But if you start the simulation by right clicking the "Stereo System" class (in the "system" package) or the "stereo System" instance (in the "instances" package), everything starts up immediately, asynchronously.

Why?

Because, apparently, by default, Autostart Active Objects is True.
But, wait, all of the objects in the model have "is active" set to False!
Oh, but wait, there's also Treat All Classifiers As Active, which is True by default.
So, if you start the simulation by right-clicking the class or the instance, everything starts up together.

Whereas, in the SimulationConfig object, both Treat All Classifiers As Active and Autostart Active Objects have been reset to "undefined", which is effectively false.
So, if you start the simulation via the SimulationConfig object, things start up in an orderly fashion.

And by the way, those are "Tags", so if you are viewing the properties in "All" view, as opposed to "Expert" view, you'd have to go to the "Tags" category to see them.

Thanks!
yshragai.firmware@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 17
Posts Rating:0
Joined: Fri May 07, 2021 2:35 pm

Re: StereoSystem: Why the startObjectBehavior actions?

Postby saulius_p » Wed Jul 21, 2021 10:10 am

Hello,

Good to talk to you. You are right. Always start simulation from simulation config in other case you can not get simulation properties to take an desired effect just some default ones.

Sincerely,
Saulius
Best regards,
Saulius Pavalkis
User avatar
saulius_p
No Magic
No Magic
 
Posts: 310
Posts Rating:12
Joined: Fri Dec 04, 2009 5:37 am
Full name: Saulius Pavalkis


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests

cron