void updateStorage(double time, int site) {

		println("st0 before= " + daStorageUsed[0]);
		println("st1 before= " + daStorageUsed[1]);

		int size = vUnreleased.size();
		println("size=" + size + "; iMinClass=" + iMinClass);
		ReleaseStorage rs1 = null, rs2 = null;
		Vector<ReleaseStorage> vRemove = new Vector<ReleaseStorage>();
		
		for (int i = 0; i < size; i++) {
			rs1 = vUnreleased.elementAt(i);
			if ((rs1.releaseTime <= time & rs1.site == site) | site == -1) {
				
				// get the input storage;
				daStorageUsed[rs1.site] -= daStorageInput[rs1.activityNo];
				vRemove.add(rs1);

				/* release space from the completed workflow */
				if (rs1.lastActivity) {
					// find the last one which have been compeleted
					for (int k = 0; k < size; k++) {
						rs2 = vUnreleased.elementAt(k);
						
						// exchange the position
						if (rs2.activityNo == rs1.activityNo & rs2.releaseTime > rs1.releaseTime) {
							rs1.lastActivity = false;
							rs2.lastActivity = true;
						}
					}
					if (rs1.lastActivity || (rs2.lastActivity & rs2.releaseTime <= time))
						for (int j = 0; j < iSite; j++) {
							// get the output storage;
							daStorageUsed[j] -= daStorageOutput[rs1.activityNo]	* dmDist[rs1.activityNo][j];
						}
				}
			}
		}

		println("st0 after= " + daStorageUsed[0]);
		println("st1 after= " + daStorageUsed[1]);
		println("===============================");
		for (Iterator<ReleaseStorage> iter = vRemove.iterator(); iter.hasNext();) {
			ReleaseStorage element = iter.next();
			vUnreleased.remove(element);
		}
	}