Skip to content

jsanch/comp15hw4

Repository files navigation

----------------------------------------------------------------------------
 Assembly Line Simulator Part 2: Dispatcher/Scheduler Simulation.
----------------------------------------------------------------------------

////////////////////////////////// Overview ///////////////////////////////////

ALS is a Facility (Assemply Line) that processes packages.
Goal: Check the efficiency of an assembly line and how different workers change
productivity.

/////////////////////// Important structures / classes ////////////////////////

Packages-> Each package has an amount of units to be processed

PackageQueue -> A data structure (queue) to store  packages

Factory -> Packages are taken in by the Factory into a buffer(a queue), where
				 	 they await to be dispatched and worked on by several Assembly Lines.

AssemblyLine -> There are many AssemblyLines. They have an associated rate
								of work at which the process packages. They process Packages
								and then they ship them.

Dispatcher -> Decides where to send the packages. There are three versions of
							this class that assign packages to assembly lines using these
							criterion:
							v1) Smallest number of packages in the line
							v2) Smallest number od total units in the line
							v3) Smallest estimated time (total_units/rate)


//////////////////////// Struct and Class Interfaces //////////////////////////
 Package -> contains important information about each package.
	Imporntant Data:
    string order_number
    double unit_number
    double units_worked
    int time_Arrived
    int time_Shipped
    bool isShipped

    int assemblyLineID
Factory -> Handles input of Pkgs into a buffer(a queue) and runs Assembly Lines.
	Important Functions:
		Factort(int numAssemblyLines, double rates[] )
		int run()
		void getPkgOrder();

AssemblyLine -> Processes packages and outputs to console the shipping time.
	Important Functions:
		void process(Package * PkgOrder, int orderSize);
		void ship(Package * currentPkg);
	Imporntant Data:
		int number_of_Packages  //should be accessible to factory.
		int number_of_Units
		double estimatedTime

 Dispatcher -> controls what packages go to the AssemblyLine
  	Important Functions:
	    Dispatcher(AssemblyLine *list, int size);
	    void dispatch(PackageQueue *PkgBuffer, int PkgCount);
	    int al_do_work(int id);
	    void al_ship(int id, int timeUnit);
	    void distributeArrivingPkgs(int timeUnit);
	    void init_aLs(PackageQueue * arrivingPkgBuffer);
	    void dispatch_to_assembly(Package newPkg

PackageQueue ->  A queue implementation using linked lists.
	Important Functions:
		bool isEmpty();
    void enqueue(Package pkg);
    void dequeue();
    void display();
		Package * getFront();


///////////////////// Struct/Class Inheritance hierarchy //////////////////////

facmain
	Factory
		Dispatcher			//there is an important collaboration between
		AssemblyLine    // the Dispatcher and the AssemblyLine class
				Worker      // for ultimate efficiency, the Dispatcher has total control
				PackageQueue
					Package
					node

//////////////////////////// Compile Instructions /////////////////////////////

simply run the script contained in the compile file, also copied below

g++ -Wall -Wextra facmain.cpp factory.cpp AssemblyLine.cpp PackageQueue.cpp DispatcherPackage.cpp -o simp
g++ -Wall -Wextra facmain.cpp factory.cpp AssemblyLine.cpp PackageQueue.cpp DispatcherUnit.cpp -o simu
g++ -Wall -Wextra facmain.cpp factory.cpp AssemblyLine.cpp PackageQueue.cpp DispatcherTime.cpp -o simt





About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published