1 subroutine navtlm(input,nframes,navctl,gaclac,tlm,tilts)
86 #include "input_s.fin"
87 #include "navctl_s.fin"
88 #include "tlm_str.fin"
92 type(tlm_struct) :: tlm
93 type(tilt_states) :: tilts
95 real*4 ttilt, tilttol, tanglim(2)
96 integer*4 nframes, gaclac, nper, i, j, k, ip, mf, ilin
97 integer*4 itilt, tflag, ntlts, istime
100 integer*4 tilt_flags(maxlin)
103 equivalence(istime,stime)
104 data tilttol/0.25/, tanglim/48.,225./
110 if (input(1)%sc_id(2).eq.15)
then
121 nlines = nframes*nper
132 mf = input(i)%sc_id(1)/128
135 if (input(i)%flag.eq.0)
then
141 if (mod(ilin,3).eq.2)
then
142 tlm%tilt(1)%flag(j,i) = 1
143 tlm%tilt(2)%flag(j,i) = 1
144 tlm%tilt(1)%ang(j,i) = 0.
145 tlm%tilt(2)%ang(j,i) = 0.
146 tilt_flags((i-1)*nper+j) = -1
151 * input(i)%inst_ana(22,j),ttilt)
153 itilt = input(i)%inst_dis(16,j)*4
154 * + input(i)%inst_dis(17,j)*2 + input(i)%inst_dis(18,j)
157 if ((input(i)%inst_ana(22,j).gt.tanglim(1)).and.
158 * (input(i)%inst_ana(22,j).lt.tanglim(2)).and.
159 * (input(i)%inst_ana(23,j).gt.tanglim(1)).and.
160 * (input(i)%inst_ana(23,j).lt.tanglim(2)))
then
161 tlm%tilt(1)%flag(j,i) = 2
162 tlm%tilt(2)%flag(j,i) = 2
165 tlm%tilt(1)%ang(j,i) = ttilt
166 tlm%tilt(2)%ang(j,i) = ttilt
169 tlm%tilt(1)%flag(j,i) = 1
170 tlm%tilt(2)%flag(j,i) = 1
171 tlm%tilt(1)%ang(j,i) = 0.
172 tlm%tilt(2)%ang(j,i) = 0.
177 else if (itilt.eq.3)
then
179 tlm%tilt(1)%flag(j,i) = 0
180 tlm%tilt(2)%flag(j,i) = 0
181 tlm%tilt(1)%ang(j,i) = 0.
182 tlm%tilt(2)%ang(j,i) = 0.
185 else if (itilt.eq.5)
then
187 tlm%tilt(1)%flag(j,i) = 0
188 tlm%tilt(2)%flag(j,i) = 0
189 tlm%tilt(1)%ang(j,i) = navctl%tiltaft
190 tlm%tilt(2)%ang(j,i) = navctl%tiltaft
193 else if (itilt.eq.6)
then
195 tlm%tilt(1)%flag(j,i) = 0
196 tlm%tilt(2)%flag(j,i) = 0
197 tlm%tilt(1)%ang(j,i) = navctl%tiltfor
198 tlm%tilt(2)%ang(j,i) = navctl%tiltfor
203 tlm%tilt(1)%flag(j,i) = 1
204 tlm%tilt(2)%flag(j,i) = 1
205 tlm%tilt(1)%ang(j,i) = 0.
206 tlm%tilt(2)%ang(j,i) = 0.
211 if (
abs(ttilt-tlm%tilt(1)%ang(j,i)) .gt. tilttol)
then
212 tlm%tilt(1)%flag(j,i) = 1
213 tlm%tilt(2)%flag(j,i) = 1
214 tlm%tilt(1)%ang(j,i) = 0.
215 tlm%tilt(2)%ang(j,i) = 0.
219 tilt_flags((i-1)*nper+j) = tflag
228 tlm%tilt(1)%flag(j,i) = 1
229 tlm%tilt(2)%flag(j,i) = 1
230 tlm%tilt(1)%ang(j,i) = 0.
231 tlm%tilt(2)%ang(j,i) = 0.
236 if ((input(i)%flag.eq.0).and.(mf.eq.1))
then
240 tlm%sc_att%att(j,i) = input(i)%sc_ana(j+6)
242 tlm%sc_att%flag(i) = 0
246 if (input(i)%sc_dis(j).eq.3)
then
247 tlm%sun(j)%active(i) = 0
249 tlm%sun(j)%active(i) = 1
251 tlm%sun(j)%flag(i) = 0
253 tlm%sun(j)%ang(1,i) = input(i)%sc_ana(2*j+8)
254 tlm%sun(j)%ang(2,i) = input(i)%sc_ana(2*j+9)
258 stime(k)=input(i)%sc_dis(16+4*j+5-k)
262 stime(k)=input(i)%sc_dis(16+4*j+k)
265 istime = mod(istime,86400000)
266 tlm%sun(j)%deltim(i) = (istime - input(i)%msec)/1.d3
267 if ((tlm%sun(j)%deltim(i).gt.0.).or.
268 * (tlm%sun(j)%deltim(i).lt.-10.))
269 * tlm%sun(j)%flag(i) = 1
274 tlm%earth(j)%active(i) = 0
275 tlm%earth(j)%flag(i) = 0
276 tlm%earth(j)%deltim(i) = 0.0
277 tlm%earth(j)%widphse(1,i) = input(i)%sc_ana(2*j+15)
278 tlm%earth(j)%widphse(2,i) = input(i)%sc_ana(2*j+14)
279 if (tlm%earth(j)%widphse(2,i).gt.180.)
280 * tlm%earth(j)%widphse(2,i) = tlm%earth(j)%widphse(2,i) - 360.0
283 stime(k)=input(i)%sc_dis(28+4*j+5-k)
287 stime(k)=input(i)%sc_dis(28+4*j+k)
290 istime = mod(istime,86400000)
291 tlm%earth(j)%deltim(i) = (istime - input(i)%msec)/1.d3
292 if ((tlm%earth(j)%deltim(i).gt.0.).or.
293 * (tlm%earth(j)%deltim(i).lt.-10.))
294 * tlm%earth(j)%flag(i) = 1
301 tlm%sc_att%att(j,i) = 0.
303 tlm%sc_att%flag(i) = 1
307 tlm%sun(j)%active(i) = 1
308 tlm%sun(j)%flag(i) = 1
309 tlm%sun(j)%deltim(i) = 0.
310 tlm%sun(j)%ang(1,i) = 0.
311 tlm%sun(j)%ang(2,i) = 0.
316 tlm%earth(j)%active(i) = 1
317 tlm%earth(j)%flag(i) = 1
318 tlm%earth(j)%deltim(i) = 0.0
319 tlm%earth(j)%widphse(1,i) = 0.
320 tlm%earth(j)%widphse(2,i) = 0.
332 do while (tilt_flags(ip) .eq. -1)
341 if (tilt_flags(i) .ne. -1)
then
342 if (tilt_flags(i) .eq. tilt_flags(ip))
then
345 if (.not.gottwo)
then
348 j = mod( (ip-1), nper) + 1
350 tlm%tilt(1)%flag(j,k) = 1
351 tlm%tilt(2)%flag(j,k) = 1
358 if (.not.gottwo)
then
360 j = mod( (ip-1), nper) + 1
362 tlm%tilt(1)%flag(j,k) = 1
363 tlm%tilt(2)%flag(j,k) = 1
370 do while (tilt_flags(ip) .eq. -1)
375 tilt_flags(i) = tilt_flags(ip)
381 if (tilt_flags(i) .ne. -1)
then
384 if ((i - ip) .gt. 1)
then
387 tflag =
max(tilt_flags(ip),tilt_flags(i))
389 tilt_flags(j) = tflag
397 tilt_flags(i) = tilt_flags(ip)
404 tilts%tilt_ranges(1,ntlts) = 1
405 tilts%tilt_flags(ntlts) = tilt_flags(1)
409 if (tilt_flags(i) .ne. tilt_flags(i-1))
then
410 tilts%tilt_ranges(2,ntlts) = i-1
411 if (ntlts .eq. 20)
then
413 write(*,*)
"navtlm: Error: excessive tilt changes."
418 tilts%tilt_ranges(1,ntlts) = i
419 tilts%tilt_flags(ntlts) = tilt_flags(i)
425 tilts%tilt_ranges(2,ntlts) = nper*nframes