Conveyor Builder - Rampas Aceleracion / Deaceleracion

Started by CristianD, May 22, 2026, 01:09:26 PM

Previous topic - Next topic

CristianD

Hola,

Es posible simular las rampas de aceleracion o deceleracion con este componente?
Un saludo

EasyPLC_Master

Here's an example of how you can customize start/stop acceleration ramps for conveyor belts (in this case, applied to the builder's conveyor belt)..
Here a conveyor belt is created with three modules and using this script code the up/down ramps are customized:

float sp = 0; //current speed value
float speed = 0.7f; //acceleration factor
float speedDec = 1.5f; //Decceleration factor
int stat = 0; // 0: stopped, 1: advance, 2: reverse

public void Init()
{
  IOManager.SetOutputDesc(0, "Advance Tray");
  IOManager.SetOutputDesc(1, "Reverse Tray");
}

public void Main()
{
if(IOManager.GetOutput(0))
{
if(stat != 1)
{
stat = 1;
sp = 0;
CB0.Reverse(false);
CB1.Reverse(false);
CB2.Reverse(false);
CB0.Advance(true);
CB1.Advance(true);
CB2.Advance(true);
}

sp += speed * Time.deltaTime;
if(sp > 1)
sp = 1;
CB0.Speed = sp;
CB1.Speed = sp;
CB2.Speed = sp;
}
else if(IOManager.GetOutput(1))
{
if(stat != 2)
{
stat = 2;
sp = 0;
CB0.Advance(false);
CB1.Advance(false);
CB2.Advance(false);
CB0.Reverse(true);
CB1.Reverse(true);
CB2.Reverse(true);
}

sp += speed * Time.deltaTime;
if(sp > 1)
sp = 1;
CB0.Speed = sp;
CB1.Speed = sp;
CB2.Speed = sp;
}
else
{
if(sp != 0)
{
sp -= speedDec * Time.deltaTime;
if(sp < 0)
{
sp = 0;
stat = 0;
CB0.Advance(false);
CB1.Advance(false);
CB2.Advance(false);
CB0.Reverse(false);
CB1.Reverse(false);
CB2.Reverse(false);
}
CB0.Speed = sp;
CB1.Speed = sp;
CB2.Speed = sp;
}
}
}

public void Physics()
{

}

public void Finish()
{
 
}

CristianD

Thanks for your support.

I have a few questions,
The acc/decc factor is in unit m/s? To confirm, are the values of 0.7m/s for acc and 1.5m/s for decc by default in your script?
Does the acc/dec needs to change every time from the script by changing the factor? or there will be a new entry parameter outside of the belt (as with the speed)?
Where I can find the code editor to add the script?



EasyPLC_Master

Hmm, those are very basic questions and it seems you don't have much experience with the software. We recommend you take a look at the digital twin course we have available on our website; it will be a good investment so you can design your own custom digital twins!

-> Master the creation of Industrial Digital Twins from scratch