Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Visualizing reports with BRL-CAD

Anonymous
2010-07-23
2013-04-22

  • Anonymous
    2010-07-23

    I work in warehouse. This warehouse consist of two parts: pallet racks and pickbin racks. After product is received, most of it is going to pallet location, and one or two boxes will be placed in the pickbin for easy access. But actually not all pickbins can be acceessed so easy, because for top levels you will need a ladder or something like that. That's why inventory clerks are trying to keep the product that picked more on low levels. In order to do that they print picking activity reports. Here is the example of such report:

    P51A011 ITEMNUMBER1 268
    P51A012 ITEMNUMBER2 770
    P51A013 ITEMNUMBER3 0
    P51A014 ITEMNUMBER4 166
    P51A015 ITEMNUMBER5 386
    P51A016 ITEMNUMBER6 857
    P51A021 ITEMNUMBER7 697
    P51A022 ITEMNUMBER8 926
    P51A023 ITEMNUMBER9 534
    P51A024 ITEMNUMBER10 470
    P51A025 ITEMNUMBER11 0
    P51A026 ITEMNUMBER12 430
    P51A031 ITEMNUMBER13 368
    P51A032 ITEMNUMBER14 905
    P51A033 ITEMNUMBER15 47
    P51A034 ITEMNUMBER16 0
    

    Format of the report is PICKBIN_NAME PRODUCT_NAME PICKS. Pickbins have names such as "P51A034", where 51 is number of aisle, 03 is number of pickbin, and 4 is the level. Inventory clerk looking at report can see that product in pickbin P51A026 (which is level 6) was picked 430 times, and product in pickbin P51A013 (which is level 3) was not picked at all, so he will swap the product between pickbins.

    I tried to somehow "visualize" picking activity report.

    Here is little shell script that will generate fake report (for testing):

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    #!/bin/bash
    AreaAisle="P51A"
    Bin="1"
    Zero="0"
    ItemNumber="ITEMNUMBER"
    Range=1000
    NoPicks=10
    until [ $Pickbin == "P51A566" ] ; do
            Bay=$(( Bay+1 ))
            if [ $Bay -eq 7 ]; then
                    Bay="1"
                    Bin=$(( Bin+1 ))
            fi
            if [[ $Bin -lt 10 && ${#Bin} -lt 2 ]] ; then
                    ZeroNeeded="yes"
            fi
            Pickbin=${AreaAisle}${ZeroNeeded:+0}${Bin}${Bay}
            ZeroNeeded=
            x=$(( x+1 ))
            Picks=$RANDOM
            let "Picks %= $NoPicks"
            if [ $Picks -eq 1 ]; then
                    Picks=0
            else
                    Picks=$RANDOM
                    let "Picks %= $Range"
            fi
            echo $Pickbin ${ItemNumber}${x} $Picks
    done
    

    Let's run it:

    ./generate_report.sh > picking_report
    

    Here is "visualizing" shell script:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    #!/bin/bash
    MGEDCommands="mged_commands"
    PickingActivityReport="picking_report"
    ReportSize=`sed -n '$=' $PickingActivityReport`
    MostActive=`sed 's/^[[:alnum:]]*[[:space:]][[:alnum:]]*[[:space:]]//g' $PickingActivityReport | sort -g | sed -n ${ReportSize}p`
    echo $MostActive
    exec 3>&1 # Save stdout in file descriptor 3
    exec >$MGEDCommands
    PickbinName=
    PickbinXDimension=54
    PickbinYDimension=38
    PickbinZDimension=36
    YDistanceBetweenPickbins=12
    ZDistanceBetweenPickbins=36
    SectionSpacer=36
    PickbinXCoord=0
    PickbinYCoord=0
    PickbinZCoord=0
    #echo y
    #echo nu
    for ((x = 1; x <= $ReportSize; x += 1))
    do
            PickbinName=`sed -n -e ${x}p $PickingActivityReport | sed 's/[[:space:]].*//'`
            Bay=${PickbinName:4:2}
            Bay=${Bay/#0/}
            Level=${PickbinName:6:1}
            PickbinActivity=`sed -n "${x}s/^[[:alnum:]]*[[:space:]][[:alnum:]]*[[:space:]]//gp" $PickingActivityReport`
            echo $PickbinName -- Bay $Bay Level $Level Activity $PickbinActivity >&3
            PickbinYCoord=$(( Bay*(PickbinYDimension+YDistanceBetweenPickbins)+((Bay-1)/8)*SectionSpacer ))
            PickbinZCoord=$(( Level*(PickbinZDimension+ZDistanceBetweenPickbins) ))
            echo in ${PickbinName}.s1 rpp $PickbinXCoord $(( PickbinXCoord+PickbinXDimension )) $PickbinYCoord $(( PickbinYCoord+PickbinYDimension )) $PickbinZCoord $(( PickbinZCoord+PickbinZDimension ))
            echo in ${PickbinName}.s1-1 rpp $(( PickbinXCoord+1 )) $(( (PickbinXCoord+PickbinXDimension)-1 )) $(( PickbinYCoord+1 )) $(( (PickbinYCoord+PickbinYDimension)-1 )) $(( PickbinZCoord+1 )) $(( PickbinZCoord+PickbinZDimension ))
            echo comb ${PickbinName}.c u ${PickbinName}.s1 - ${PickbinName}.s1-1
            echo comb Pickbins.c u ${PickbinName}.c
            if [ $PickbinActivity -ne 0 ]; then
                    ContentSize=`echo "scale = 10; ${PickbinZCoord}+((${PickbinZDimension}+12)*(${PickbinActivity}/${MostActive}))" | bc`
                    # ${PickbinZCoord}+((${PickbinZDimension+12})*(${PickbinActivity}/${MostActive})
                    echo in ${PickbinName}Content.s rpp $(( PickbinXCoord+2 )) $(( (PickbinXCoord+PickbinXDimension)-2 )) $(( PickbinYCoord+2 )) $(( (PickbinYCoord+PickbinYDimension)-2 )) $(( PickbinZCoord+1 )) $ContentSize
                    echo comb ${PickbinName}Content.c u ${PickbinName}Content.s
                    echo comb PickbinsContents.c u ${PickbinName}Content.s
            fi
    done
    for ((x = 1; x <= 6; x += 1 ))
    do
            echo in Tray${x}.s arb6
            echo 54 0 $(( (x*(36+36))+36 ))
            echo 54 0 $(( (x*(36+36)-18)+36 ))
            echo 54 3054 $(( (x*(36+36)-18)+36 ))
            echo 54 3054 $(( (x*(36+36))+36 ))
            echo 36 0 $(( (x*(36+36))+36 ))
            echo 36 3054 $(( (x*(36+36))+36 ))
            echo comb Trays.c- u Tray${x}.s
    done
    echo r Pickbins.r u Pickbins.c - Trays.c-
    echo mater Pickbins.r \"plastic tr 0.5\" 200 150 100 0
    echo r PickbinsContents.r u PickbinsContents.c
    echo mater PickbinsContents.r \"plastic\" 255 0 0 0
    echo g all Pickbins.r PickbinsContents.r
    echo B all
    echo ae 35 25
    echo zoom 2.5
    echo rt -W -A.7 -o test.pix -w 4096 -n 2048 -V4096:2048
    echo q
    echo Done! >&3
    exec 1>&3 3>&- # Restore stdout and close file descriptor 3
    /usr/brlcad/bin/mged -c test.g < $MGEDCommands
    #rm $MGEDCommands
    

    And here is the result:

    http://img841.imageshack.us/i/testm.png/

    Link to the full size picture:

    http://img841.imageshack.us/img841/6249/testm.png