question

Raul Vazquez avatar image
0 Likes"
Raul Vazquez asked Raul Vazquez commented

Match Speed of conveyor using code

Hi team,

Could you please let me know how i can do below using code.

Main goal: .Use a global table to assign velocity based in units per minute--


  1. Read the conveyor Type
    • Conveyor_Type
  2. Read the units per minuter assigned to the conveyor type
    • UnitsMinute= 5
    • ratebyunit=min/UnitsMinute=12 (secs)
  3. Based in conveyor type read every conveyor length that have assigned the conveyor type above.
    • Conveyor_lenght = Model.find("Conveyor1").as(Object).size.x (meters)
  4. Dinamyc velocity based in the lenght of the conveyor and units per minute assign the velocity by conveyor
    • velocity= Conveyor_lenght/ratebyunit


thx



FlexSim 20.2.2
conveyorflexsim 20.2.2
1602521988175.png (9.4 KiB)
1602522091697.png (16.0 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Raja Sekaran avatar image
0 Likes"
Raja Sekaran answered Raul Vazquez commented

@Raul Vazquez

I have built a sample model and attached it here for your reference. Using the below code to update the conveyor speed based on the global table input.

int grpConvLength = Group("ConvGroup").length;
for(int i=1; i<=grpConvLength; i++)
{
    Object objConv = groupmember("ConvGroup",i);
    Variant varConvType = Model.find(objConv.name+">variables/type").value;
    string strConvType = varConvType.name;
    double dblUnitsPerMin;
    if(strConvType == Table("GlobalTable1")["Row 1"]["ConvType"])
    {
        dblUnitsPerMin = Table("GlobalTable1")["Row 1"]["UnitsPerMin"];
    }
    else
    {
        dblUnitsPerMin = Table("GlobalTable1")["Row 2"]["UnitsPerMin"];
    }
    double dblUnitsPerSec = 60/dblUnitsPerMin;
    double dblConvLength = Model.find(objConv.name+">variables/length").value;
    double dblConvSpeed = dblConvLength/dblUnitsPerSec;
    Model.find("ConveyorSystem>variables/conveyorTypes/"+strConvType+"/speed").value = dblConvSpeed;
}

First, I have added all the conveyors into the group called "ConvGroup" and then check the conveyor type and update the speed of the conveyor based on the global table input.

Note: I put the above code in the queue reset trigger. Also, conveyors fall under the same conveyor type should have the same length.

ConveyorSpeedSupport_v1.fsm

Let me know if this is what you are trying to achieve.

Thanks



· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Raul Vazquez avatar image Raul Vazquez commented ·

Thanks a lot for the code , I would need to do some adjustment but this help me to have the main code of reference...thanks



0 Likes 0 ·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Raul Vazquez commented

The conveyor type variables are stored in an SDT so to set them you need to use this syntax:

treenode sdt=Model.find("/Tools/ConveyorSystem>variables/conveyorTypes/ConveyorType1");
setsdtvalue(sdt,"speed",3);


The type is referenced by the conveyor variable 'type which is a pointer which for a given conveyor can be found like this:

treenode conveyor=Model.find("Conveyor2");
treenode typesdt=node(">variables/type+",conveyor);


Note: Altering the speed of a conveyor doesn't necessarily change the unit rate as you are limited by the rate from upstream equipment.

It does:

  1. Change the travel time from one end to another (obviously)
  2. Change the running free capacity of the conveyor and therefore its ability to accumulate (and therefore buffer between machines)
  3. Change the maximum unit rate in and out of the conveyor (0% free capacity).
  4. Affect the accumulation rate on the conveyor and on upstream conveyors where the speeds differ.

Historically we often saw a V shape in the conveyor speeds between equipment with more free capacity in the middle (faster conveyors). Also often the whole V group would ramp in speed relative the the machine speeds it was serving.



· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Raul Vazquez avatar image Raul Vazquez commented ·

Thanks a lot for the syntax ...

0 Likes 0 ·