TimeGenerator timeGenerator=TimeGeneratorFactory.newTimeGenerator(properties);
long duration = timeGenerator.generateTime();
context.getStaffPoolManager().registerPool(pi.getProcessId(), node, 1);
StaffPool pool = context.getStaffPoolManager().getActivityPool(node.getName());
long waitTime = pool.allocate(context.getClock().getCurrentTime());
double resourceUtilization = pool.getResourceUtilization();
// ensure that duration will include wait time
duration += waitTime;
TimeUnit timeUnit = SimulationUtils.getTimeUnit(properties);
long durationInUnit = timeUnit.convert(duration, TimeUnit.MILLISECONDS);
double resourceCost = pool.getResourceCost() * durationInUnit;
context.getClock().advanceTime((duration), TimeUnit.MILLISECONDS);
// set end time for processinstance end time
context.setMaxEndTime(context.getClock().getCurrentTime());