Please assist. I'm trying to create a method to control the exit strategy for a PickAndPlace object in Tecnomatix Plant Simulation using SimTalk 2.0. The PickAndPlace object is supposed to select the first available machine (not Failed or not occupied) on the line, where two "Assembly" Stations are processing MUs. The Assembly stations have different failure settings and this may lead to one failing while the other is available. I need the PickAndPlace object to skip the station with a "Failed" state and supply the available one, but to also supply both stations using the "Cyclic" exit strategy when both are available. This strategy allows for equal distribution of MUs between the 2 stations when both are available.

I have tried writing the following novice code to get the job done, but the PickAndPlace object is continuously selecting MillingM1 even when MillingM2 is available. Please assist in adjusting the code to produce desired results and to be more efficient.


var nextDelivery := 1


switch nextDelivery

    case 1

    if MillingM1.empty AND not MillingM1.Failed

        @.move(MillingM1)

        nextDelivery = 2

    elseif MillingM2.empty AND not MillingM2.Failed

        @.move(MillingM2)

        nextDelivery = 1

    elseif MillingM1.Failed OR not MillingM1.empty

        @.move(MillingM2)

        nextDelivery = 1

    elseif MillingM2.Failed OR not MillingM2.empty

        @.move(MillingM1)

        nextDelivery = 2
    end

    case 2

        if MillingM2.empty AND not MillingM2.Failed

                @.move(MillingM2)

                nextDelivery = 1

            elseif MillingM1.empty AND not MillingM1.Failed

                @.move(MillingM1)

                nextDelivery = 2

            elseif MillingM2.Failed OR not MillingM2.empty

                @.move(MillingM1)

                nextDelivery = 2

            elseif MillingM1.Failed OR not MillingM1.empty

                @.move(MillingM2)

                nextDelivery = 1

            end

    end

0

There are 0 best solutions below