Changing conveyor Speed & Acceleration

Hi all !

I’m trying to design a conveyor that would speed up a part on a signal input, here’s what it looks like :

I tried to modify the conveyor path speed, wich works fine, but it does not seem that it takes path acceleration/deceleration value.

I saw in this post that it is possible to modify the property pathVelocity & patAcceleration of a component.

I tried that, but nothing really happens visually.

Additionnally, i’d like to be able to stop my conveyor on a signal input taking the acceleration into account.

Do you have any advice ?
Hereunder the code I tried :

from vcScript import *

comp = getComponent()
app = getApplication()
sim = app.Simulation
path = comp.findBehaviour(‘OneWayPath’)
SignalIn = comp.findBehaviour(“SignalIn”)
SignalFullOn = comp.findBehaviour(“SignalFullOn”)
SignalComponent = comp.findBehaviour(“ComponentSignal”)

def OnSignal (signal):
pass

def OnRun():
while True:

triggerCondition(lambda: getTrigger() == SignalIn and SignalIn.Value == True)
skid = path.Component
path.Capacity = 1
skid = path.Component
print "A= ", skid.PathAcceleration, '\n'
print "D= ", skid.PathDeceleration
print "V= ", skid.PathVelocity
triggerCondition(lambda: getTrigger() == SignalFullOn and SignalIn.Value == True)
#skid.PathVelocity = 800
path.Speed = 300

Hello,
To access paths speed value you need to add something like this to the begin of your code:
speed = path.getProperty(“Speed”)

and same for acceleration and deceleration

acceleration = path.getProperty(“Acceleration”)
deceleration = path.getProperty(“Deceleration”)

then when you want to change these values you can do it like this:
speed.Value = “put any number you want here”
acceleration.Value = “put any number you want here”
deceleraion.Value = “put any number you want here”

Just remember that when those values are changed like this they wont go back to their default values when you restart simulation but rather they keep the latest given value. So if you want default speeds at the begin of your simulation you need to set them in your code.

Hi,

Thank you for your answer.
I ended up writing a bit of code to manually override the path speed, it looks something like this :

while currentSpeed != targetSpeed :

    speedViewer.Value = currentSpeed
    time = sim.SimTime
    delay(0.01)
    
    if currentSpeed < targetSpeed:
      currentSpeed = currentSpeed + acceleration * (sim.SimTime-time)
      if currentSpeed >= targetSpeed:
       currentSpeed = targetSpeed
       path.Speed = currentSpeed
       print "currentSpeed rose to targetSpeed "
       print "Initial Speed = ", initialSpeed," mm/s // Target Speed = ", targetSpeed," mm/s // Time Taken = ", sim.SimTime-motionChangeTimeStamp, " s // Distance Travelled = ",0.5*acceleration*pow(sim.SimTime-motionChangeTimeStamp,2)," mm"
      else:
       path.Speed = currentSpeed

Works fine, for anyone wondering, you simply cannot use the path acceleration/decelaration property to modify the speed of the path on the fly. Gotta do it yourself :slight_smile: