int user_create_ray (double *delta_t, double *energy, double *cosx, double *cosy, double *cosz) { if (Num_Rays == 0) { if (-1 == SLexecute_function (Create_Ray)) { SLang_verror (0, "Encountered an error processing %s\n", "user_create_ray"); return -1; } if (SLang_peek_at_stack () == SLANG_NULL_TYPE) return -1; /* done */ if ((-1 == pop_array (&CosZ_Array)) || (-1 == pop_array (&CosY_Array)) || (-1 == pop_array (&CosX_Array)) || (-1 == pop_array (&Energy_Array)) || (-1 == pop_array (&dT_Array))) { SLang_verror (0, "Encountered an error processing %s\n", "user_create_ray"); return -1; } if (Num_Rays == 0) return -1; if (CosX_Array.num_elements < Num_Rays) CosX_Array.di = 0; if (CosY_Array.num_elements < Num_Rays) CosY_Array.di = 0; if (CosZ_Array.num_elements < Num_Rays) CosZ_Array.di = 0; if (dT_Array.num_elements < Num_Rays) dT_Array.di = 0; if (Energy_Array.num_elements < Num_Rays) Energy_Array.di = 0; } *cosx = next_element (&CosX_Array); *cosy = next_element (&CosY_Array); *cosz = next_element (&CosZ_Array); *delta_t = next_element (&dT_Array); *energy = next_element (&Energy_Array); Num_Rays--; return 0; }
void skaut_departure() { push_array(); int current_unit = (int) transfer[3]; int i = 0; for (i = NUM_MACHINES; i>=current_unit; i--) { //add delay if machine is broken or there is a broken machine before current one if (machine_broken[i] > 0.0) { if ((i == current_unit) || (list_size[1+number_of_machines + current_unit] < queue_size[1+current_unit])) { // if current machine is broken then delay it. event_schedule(PREP_TIME+sim_time + machine_broken[i], EVENT_SKAUT_DEPARTURE); //also if next queue is full then delay it. return; } // printf("Size of next queue %d, limit of next queue %d\n",list_size[1+number_of_machines + current_unit], queue_size[1+current_unit]); break; } } if (current_unit == MACHINES_ON_THE_LEFT_SIDE) { skaut_throughput += 2; sampst(sim_time - transfer[4], throughput_time); list_remove(FIRST,current_unit); } else { list_remove(FIRST,current_unit); pop_array(); transfer[3]++; event_schedule(PREP_TIME + sim_time + transfer_time[(int)(transfer[3])-1], EVENT_SKAUT_ARRIVAL); } if (list_size[number_of_machines + current_unit] != 0) { pop_array(); list_file(FIRST,current_unit); // first equals last because size should only be 1 pop_array(); list_remove(FIRST, number_of_machines + current_unit); pop_array(); sampst(sim_time - transfer[5], sampst_delays); sampst(sim_time - transfer[5], current_unit); event_schedule(PREP_TIME + sim_time + work_time[current_unit], EVENT_SKAUT_DEPARTURE); } }
void skaut_arrival() { push_array(); int current_unit = (int)transfer[3]; int i; for (i = NUM_MACHINES; i>=current_unit; i--) { //add delay if there is a broken machine before current one if (machine_broken[i] > 0.0) { if ((list_size[1+number_of_machines + current_unit] < queue_size[1+current_unit])||queue_size[1+current_unit] == 0) { // if current machine is broken then delay it.x event_schedule(PREP_TIME+sim_time + machine_broken[i] + work_time[current_unit], EVENT_SKAUT_ARRIVAL); //also if next queue is full then delay it. return; } } } // check if machine is not busy if (list_size[current_unit] == 0 && machine_broken[current_unit] == 0.0) { sampst(0.0, sampst_delays); sampst(0.0, current_unit); list_file(FIRST, current_unit); // last := first here because there are only to be 0 or 1 items in machine // schedule departure after machine processing time pop_array(); event_schedule(PREP_TIME + sim_time + work_time[current_unit], EVENT_SKAUT_DEPARTURE); } else { if (list_size[number_of_machines + current_unit] == queue_size[current_unit]) { event_schedule(PREP_TIME + sim_time + work_time[current_unit], EVENT_SKAUT_ARRIVAL); //also if queue is full then delay it. } else { transfer[5] = sim_time; list_file(LAST, number_of_machines + current_unit); if(list_size[current_unit] > queue_max_lengths[number_of_machines + current_unit]) { queue_max_lengths[current_unit] = list_size[number_of_machines + current_unit]; } } } }
void do_end_array(const basic_parsing_context<char_type>&) override { end_structure(); pop_array(); }
const Array::Temp Call_stack::eval_list(SV* string) { const int count = eval_sv(string, G_ARRAY); finish_call(); return Array::Temp(interp, pop_array(count), true); }
const Array::Temp Call_stack::sub_list(const Scalar::Value& ref) { const int count = sub_call(ref.get_SV(true), G_ARRAY); return Array::Temp(interp, pop_array(count), true); }
const Array::Temp Call_stack::sub_list(const char* const name) { const int count = sub_call(name, G_ARRAY); return Array::Temp(interp, pop_array(count), true); }