2 //=============================================================================
6 * Event supplier for visualization of scheduling behavior, using
7 * arrival and dispatch data logged by an EC dispatch command object
9 * @author Chris Gill (cdgill@cs.wustl.edu) Adapted from the orginal DOVE simulation event supplier written by Michael Kircher (mk1@cs.wustl.edu)
11 //=============================================================================
17 #include "orbsvcs/RtecEventChannelAdminS.h"
18 #include "orbsvcs/RtecEventCommS.h"
19 #include "orbsvcs/Event_Utilities.h"
20 #include "orbsvcs/Event_Service_Constants.h"
21 #include "orbsvcs/Scheduler_Factory.h"
22 #include "orbsvcs/RtecSchedulerS.h"
26 #include "DOVE_Supplier.h"
28 struct Schedule_Viewer_Data
30 char operation_name
[BUFSIZ
];
35 u_long completion_time
;
36 u_long computation_time
;
41 * @class DualEC_Supplier
43 * @brief Event Supplier.
45 * Reads information out of a file and
46 * feeds it with additional navigation and
47 * weapon data into the dove_supplier, which
48 * is connected to the event channel
53 DualEC_Supplier (int argc
, ACE_TCHAR
** argv
);
57 /// Initialize: set up, resolve ORB services,
58 /// connect the DOVE_Suppliers.
61 /// Compute schedule priorities, possibly dump
62 /// data into runtime scheduler header files.
63 void compute_schedules ();
65 /// here is really something going on,
66 /// here we deliver the messages
67 void start_generating_events ();
69 /// Load the scheduling information into memory
70 void load_schedule_data ();
77 * Private class that implements a termination servant.
79 class Terminator
: public POA_NavWeapTerminator
84 /// Run the orb event loop.
85 static ACE_THR_FUNC_RETURN
run_orb (void *);
87 /// Run navigation event generation thread.
88 static ACE_THR_FUNC_RETURN
run_nav_thread (void *arg
);
90 /// Run weapons event generation thread.
91 static ACE_THR_FUNC_RETURN
run_weap_thread (void *arg
);
93 /// Create two scheduling service instances, registers
94 /// them with the Naming Service.
95 int create_schedulers ();
97 /// Create two event service instances, registers
98 /// them with the Naming Service.
99 int create_event_channels ();
101 /// Get command line options.
102 unsigned int get_options (int argc
, ACE_TCHAR
*argv
[]);
104 // Time values to pause before notifying the supplier each time.
105 ACE_Time_Value nav_pause_
;
106 ACE_Time_Value weap_pause_
;
108 // POA client references.
109 PortableServer::POA_var root_POA_var_
;
110 PortableServer::POAManager_var poa_manager_
;
112 // Naming Service client reference and names to use.
113 CosNaming::NamingContext_var naming_context_
;
114 CosNaming::Name channel_hi_name_
;
115 CosNaming::Name channel_lo_name_
;
116 CosNaming::Name sched_hi_name_
;
117 CosNaming::Name sched_lo_name_
;
119 // Scheduling Service servant implementation pointers.
120 POA_RtecScheduler::Scheduler
* sched_hi_impl_
;
121 POA_RtecScheduler::Scheduler
* sched_lo_impl_
;
123 // Scheduling Service client references.
124 RtecScheduler::Scheduler_var sched_hi_
;
125 RtecScheduler::Scheduler_var sched_lo_
;
127 // Handles for the dummy rt_infos registered with the
128 // schedulers in order to force priority differentiation.
129 RtecScheduler::handle_t sched_hi_rt_info_hi_
;
130 RtecScheduler::handle_t sched_hi_rt_info_lo_
;
131 RtecScheduler::handle_t sched_lo_rt_info_hi_
;
132 RtecScheduler::handle_t sched_lo_rt_info_lo_
;
134 // Termination servant implementation and client reference
135 Terminator terminator_impl_
;
136 NavWeapTerminator_var terminator_
;
138 // Event Service servant implementation pointers.
139 POA_RtecEventChannelAdmin::EventChannel
*ec_hi_impl_
;
140 POA_RtecEventChannelAdmin::EventChannel
*ec_lo_impl_
;
142 // Event Service client references.
143 RtecEventChannelAdmin::EventChannel_var ec_hi_
;
144 RtecEventChannelAdmin::EventChannel_var ec_lo_
;
146 DOVE_Supplier weapons_Supplier_
;
147 DOVE_Supplier navigation_Supplier_
;
149 // Data for registering RT_Infos
150 ACE_Scheduler_Factory::POD_RT_Info rt_info_nav_hi_
;
151 ACE_Scheduler_Factory::POD_RT_Info rt_info_nav_lo_
;
152 ACE_Scheduler_Factory::POD_RT_Info rt_info_weap_hi_
;
153 ACE_Scheduler_Factory::POD_RT_Info rt_info_weap_lo_
;
154 ACE_Scheduler_Factory::POD_RT_Info rt_info_dummy_hi_
;
155 ACE_Scheduler_Factory::POD_RT_Info rt_info_dummy_lo_
;
157 // References for CORBA RtecScheduler data structures
158 RtecScheduler::RT_Info_Set_var infos_hi_
;
159 RtecScheduler::Dependency_Set_var deps_hi_
;
160 RtecScheduler::Config_Info_Set_var configs_hi_
;
161 RtecScheduler::Scheduling_Anomaly_Set_var anomalies_hi_
;
162 RtecScheduler::RT_Info_Set_var infos_lo_
;
163 RtecScheduler::Dependency_Set_var deps_lo_
;
164 RtecScheduler::Config_Info_Set_var configs_lo_
;
165 RtecScheduler::Scheduling_Anomaly_Set_var anomalies_lo_
;
167 // Queues to store event carried data structures.
168 ACE_Unbounded_Queue
<Navigation
*> navigation_data_
;
169 ACE_Unbounded_Queue
<Weapons
*> weapons_data_
;
173 long total_messages_
;
175 ACE_TCHAR
*input_file_name_
;
176 unsigned long update_data_
;
177 int dump_schedule_headers_
;
178 int use_runtime_schedulers_
;
179 int suppress_priority_
;
180 const ACE_TCHAR
* hi_schedule_file_name_
;
181 const ACE_TCHAR
* lo_schedule_file_name_
;
182 CORBA::Long nav_roll_
;
183 CORBA::Long nav_pitch_
;
186 #endif /* DUALEC_SUP_H */