|
| |
#======================================================================= # buncher.sl - Buncher lens control (with remote C++ calls) # # This program controls the voltage on a Buncher lens and also keeps # the display up-to-date. # # Note: output messages are generated in target.sl. # # Upon compilation, this SL program can be used as an exact replacement # for the BUNCHER.PRG program in the _Buncher example of SIMION 7.0. # # In this version, source code for both the SL implementations and # the remote calls to C++ code are included. You might try # using various combinations of implementations to gauge performance. # # HISTORY: # 2003-11 - ported to SL (D.J.Manura, Scientific Instrument Services, Inc.) # Based on the BUNCHER.PRG example in SIMION 7.0. # $Revision: 1.2 $ $Date: 2004/07/17 20:54:45 $ #======================================================================= adjustable switch_time = 1.7 # switch time (in microseconds) adjustable buncher_voltage = 900 # buncher deceleration voltage static update_flag = 1 # flag for updating PE surface display #-- remote subroutine declarations declaresub calc_tstep(tof, tstep) returns(tstep) remote(1) declaresub calc_voltage(tof) returns(voltage) remote(2) declaresub other_stuff(tof, color) returns(peupdate, color, do_mark) remote(3) #-- subroutines # (remote version) #sub tstep_adjust # # Let's make sure the time step ends right on the switch time. # ion_time_step = calc_tstep(ion_time_of_flight, ion_time_step) #endsub # (local version) sub tstep_adjust if ion_time_of_flight < switch_time ion_time_step = min(ion_time_step, switch_time-ion_time_of_flight) endif endsub # (remote version) #sub fast_adjust # adj_elect01 = calc_voltage(ion_time_of_flight) #endsub # (local version) sub fast_adjust adj_elect01 = if(ion_time_of_flight < switch_time, buncher_voltage, 0) endsub # (remote version) sub other_actions (update_pe_surface, ion_color, do_mark) = other_stuff(ion_time_of_flight, ion_color) if do_mark != 0 mark() endif endsub # (local version) #sub other_actions # if switch_time == ion_time_of_flight # (transition point) # ion_color = 3 # Set ion color to blue. # mark() # Mark ion location. # update_flag = 1 # Trigger PE surface update at next time step. # elseif update_flag == 1 # (time step immediately after transition point) # update_flag = 0 # update_pe_surface = 1 # Mark PE display for update. # endif #endsub |
|
Please report any errors/comments regarding this web page:
