Search in sources :

Example 1 with ApplicationData

use of CCDD.CcddClassesDataTable.ApplicationData in project CCDD by nasa.

the class CcddApplicationSchedulerTableHandler method createApplicationScheduleDefinitionTable.

/**
 ********************************************************************************************
 * Create the schedule definition table entries based on the time slot definitions
 ********************************************************************************************
 */
private void createApplicationScheduleDefinitionTable() {
    sdtEntries = new ArrayList<String[][]>();
    int numMsgsPerSlot = appHandler.getNumberOfMessagesPerTimeSlot();
    String[][] sdtEntry;
    // Step through each message
    for (Message message : getValidatedStoredData()) {
        sdtEntry = new String[numMsgsPerSlot][6];
        // Step through each message in the time slot
        for (int msgIndex = 0; msgIndex < numMsgsPerSlot; msgIndex++) {
            // Sort the messages based on their assigned priority values
            prioritizeApps(message);
            // Check if a message is assigned to this message/time slot
            if (message.getNumberOfVariables() > msgIndex) {
                // Store the message entry
                ApplicationData appData = (ApplicationData) message.getVariable(msgIndex);
                sdtEntry[msgIndex][0] = ENABLE;
                sdtEntry[msgIndex][1] = ACTIVITY;
                sdtEntry[msgIndex][2] = "1";
                sdtEntry[msgIndex][3] = "0";
                sdtEntry[msgIndex][4] = getMessageIndex(Integer.decode(appData.getWakeUpID()));
                sdtEntry[msgIndex][5] = appData.getSchGroup();
            } else // No message is assigned
            {
                // Store an "unused" entry
                sdtEntry[msgIndex][0] = UNUSED;
                sdtEntry[msgIndex][1] = "0";
                sdtEntry[msgIndex][2] = "0";
                sdtEntry[msgIndex][3] = "0";
                sdtEntry[msgIndex][4] = "0";
                sdtEntry[msgIndex][5] = GROUPNONE;
            }
        }
        // Add the message to the list of schedule definition table entries
        sdtEntries.add(sdtEntry);
    }
}
Also used : Message(CCDD.CcddClassesDataTable.Message) ApplicationData(CCDD.CcddClassesDataTable.ApplicationData)

Example 2 with ApplicationData

use of CCDD.CcddClassesDataTable.ApplicationData in project CCDD by nasa.

the class CcddApplicationSchedulerInput method getApplicationFields.

/**
 ********************************************************************************************
 * Get the selected node in the application tree
 *
 * @param applications
 *            array of application names
 *
 * @param rate
 *            currently selected rate
 *
 * @return List of variable object(s) representing the specified application(s)
 ********************************************************************************************
 */
private List<Variable> getApplicationFields(String[] applications, String rate) {
    List<Variable> appList = new ArrayList<Variable>();
    // Step through each application
    for (String application : applications) {
        // Remove any HTML tags, if present
        application = applicationTree.removeExtraText(application);
        // Use the application's data to create an application data object
        appList.add(new ApplicationData(application, CcddUtilities.convertStringToFloat(rate), Integer.valueOf(getDataFieldValue(application, DefaultApplicationField.EXECUTION_TIME)), Integer.valueOf(getDataFieldValue(application, DefaultApplicationField.PRIORITY)), Integer.valueOf(getDataFieldValue(application, DefaultApplicationField.MESSAGE_RATE)), getDataFieldValue(application, DefaultApplicationField.WAKE_UP_NAME), getDataFieldValue(application, DefaultApplicationField.WAKE_UP_ID), Integer.valueOf(getDataFieldValue(application, DefaultApplicationField.HK_SEND_RATE)), getDataFieldValue(application, DefaultApplicationField.HK_WAKE_UP_NAME), getDataFieldValue(application, DefaultApplicationField.HK_WAKE_UP_ID), getDataFieldValue(application, DefaultApplicationField.SCH_GROUP)));
    }
    return appList;
}
Also used : Variable(CCDD.CcddClassesDataTable.Variable) ArrayList(java.util.ArrayList) ApplicationData(CCDD.CcddClassesDataTable.ApplicationData)

Example 3 with ApplicationData

use of CCDD.CcddClassesDataTable.ApplicationData in project CCDD by nasa.

the class CcddApplicationSchedulerTableHandler method getMessageDefinitionTable.

/**
 ********************************************************************************************
 * Get the message definition table entries
 *
 * @return Array containing the message definition table entries
 ********************************************************************************************
 */
protected String[] getMessageDefinitionTable() {
    String[] scheduleCommands = new String[appHandler.getNumberOfTimeSlots()];
    String command;
    for (int mdtIndex = 0; mdtIndex < scheduleCommands.length; mdtIndex++) {
        command = null;
        for (Variable var : appList) {
            if (mdtIndex == Integer.decode(((ApplicationData) var).getWakeUpID())) {
                command = var.getFullName().toUpperCase() + "_WAKEUP_MID";
                break;
            }
        }
        if (command == null) {
            command = "SCH_UNUSED_MID";
        }
        scheduleCommands[mdtIndex] = command;
    }
    return scheduleCommands;
}
Also used : Variable(CCDD.CcddClassesDataTable.Variable) ApplicationData(CCDD.CcddClassesDataTable.ApplicationData)

Example 4 with ApplicationData

use of CCDD.CcddClassesDataTable.ApplicationData in project CCDD by nasa.

the class CcddApplicationSchedulerTableHandler method validateApplicationData.

/**
 ********************************************************************************************
 * Check all the stored application information for inconsistencies. Update or flag the
 * application for removal if any changes are found
 *
 * @return List of invalid applications
 ********************************************************************************************
 */
private List<Variable> validateApplicationData() {
    List<Variable> removedApps = new ArrayList<Variable>();
    // Create a group tree
    CcddGroupTreeHandler groupTree = new CcddGroupTreeHandler(ccddMain, null, ccddMain.getMainFrame());
    // Get a list of the current group's names
    String[] groupNames = groupTree.getGroupHandler().getGroupNames(true);
    // Create a data field handler to interact with the groups' fields
    CcddFieldHandler fieldHandler = new CcddFieldHandler(ccddMain);
    // Step through each application
    for (Variable app : applications) {
        boolean isValid = false;
        // Step through the group names
        for (String name : groupNames) {
            // Check if the group's name matches the application's name
            if (app.getFullName().equals(name)) {
                // Get the group's information and set the data field handler to contain the
                // current group's information
                GroupInformation groupInfo = groupTree.getGroupHandler().getGroupInformationByName(name);
                fieldHandler.setFieldInformation(groupInfo.getFieldInformation());
                // Get the application data field owner name
                String application = CcddFieldHandler.getFieldGroupName(groupInfo.getName());
                // Get the application's schedule rate
                FieldInformation appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.SCHEDULE_RATE.getFieldName());
                // Check if the application's rate equals its field's rate
                if (Float.valueOf(appInfo.getValue()) == app.getRate()) {
                    ApplicationData appData = (ApplicationData) app;
                    // Set the applications's validity to true
                    isValid = true;
                    // Get the run time field information
                    appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.EXECUTION_TIME.getFieldName());
                    // Check if the application's run time changed
                    if (appInfo != null && Integer.valueOf(appInfo.getValue()) != app.getSize()) {
                        // Update the run time to what the field has set
                        app.setSize(Integer.valueOf(appInfo.getValue()));
                    }
                    // Get the execution priority field information
                    appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.PRIORITY.getFieldName());
                    // Check if the application's priority changed
                    if (appInfo != null && Integer.valueOf(appInfo.getValue()) != appData.getPriority()) {
                        // Update the application's priority
                        appData.setPriority(Integer.valueOf(appInfo.getValue()));
                    }
                    // Get the message rate field information
                    appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.MESSAGE_RATE.getFieldName());
                    // Check if the application's message rate changed
                    if (appInfo != null && Integer.valueOf(appInfo.getValue()) != appData.getMessageRate()) {
                        // Update the application's message rate
                        appData.setMessageRate(Integer.valueOf(appInfo.getValue()));
                    }
                    // Get the wake-up name field information
                    appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.WAKE_UP_NAME.getFieldName());
                    // Check if the application's wake-up name changed
                    if (appInfo != null && !appInfo.getValue().equals(appData.getWakeUpName())) {
                        // Update the application's wake-up name
                        appData.setWakeUpName(appInfo.getValue());
                    }
                    // Get the wake-up ID field information
                    appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.WAKE_UP_ID.getFieldName());
                    // Check if the application's wake-up ID changed
                    if (appInfo != null && !appInfo.getValue().equals(appData.getWakeUpID())) {
                        // Update the application's wake-up ID
                        appData.setWakeUpID(appInfo.getValue());
                    }
                    // Get the HK send rate field information
                    appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.HK_SEND_RATE.getFieldName());
                    // Check if the application's HK send rate changed
                    if (appInfo != null && Integer.valueOf(appInfo.getValue()) != appData.getHkSendRate()) {
                        // Update the application's HK send rate
                        appData.setHkSendRate(Integer.valueOf(appInfo.getValue()));
                    }
                    // Get the HK wake-up name field information
                    appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.HK_WAKE_UP_NAME.getFieldName());
                    // Check if the application's HK wake-up name changed
                    if (appInfo != null && !appInfo.getValue().equals(appData.getHkWakeUpName())) {
                        // Update the application's HK wake-up name
                        appData.setHkWakeUpName(appInfo.getValue());
                    }
                    // Get the HK wake-up ID field information
                    appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.HK_WAKE_UP_ID.getFieldName());
                    // Check if the application's HK wake-up ID changed
                    if (appInfo != null && !appInfo.getValue().equals(appData.getHkWakeUpID())) {
                        // Update the application's HK wake-up ID
                        appData.setHkWakeUpID(appInfo.getValue());
                    }
                    // Get the schedule group field information
                    appInfo = fieldHandler.getFieldInformationByName(application, DefaultApplicationField.SCH_GROUP.getFieldName());
                    // Check if the application's schedule group changed
                    if (appInfo != null && !appInfo.getValue().equals(appData.getSchGroup())) {
                        // Update the application's schedule group
                        appData.setSchGroup(appInfo.getValue());
                    }
                }
                break;
            }
        }
        // Check if the application is invalid
        if (!isValid) {
            // Add the application to the list of removed applications
            removedApps.add(app);
        }
    }
    return removedApps;
}
Also used : Variable(CCDD.CcddClassesDataTable.Variable) GroupInformation(CCDD.CcddClassesDataTable.GroupInformation) ArrayList(java.util.ArrayList) ApplicationData(CCDD.CcddClassesDataTable.ApplicationData) FieldInformation(CCDD.CcddClassesDataTable.FieldInformation)

Example 5 with ApplicationData

use of CCDD.CcddClassesDataTable.ApplicationData in project CCDD by nasa.

the class CcddSchedulerDbIOHandler method getApplicationData.

/**
 ********************************************************************************************
 * Get the list of the current messages. Each list item is a string arrays containing the
 * message name and a space-separated list of applications in that message
 *
 * @param messages
 *            list of messages
 *
 * @return List of current messages
 ********************************************************************************************
 */
private List<String[]> getApplicationData(List<Message> messages) {
    List<String[]> currentMsg = new ArrayList<String[]>();
    // Step through each message
    for (Message message : messages) {
        // Check if the time slot has no applications assigned
        if (message.getVariables().isEmpty()) {
            // Create a placeholder for the application information
            currentMsg.add(new String[] { message.getName(), "" });
        } else // The time slot has applications assigned
        {
            // Step through each application in the message
            for (Variable variable : message.getVariables()) {
                ApplicationData appData = (ApplicationData) variable;
                // Create new array for the row
                String[] app = new String[2];
                // Store the message name, and application name, rate, run time, priority,
                // wake-up name, wake-up ID, send rate, housekeeping wake-up name, housekeeping
                // wake-up ID, and schedule group name
                app[AppSchedulerColumn.TIME_SLOT.ordinal()] = message.getName();
                app[AppSchedulerColumn.APP_INFO.ordinal()] = appData.getFullName() + "," + appData.getRate() + "," + appData.getSize() + "," + appData.getPriority() + "," + appData.getMessageRate() + "," + appData.getWakeUpName() + "," + appData.getWakeUpID() + "," + appData.getHkSendRate() + "," + appData.getHkWakeUpName() + "," + appData.getHkWakeUpID() + "," + appData.getSchGroup();
                // Add the application to the list
                currentMsg.add(app);
            }
        }
    }
    return currentMsg;
}
Also used : Variable(CCDD.CcddClassesDataTable.Variable) Message(CCDD.CcddClassesDataTable.Message) ArrayList(java.util.ArrayList) ApplicationData(CCDD.CcddClassesDataTable.ApplicationData)

Aggregations

ApplicationData (CCDD.CcddClassesDataTable.ApplicationData)6 Variable (CCDD.CcddClassesDataTable.Variable)5 Message (CCDD.CcddClassesDataTable.Message)3 ArrayList (java.util.ArrayList)3 FieldInformation (CCDD.CcddClassesDataTable.FieldInformation)1 GroupInformation (CCDD.CcddClassesDataTable.GroupInformation)1 TelemetryData (CCDD.CcddClassesDataTable.TelemetryData)1