I want to use constant travel times for the portal in a MultiPortalCrane, so I adjust the speed depending on the distance the crane has to travel.
Unfortunately if I change the speed using 'MultiPortalCrane.PortalSpeed' and then use 'Portal.MoveMuFromTo' to use the crane for a job in the same method then the speed isnt changed until after the job is complete.
Is there anyway to update the speed before using the MoveMuFromTo method?
Thanks in advance!
Solved! Go to Solution.
you can set the speed of the basic object Transporter, which is the Portal in the Crane library:
var Portal:object := MultiPortalCrane.cont
Portal.speed := 10
Unfortunately this does not work! Changing the speed attribute of the portal does not change the speed in the context menu and does not affect the speed of this portal.
Is there any other way to update the speed immediately?
you have to change the attribute PortalSpeed of the portal to modify the speed permanently.
Every move command of the portal uses this attribute to set the speed of the portal.
So your method has to look like:
var Crane : object := MultiPortalCrane var Portal := Crane.Portal1 print Portal.PortalSpeed // set the speed for next move command Portal.PortalSpeed := 2.4 // set the speed for curent movement Portal.speed := 3.2
Hope this helps.
Thank you for your response.
Unfortunately this is no different to what I have tried. See the follow code extract and output.
var new_speed : real := 0.25
var Portal : obj := MultiPortalCrane.Cont var dist : real := abs(Portal.XPos - A.XPos) + abs(A.XPos - B.XPos)
dist := dist * root.ScalingFactor
print "Previous speed: " num_to_str(Portal.Speed)
Portal.Speed := new_speed
print "Current speed: " num_to_str(Portal.Speed) MultiPortalCrane.PortalSpeed := new_speed
var start : real := EventController.SimTime Portal.MoveMUFromTo(A, B)
var duration : real := EventController.SimTime - start
print "Actual speed: " + num_to_str(dist/duration)
Previous speed: 0.5
Current speed: 0.25
Actual speed: 0.499997
1) don't use MultiportalCrane.cont to get the portal, use MultiportalCrane.Portal1 for the first portal and MultiportalCrane.Portal2 for the second portal and so on.
2) Is acceleration/deceleration switch on for the MultiportalCrane?
3) Can you provide the simulation model?
1) Portal1 etc. are not attributes of the MultiPortalCrane, so how can I use them?
2) The acceleration switch is off.
3) I will prepare a minimum working example now.
EDIT: I have also tried using MultiPortalCrane.getPortals to get the reference to the portal, which did not change the speed immediately either.