// // $Id$ //----------------------------------------------------------------------- // // (c) Copyright 2009 by GATS, Inc., // 11864 Canon Blvd, Suite 101, Newport News VA 23606 // // All Rights Reserved. No part of this software or publication may be // reproduced, stored in a retrieval system, or transmitted, in any form // or by any means, electronic, mechanical, photocopying, recording, or // otherwise without the prior written permission of GATS, Inc. // //----------------------------------------------------------------------- // // Module: EffectiveLockdown.cpp // // Author: Greg Paxton // // Date: Thu Sep 17 17:24:50 EDT 2009 // //----------------------------------------------------------------------- // // Modification History: // // $Log$ // //----------------------------------------------------------------------- // //----------------------------------------------------------------------- // Include Files: //----------------------------------------------------------------------- // #include "ConfigFile.h" #include "EventVar.h" #include "EffectiveLockdown.h" #include "EffPointingCutoff.h" #include // //----------------------------------------------------------------------- // Defines and Macros: //----------------------------------------------------------------------- // // //----------------------------------------------------------------------- // Global Variables: //----------------------------------------------------------------------- // // //----------------------------------------------------------------------- // Utility Routines: //----------------------------------------------------------------------- // int EffectiveLockdown(Event& L0, Event& L1, Event& Tmp, Event& SD, ConfigFile& cf) { char modeFlag = '\0'; bool mode = false; long azIndex = 0; long elIndex = 0; double cutoffTime = 0.0; double azValue = 0.0; double elValue = 0.0; EventVar timeArray; EventVar lockdownAz; EventVar lockdownEl; EventVar temp; std::cout << "\nIn EffectiveLockdown \n"; L1.getEventVar("gridTime",timeArray); L1.getEventVar("gridAngleLockdownAZ",lockdownAz); L1.getEventVar("gridAngleLockdownEL",lockdownEl); L1.getEventVar("PointingCorrectionCutoffTime", temp); cutoffTime = temp[0]; modeFlag = L1.getSRSSFlag(); // Sunset is true if (modeFlag == 's') { mode = true; } // Sunrise is false else if (modeFlag == 'r') { mode = false; } else { std::cerr << "\nEffectiveLockdown: No SS/SR Mode Flag set\n" << std::endl; return 1; } EventVar effAz(lockdownAz.size()); EventVar effEl(lockdownEl.size()); EffPointingCutoff pointingCutoff(cutoffTime, mode); pointingCutoff(timeArray, lockdownAz, azValue, azIndex); pointingCutoff(timeArray, lockdownEl, elValue, elIndex); if (azIndex != elIndex) { std::cerr << "\nEffectiveLockdown: Cutoff index times do not agree for azimuth and elevation\n" << std::endl; return 1; } // Create effective az and el lockdowns where the value // at altitudes higher than the cutoff altitude are // constant values. Since we are correcting the pointing // to the cutoff altitude's position, the effective pointing // will now be a constant relative to the cutoff position. if (mode) { for (unsigned int i = 0; i < lockdownAz.size(); i++) { if ((long)i > azIndex) { effAz[i] = azValue; effEl[i] = elValue; } else { effAz[i] = lockdownAz[i]; effEl[i] = lockdownEl[i]; } } } else { for (unsigned int i = 0; i < lockdownAz.size(); i++) { if ((long)i > azIndex) { effAz[i] = azValue; effEl[i] = elValue; } else { effAz[i] = lockdownAz[i]; effEl[i] = lockdownEl[i]; } } } effAz.setName("L1_EffectiveAzLockdown"); L1.addEventVar(effAz); effEl.setName("L1_EffectiveElLockdown"); L1.addEventVar(effEl); return 0; }