Class Unit

java.lang.Object
  |
  +--swarm.BaseImpl
        |
        +--swarm.objectbase.SwarmObjectImpl
              |
              +--Unit
All Implemented Interfaces:
swarm.defobj.Create, swarm.defobj.CreateS, swarm.defobj.Customize, swarm.defobj.CustomizeS, swarm.defobj.DefinedObject, swarm.defobj.DefinedObjectS, swarm.defobj.Drop, swarm.defobj.DropS, swarm.defobj.GetName, swarm.defobj.GetNameS, PTHistogramPlottable, swarm.objectbase.SwarmObject, swarm.objectbase.SwarmObjectS

public class Unit
extends swarm.objectbase.SwarmObjectImpl
implements PTHistogramPlottable

The Unit class instances are micro unit in our virtual enterprise; i.e. the units where the steps required to build a product (to fulfill an order) are done

Author:
Pietro Terna (with Marco Remondino, Dario Landini, Nicola Ormezzano and Paolo Pelligra contributions)

Field Summary
 EndUnit anEndUnit
          the temporary address of an existing endUnit
 News aNews
          a news to be sent
 Unit aUnit
          the temporary address of an existing unit
 int countCostTypes
          the number of different values of fixed and variable costs, related to the number of production phases
 int countPhaseInventories
          the number of phase inventory choices, related to the number of production phases
 int countPhases
          the number of different production phases the unit is able to deal with (the 0 copy of this field is used for technical reasons)
 int currentState
          the current state of production phase (what are we doing) the current set is established by the order currently produced by this unit in this tick
 swarm.collections.ListImpl dailyProductionList
          the list containing the orders (if any) performed in a day, also via the inventories contained in our warehouse
 float dailySaleRevenues
          the daily revenues from the finished orders (sold)
 float dailyStoredComponentValue
          the daily evaluation of the stored component
 swarm.collections.ListImpl endUnitList
          the list of end units existing in our environment
 Order firstOrder
          the first order to be executed
 float[] fixedCosts
          our fixed and variable costs
 Order incomingOrder
          an order inserted in a news
 int informationDeepness
          how deep we look at production steps to propagate news (how many steps beyond the current production phase)
 InformationRuleMaster informationRuleMaster
          our rule master about information system
 InventoryRuleMaster inventoryRuleMaster
          our rule master about inventories
 boolean madeProduction
          a flag about using pieces in warehouse
 Warehouse myWarehouse
          our warehouse, if any
 swarm.collections.ListImpl newsList
          the list of the newses
 int nOfCostTypes
          the number of different values of fixed and variable costs, related to the number of production phases
 boolean nOfCostTypesDimensionOrRedimension
          dimension or the vectors fixedCosts and variableCosts for a simple unit or redimension for a complex one
 int nOfOrdersInNewses
          of order for which newses are propagated
 int nOfPhaseInventories
          the number of phase inventory choices, related to the number of production phases
 boolean nOfPhaseInventoriesDimensionOrRedimension
          dimension or the vector phaseInventories for a simple unit or redimension for a complex one
 int nOfPhasesToDealWith
          the number of different production phases the unit is able to deal with (the 0 copy of this field is used for technical reasons)
 boolean nOfPhasesToDealWithDimensionOrRedimension
          dimension or the vector unitProductionPhases for a simple unit or redimension for a complex one
 boolean[] phaseInventories
          our phase inventory choices
 Unit receivingUnit
          the temporary address of a unit to wich send a news
 boolean sensitive
          declaring unit sensitive to layers (in sequential batch processes
 swarm.collections.ListImpl sequentialBatchWaitingList
          the list of the orders in the waitingList to be produced as a sequential batch
 swarm.collections.ListIndex sequentialBatchWaitingListIndex
          its iterator
 swarm.collections.ListImpl standAloneBatchWaitingList
          the list of the orders in the waitingList, kept into myStandAloneBatchAssembler
 int temporaryCurrentState
           
 News toBeDroppedNews
          a news to be deleted a the arrive of the related order
 float totalCosts
          the costs from the beginning of the simulation
 float totalDailyCosts
          total daily fixed and variable costs
 float totalFinishedOrderCosts
          the costs of the finished orders
 float totalSaleRevenues
          the revenues from the beginning of the simulation
 float totalTickVariableCosts
          total tick variable costs
 swarm.collections.ListImpl unitList
          the list of the normal units existing in our environment
 int unitNumber
          the number identifying the unit
 int[] unitProductionPhases
          the unit production phase
 swarm.collections.ListImpl usableWaitingList
          the list of the orders in the waitingList, not kept into any parallel unit, such as a myProcurementAssembler
 boolean useNewses
          choosing if we use or not newses about incoming productions
 boolean useWarehouses
          choosing - global choice - if we use or not the warehouses (to provide or not inventories of our products)
 float[] variableCosts
          our fixed and variable costs
 swarm.collections.ListImpl waitingList
          the list of the orders to be executed
 swarm.collections.ListIndex waitingListIndex
          its iterator
 swarm.collections.ListImpl wholeOrderList
          the whole list of the orders
 
Constructor Summary
Unit(swarm.defobj.Zone aZone, swarm.collections.ListImpl ul, swarm.collections.ListImpl eul, VEFrameModelSwarm mo, InventoryRuleMaster rm, Warehouse wh, InformationRuleMaster irm, int idp, int noin, swarm.collections.ListImpl ol, ProcurementAssembler pa, StandAloneBatchAssembler ba, SequentialBatchAssembler sa, MyWriter col, AssigningTool at)
          the third constructor for Unit (with warehouses and newses)
Unit(swarm.defobj.Zone aZone, swarm.collections.ListImpl ul, swarm.collections.ListImpl eul, VEFrameModelSwarm mo, InventoryRuleMaster rm, Warehouse wh, swarm.collections.ListImpl ol, ProcurementAssembler pa, StandAloneBatchAssembler ba, SequentialBatchAssembler sa, MyWriter col, AssigningTool at)
          the first constructor for Unit (using warehouses)
Unit(swarm.defobj.Zone aZone, swarm.collections.ListImpl ul, swarm.collections.ListImpl eul, VEFrameModelSwarm mo, swarm.collections.ListImpl ol, ProcurementAssembler pa, StandAloneBatchAssembler ba, SequentialBatchAssembler sa, MyWriter col, AssigningTool at)
          the second constructor for Unit (without warehouses)
 
Method Summary
 void addTickVariableCosts()
          set the value of the total daily variable costs
 float getDailySaleRevenues()
          record the revenue from a dropped order
 float getDailyStoredComponentValue()
           
 java.lang.String getLabel()
          PTHistogramPlottable interface method: getLabel()
 int getNOfPhasesToDealWith()
          get the nOfPhasesToDealWith, i.e. the n. of different steps the unit is able to deal with
 int getPhaseNumberToProduceInventories()
           
 int getProductionPhase(int state)
          return the production phases of the unit
 boolean getSensitiveToLayers()
          getting sensitive status
 float getTotalCosts()
          return total costs
 float getTotalDailyCosts()
          return total daily costs
 float getTotalFinishedOrderCosts()
          return total costs from finished orders
 float getTotalInventoryFinancialCosts()
          return the financial costs of inventories
 float getTotalSaleRevenues()
          return the total revenue
 int getUnitNumber()
          get unit number
 boolean getUseWarehouseLocalChoice()
           
 double getValueToPlot()
          PTHistogramPlottable interface method: getValueToPlot()
 int getWaitingListLength()
          return the waiting list length
 void manageSequentialBatchWaitingList()
          managing off line the sequential batches (not considering warehouses)
 void removeFromWaitingList(Order o)
          removing from the waiting list
 void setFixedAndVariableCosts(float fc, float vc)
          setting fixed and variable costs
 void setNewsList(News aNews)
          putting a news in the newsList of the unit after checking list to avoid duplicated news
 void setNOfPhasesToDealWith(int ns)
          set the nOfPhasesToDealWith, i.e. the n. of different steps the unit is able to deal with
 void setNotSensitiveToLayers()
          declaring the end unsensitive to layers (its number is reported as negative in unitData/unitBasicData.txt)
 void setPhaseInventories(int fi)
          setting phase inventory choice
 void setProductionPhase(int ph)
          set unit production phases
 void setRedimensionTrue()
          set the necessity of redimensioning the vectors containing the parameters; see ($) below
 void setSequentialBatchWaitingList()
          copying the orders in sequentialBatchWaitingList, if the first order in the waiting list is in a sequential batch
 void setStandAloneBatchWaitingList()
          copying the orders in standAloneBatchWaitingList, if they are kept int a parallel unit, such as a myStandAloneAssembler
 void setStoredComponentDailyValue()
          record the daily value of inventories
 void setTotalCosts()
          cumulate the total daily costs it must be executed only once a day
 void setTotalDailyCosts()
          set the global sum of fixed (per day) and variable costs (per tick) it can be calculated several times in a day, as a sequence of partial values
 void setTotalInventoryFinancialCosts()
          record the cumulated financial costs of inventories
 void setTotalSaleRevenues()
          cumulatere the revenues from finished orders
 void setUnitNumber(int un)
          set unit number
 void setUsableWaitingList()
          copying the orders in the waitingList, if they are not kept into any parallel unit, such as a myProcurementAssembler or mySequentialBatchAssembler
 void setWaitingList(Order anOrder)
          Putting an order in the production waitingList of the unit (using a related objectif any) and deleting the related news
 void unitStep0()
          zeroing daily costs
 void unitStep1()
          production:

at the beginning of each time tick in the 'day', each unit looks for the order(s) (if any) to be executed; the production cycle is 'one unit of time' in a step of the recipe of an order in a tick of a day;

we can also use inventories
 void unitStep2()
          diffusion and accounting:

sending the orders to the subsequent production units;

making accounting operations
 void unitStep3()
           
 void unitStep4()
           
 
Methods inherited from class swarm.objectbase.SwarmObjectImpl
compare, describe, describeID, drop, getCompleteProbeMap, getDisplayName, getName, getProbeForMessage, getProbeForVariable, getProbeMap, getTypeName, getZone, perform, perform$with, perform$with$with, perform$with$with$with, respondsTo, setDisplayName, xfprint, xfprintid, xprint, xprintid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unitNumber

public int unitNumber
the number identifying the unit


sensitive

public boolean sensitive
declaring unit sensitive to layers (in sequential batch processes


nOfPhasesToDealWith

public int nOfPhasesToDealWith
the number of different production phases the unit is able to deal with (the 0 copy of this field is used for technical reasons)


countPhases

public int countPhases
the number of different production phases the unit is able to deal with (the 0 copy of this field is used for technical reasons)


nOfPhasesToDealWithDimensionOrRedimension

public boolean nOfPhasesToDealWithDimensionOrRedimension
dimension or the vector unitProductionPhases for a simple unit or redimension for a complex one


unitProductionPhases

public int[] unitProductionPhases
the unit production phase


currentState

public int currentState
the current state of production phase (what are we doing) the current set is established by the order currently produced by this unit in this tick


temporaryCurrentState

public int temporaryCurrentState

useWarehouses

public boolean useWarehouses
choosing - global choice - if we use or not the warehouses (to provide or not inventories of our products)


useNewses

public boolean useNewses
choosing if we use or not newses about incoming productions


madeProduction

public boolean madeProduction
a flag about using pieces in warehouse


unitList

public swarm.collections.ListImpl unitList
the list of the normal units existing in our environment


endUnitList

public swarm.collections.ListImpl endUnitList
the list of end units existing in our environment


waitingList

public swarm.collections.ListImpl waitingList
the list of the orders to be executed


waitingListIndex

public swarm.collections.ListIndex waitingListIndex
its iterator


usableWaitingList

public swarm.collections.ListImpl usableWaitingList
the list of the orders in the waitingList, not kept into any parallel unit, such as a myProcurementAssembler


standAloneBatchWaitingList

public swarm.collections.ListImpl standAloneBatchWaitingList
the list of the orders in the waitingList, kept into myStandAloneBatchAssembler


sequentialBatchWaitingList

public swarm.collections.ListImpl sequentialBatchWaitingList
the list of the orders in the waitingList to be produced as a sequential batch


sequentialBatchWaitingListIndex

public swarm.collections.ListIndex sequentialBatchWaitingListIndex
its iterator


dailyProductionList

public swarm.collections.ListImpl dailyProductionList
the list containing the orders (if any) performed in a day, also via the inventories contained in our warehouse


aUnit

public Unit aUnit
the temporary address of an existing unit


anEndUnit

public EndUnit anEndUnit
the temporary address of an existing endUnit


receivingUnit

public Unit receivingUnit
the temporary address of a unit to wich send a news


myWarehouse

public Warehouse myWarehouse
our warehouse, if any


firstOrder

public Order firstOrder
the first order to be executed


incomingOrder

public Order incomingOrder
an order inserted in a news


aNews

public News aNews
a news to be sent


toBeDroppedNews

public News toBeDroppedNews
a news to be deleted a the arrive of the related order


inventoryRuleMaster

public InventoryRuleMaster inventoryRuleMaster
our rule master about inventories


informationRuleMaster

public InformationRuleMaster informationRuleMaster
our rule master about information system


newsList

public swarm.collections.ListImpl newsList
the list of the newses


informationDeepness

public int informationDeepness
how deep we look at production steps to propagate news (how many steps beyond the current production phase)


nOfOrdersInNewses

public int nOfOrdersInNewses
of order for which newses are propagated


wholeOrderList

public swarm.collections.ListImpl wholeOrderList
the whole list of the orders


nOfCostTypes

public int nOfCostTypes
the number of different values of fixed and variable costs, related to the number of production phases


countCostTypes

public int countCostTypes
the number of different values of fixed and variable costs, related to the number of production phases


nOfCostTypesDimensionOrRedimension

public boolean nOfCostTypesDimensionOrRedimension
dimension or the vectors fixedCosts and variableCosts for a simple unit or redimension for a complex one


fixedCosts

public float[] fixedCosts
our fixed and variable costs


variableCosts

public float[] variableCosts
our fixed and variable costs


nOfPhaseInventories

public int nOfPhaseInventories
the number of phase inventory choices, related to the number of production phases


countPhaseInventories

public int countPhaseInventories
the number of phase inventory choices, related to the number of production phases


nOfPhaseInventoriesDimensionOrRedimension

public boolean nOfPhaseInventoriesDimensionOrRedimension
dimension or the vector phaseInventories for a simple unit or redimension for a complex one


phaseInventories

public boolean[] phaseInventories
our phase inventory choices


totalTickVariableCosts

public float totalTickVariableCosts
total tick variable costs


totalDailyCosts

public float totalDailyCosts
total daily fixed and variable costs


totalCosts

public float totalCosts
the costs from the beginning of the simulation


dailySaleRevenues

public float dailySaleRevenues
the daily revenues from the finished orders (sold)


totalSaleRevenues

public float totalSaleRevenues
the revenues from the beginning of the simulation


totalFinishedOrderCosts

public float totalFinishedOrderCosts
the costs of the finished orders


dailyStoredComponentValue

public float dailyStoredComponentValue
the daily evaluation of the stored component

Constructor Detail

Unit

public Unit(swarm.defobj.Zone aZone,
            swarm.collections.ListImpl ul,
            swarm.collections.ListImpl eul,
            VEFrameModelSwarm mo,
            InventoryRuleMaster rm,
            Warehouse wh,
            swarm.collections.ListImpl ol,
            ProcurementAssembler pa,
            StandAloneBatchAssembler ba,
            SequentialBatchAssembler sa,
            MyWriter col,
            AssigningTool at)
the first constructor for Unit (using warehouses)


Unit

public Unit(swarm.defobj.Zone aZone,
            swarm.collections.ListImpl ul,
            swarm.collections.ListImpl eul,
            VEFrameModelSwarm mo,
            swarm.collections.ListImpl ol,
            ProcurementAssembler pa,
            StandAloneBatchAssembler ba,
            SequentialBatchAssembler sa,
            MyWriter col,
            AssigningTool at)
the second constructor for Unit (without warehouses)


Unit

public Unit(swarm.defobj.Zone aZone,
            swarm.collections.ListImpl ul,
            swarm.collections.ListImpl eul,
            VEFrameModelSwarm mo,
            InventoryRuleMaster rm,
            Warehouse wh,
            InformationRuleMaster irm,
            int idp,
            int noin,
            swarm.collections.ListImpl ol,
            ProcurementAssembler pa,
            StandAloneBatchAssembler ba,
            SequentialBatchAssembler sa,
            MyWriter col,
            AssigningTool at)
the third constructor for Unit (with warehouses and newses)

Method Detail

setUnitNumber

public void setUnitNumber(int un)
set unit number


getUnitNumber

public int getUnitNumber()
get unit number


setNotSensitiveToLayers

public void setNotSensitiveToLayers()
declaring the end unsensitive to layers (its number is reported as negative in unitData/unitBasicData.txt)


getSensitiveToLayers

public boolean getSensitiveToLayers()
getting sensitive status


unitStep0

public void unitStep0()
zeroing daily costs


setUsableWaitingList

public void setUsableWaitingList()
copying the orders in the waitingList, if they are not kept into any parallel unit, such as a myProcurementAssembler or mySequentialBatchAssembler


setStandAloneBatchWaitingList

public void setStandAloneBatchWaitingList()
copying the orders in standAloneBatchWaitingList, if they are kept int a parallel unit, such as a myStandAloneAssembler


setSequentialBatchWaitingList

public void setSequentialBatchWaitingList()
copying the orders in sequentialBatchWaitingList, if the first order in the waiting list is in a sequential batch


manageSequentialBatchWaitingList

public void manageSequentialBatchWaitingList()
managing off line the sequential batches (not considering warehouses)


unitStep1

public void unitStep1()
production:

at the beginning of each time tick in the 'day', each unit looks for the order(s) (if any) to be executed; the production cycle is 'one unit of time' in a step of the recipe of an order in a tick of a day;

we can also use inventories


unitStep2

public void unitStep2()
diffusion and accounting:

sending the orders to the subsequent production units;

making accounting operations


unitStep4

public void unitStep4()

unitStep3

public void unitStep3()

setRedimensionTrue

public void setRedimensionTrue()
set the necessity of redimensioning the vectors containing the parameters; see ($) below


setProductionPhase

public void setProductionPhase(int ph)
set unit production phases


setFixedAndVariableCosts

public void setFixedAndVariableCosts(float fc,
                                     float vc)
setting fixed and variable costs


setPhaseInventories

public void setPhaseInventories(int fi)
setting phase inventory choice


getProductionPhase

public int getProductionPhase(int state)
return the production phases of the unit


setWaitingList

public void setWaitingList(Order anOrder)
Putting an order in the production waitingList of the unit (using a related objectif any) and deleting the related news


getWaitingListLength

public int getWaitingListLength()
return the waiting list length


removeFromWaitingList

public void removeFromWaitingList(Order o)
removing from the waiting list


setNewsList

public void setNewsList(News aNews)
putting a news in the newsList of the unit after checking list to avoid duplicated news


setNOfPhasesToDealWith

public void setNOfPhasesToDealWith(int ns)
set the nOfPhasesToDealWith, i.e. the n. of different steps the unit is able to deal with


getNOfPhasesToDealWith

public int getNOfPhasesToDealWith()
get the nOfPhasesToDealWith, i.e. the n. of different steps the unit is able to deal with


addTickVariableCosts

public void addTickVariableCosts()
set the value of the total daily variable costs


setTotalDailyCosts

public void setTotalDailyCosts()
set the global sum of fixed (per day) and variable costs (per tick) it can be calculated several times in a day, as a sequence of partial values


setTotalCosts

public void setTotalCosts()
cumulate the total daily costs it must be executed only once a day


getTotalDailyCosts

public float getTotalDailyCosts()
return total daily costs


getTotalCosts

public float getTotalCosts()
return total costs


getDailySaleRevenues

public float getDailySaleRevenues()
record the revenue from a dropped order


setTotalSaleRevenues

public void setTotalSaleRevenues()
cumulatere the revenues from finished orders


getTotalSaleRevenues

public float getTotalSaleRevenues()
return the total revenue


getTotalFinishedOrderCosts

public float getTotalFinishedOrderCosts()
return total costs from finished orders


setTotalInventoryFinancialCosts

public void setTotalInventoryFinancialCosts()
record the cumulated financial costs of inventories


getTotalInventoryFinancialCosts

public float getTotalInventoryFinancialCosts()
return the financial costs of inventories


setStoredComponentDailyValue

public void setStoredComponentDailyValue()
record the daily value of inventories


getDailyStoredComponentValue

public float getDailyStoredComponentValue()

getUseWarehouseLocalChoice

public boolean getUseWarehouseLocalChoice()

getPhaseNumberToProduceInventories

public int getPhaseNumberToProduceInventories()

getLabel

public java.lang.String getLabel()
PTHistogramPlottable interface method: getLabel()

Specified by:
getLabel in interface PTHistogramPlottable

getValueToPlot

public double getValueToPlot()
PTHistogramPlottable interface method: getValueToPlot()

Specified by:
getValueToPlot in interface PTHistogramPlottable