620 likes | 793 Views
Rhapsody to OPNet. J. James, G. Quinn, S. Orr and E. Walters September 2008. This technical data was produced for the U. S. Government under Contract No. FA8721-09-C-0002, and is subject to the Rights in Technical Data-Noncommercial Items clause at (DFARS) 252.227-7013 (NOV 1995). Objective.
E N D
Rhapsody to OPNet J. James, G. Quinn, S. Orr and E. Walters September 2008 This technical data was produced for the U. S. Governmentunder Contract No. FA8721-09-C-0002, and issubject to the Rights in Technical Data-NoncommercialItems clause at(DFARS) 252.227-7013 (NOV 1995)
Objective Expedite Integrated Design and Analysis Provide a manual for creating a model using the Unified Modeling Language (UML) tool, Rhapsody, that can be exported into the analysis tool, OPNET
Applicable Models • Contain model functionality that has associated timing parameters • End-to-end deadline (DL) for sequence diagram and/or periodicity of trigger (OP) for sequence diagram • Duration for operations (dur) within the sequence diagram • Contain model classes/objects that are allocated to resources (e.g., processors (Proc))
Process Currently Utilizes Runtime Process UML – Sequence Diagrams Response Time Statistics UML – Unified Modeling Language SPT- Schedulability, Performance and Time XMI – XML Metadata Interchange Industry Standards S-PMIF – Software Performance Model Interchange Format Proposed Standard • Telelogic Rhapsody 7.1 • UML 2.1 Sequence diagrams • Schedulability, Performance and Time (SPT) profile • XML Metadata Interchange (XMI 2.1) • Software Performance Model Interchange Format (S-PMIF) • Java Runtime Environment (JRE) 5.0 • OPNET 14.5 • Modeler and Simulation Runtime • Detailed Server Model
UML Sequence Diagram Object or Classifier Role [< object name >] : < class name > Object name in all of the above examples is blank so they are anonymous. Class name specifies the underlying class that the Object is an instance of. Message An instance of an operation defined on the Class that the Lifeline is an instance of Triggering Message Lifeline Reflexive Message
Model Functionality Captured in UML Sequence Diagrams trigger event Operation • Initial event is the trigger • Pattern that works well is that an event is processed by one or more operations (as a Reflexive messages) • Ultimately that results in an event to an new lifeline • Level of detail should be consistent with the performance data available
Model Contains SPT Profile • SPT Profile needs to be added to Your Model • The default location for the profile is: • One method is to add As Reference using Add to Model
Using the SPT Profile *RapidRMA is a separate product that can be obtained from TriPacific • There are Stereotype, Tag and Property fields in Rhapsody associated with • Classes, events and operations that apply throughout the model • Instances of classes, events and operations for a specific sequence diagram • There are several methods for capturing performance data and processor allocations in Rhapsody UML • Using Rhapsody to enter data into the UML stereotype and SPT tag property fields • Using the RapidRMA* plug-in for Rhapsody to enter data into the RapidRMA property fields • Using Rhapsody to enter data into the RapidRMA property fields • The method used for capturing SPT data in the model will determine which stereotype, tag and property fields apply
Definitions • Stereotype - a notation allowing the extension of UML symbols. Some are defined within Profiles, eg. SPT (Schedulability, Performance and Time) Profile • Tag – name given to the extension attribute: eg SPT: SADuration • Property – ad hoc extensions given by proprietary tools like RapidRMA • These attributes to do not export in XMI in Rhapsody • They must be mapped to appropriate SPT tags for use in performance analysis by OPNET etc. • We have supplied a VBA script for Rhapsody to map these properties
Using Rhapsody to Capture SPT Data Processor allocations are captured in class stereotype and tag fields Trigger (initial event) and thread reoccurrence (load) data are captured in the associated sequence diagram messagestereotype and tag fields The data in these stereotype and tag fields appear in the Rhapsody’s XMI export and are mapped to S-PMIF in later steps
Using Rhapsody: Processor Allocations • For each class associated with an object in the sequence diagram bring up Features
Using Rhapsody: Processor Allocations • Using the General tab, select SAScheduler in the Stereotype field • Using the Tags tab, enter the resource/processor to which the class has been allocated in the SAExecution Engine field • Here: CommunicationProcessor
Using Rhapsody: Trigger Data Right click on trigger message and bring up Features
Using Rhapsody: Trigger Data • Right click on trigger message and bring up Features • Using the General tab, select SATrigger in the Stereotype field • Using the Tags tab, enter the periodicity in the SAOccurrence field
Using Rhapsody: Operation Data • For each operation message in the sequence diagram bring up Features • Using the General tab, select RTAction in the Stereotype field • Using the Tags tab, enter the duration in the RTDuration field
Using RapidRMA to Capture SPT Data • One method in Rhapsody • RapidRMA must be installed • Tools/ Edit Timing Properties • Start by adding processors • Then allocate to classes
Using RapidRMA: Trigger Data • Select the trigger event in the Events folder and use Tag: • SATrigger::SAOccurrencePattern to enter the periodicity • SAAction::SAAbsDeadline to enter the deadline
Using RapidRMA: Operation Data • Operation data can be entered using either the realizationoperation or the sequence diagram message • Use the realization-operation when it is triggered by only one event or the duration of the operation remains the same for each triggering event • Use the message when it is triggered by more that one event and the duration of the operation differs for at least two triggering events
Using RapidRMA: Operation for Operation Data • For each operation message in the sequence diagram. select the operation’s class in the Class folder • For each operation in the class, select the operation and use Tag: • Local::SAAction::RTduration to enter the duration
Using RapidRMA: Message for Operation Data • Not all data entered by RapidRMA is visible to Rhapsody and not all data entered into Rhapsody is visible to RapidRMA • Data must be visible to Rhapsody for it to be contained in the XMI • Data must be visible to RapidRMA when RapidRMA is being used for performance analysis • For duel visibility, operation SPT data must be entered twice for messages • Using RapidRMA • Using Rhapsody
Using RapidRMA: Message for Operation RapidRMA Visibility • Select Interactions • Select each operation’s message and use Tag: • Local::SAAction::RTdurationto enter the duration
Using Rhapsody: Message for Operation Rhapsody Visibility View All • For each operation message in the sequence diagram bring up Features • Using the Properties tab, change View Common to View All • Select Local::SAActionAction • For Message, enter the duration in the RTduration field
Using Rhapsody to Capture SPT Data in RapidRMA Property Fields: Processor Allocations View All • For each class associated with an object in the sequence diagram bring up Features • Select the Realization • Using the Properties tab, change View Common to View All • Select SAResource • For Class, enter the resource/processor to which the class has been allocated in the SAExecution Engine field
Using Rhapsody to Capture SPT Data in RapidRMA Property Fields: Trigger Data View All • For the trigger message bring up Features • Select the Realization • Using the Properties tab, change View Common to View All • Select SAAction, enter the deadline in SAAbsDeadline • Select SATrigger, enter the periodicity in SAOccurrencePattern
Using Rhapsody to Capture SPT Data in RapidRMA Property Fields: Operation Data View All • For each operation message in the sequence diagram bring up Features • Select the Realization • Using the Properties tab, change View Common to View All • Select Local SAAction, enter the duration in RTduration
Copy RapidRMA data to SPTusing VBA Script • From the Rhapsody Menu: • Tools VBA Visual Basic Editor • From the Visual Basic Editor Menu: • File Import File [only necessary once per session] • Select the “CopyRMAtoSPT.bas” file, • And the CExecutingMessage.cls file if necessary • (if the former file is not sufficient for a successful run) • From the Visual Basic Editor Menu: • Run Run Macro • Choose the CopyRMAtoSPT macro • You should receive a “Done” dialog when the import for each thread is finished • Verify that the values you imported now exist in the tags for your sequence diagrams – as above
Creating an Analyzable Design Model • Create a UML Sequence Diagram per thread • Specify the inter-arrival time for the thread • Specify the priority for the thread (optional) • Mark asynchronous messages (splits) (optional) • For each Lifeline, identify an Execution Engine (optional) • For each Execution Engine, identify the number of processors it has (optional) • For each Lifeline, identify a scheduling policy (optional) • Mark Lifelines representing passive resources (optional) • Specify the duration of each reflexive message within the thread
Specifying Times • Whenever specifying times, use the following format: • {100,'ms'} for 100 milliseconds
1. Thread Inter-arrival Time(Required) • Stereotype the Triggering Message with SATrigger • Set the inter-arrival time using the SAoccurrence tag (See Specifying Times) • OR stereotype the Triggering Message with PAopenLoad • Set the inter-arrival time using the PAoccurrence tag (See Specifying Times)
2. Thread Priority(Optional) • Stereotype the Triggering Message with PAopenLoad • Set the priority using the PApriority tag
3. Asynchronous Messages (Optional) Set Message Type of Message to Event.
4. Execution Engines(Optional) • Stereotype the Object with SAScheduler • Set the SAExecutionEngine tag to the name of the processing unit that the Object runs on • OR stereotype the Object’s underlying Class with SAScheduler • Set the SAExecutionEngine tag to the name of the processing unit that the Object runs on
5. Number of Processors(Optional) • Create a Class (not as the realization of a lifeline or in the sequence diagram at all) • Name the Class after the Execution Engine with multiple processors • Stereotype the Class with SAEngine • Set the tag SAresources to the number of processors the execution engine has
6. Scheduling Policy(Optional) • Only applicable for Lifelines that are Execution Engines • If the Object is stereotyped with SAScheduler • Set the SASchedulingPolicy tag to the desired scheduling policy • OR if the Object’s underlying Class is stereotyped with SAScheduler • Set the SASchedulingPolicy tag to the desired scheduling policy • Legal values for SASchedulingPolicy: • RateMonotonic • FixedPriority • FIFO • PS
7. Passive Resources(Optional) • Only applicable for lifelines that are not Execution Engines • Stereotype the Object’s underlying Class with SAResource • Name of the Object’s underlying Class becomes the name of the Passive Resource
8. Durations(Required) • Only should be done on Reflexive Messages • Stereotype the Message with RTaction • Set tag value RTduration to the time it takes for the message to execute (See Specifying Times) • OR stereotype the underlying Operation • (See Specifying Times)
Executing Transform java –jar XmlTransformer < input file > Uml21ToSpmif4 < output file >[ < sequence diagram 1 >][ <sequence diagram 2 >][…] • The XmlTransformer application is extensible with new transforms. • The ‘Uml21ToSpmif4’ argument specifies the transform to execute. • Uml21ToSpmif4 represents the transform that accepts Rhapsody UML 2.1 in XMI 2.1 exports and transforms them to S-PMIF (version 4) • The Uml21ToSpmif4 transform supports specifying specific sequence diagrams to transform. If none are specified, it transforms all sequence diagrams. • The Uml21ToSpmif4 transform will output warnings for messages in processed sequence diagrams that do not have an underlying operation specified • In version 7.1 if SPT data or entire file is missing; remove threads till “bad” thread(s) are found and export has SPT data • Error message being put in XmlTransformer application to help with this
Export XMI from Rhapsody • Start menu All Programs TelelogicTelelogic Rhapsody 7.1 XMI Toolkit Rhapsody XMI Toolkit • Using the Rhapsody XML Toolkit • In most cases, Export XMI should be available under the Tools menu within Rhapsody as well • Export the XMI for the project • Use UML and XMI versions 2.1 • Things should be okay if there are warnings. • Note where it exported the file • In version 7.1 if SPT data or entire file is missing; remove threads till “bad” thread(s) are found and export has SPT data • Error message being put in XmlTransformer application
Translate XMI to S-PMIF java –jar XmlTransformer < input file > Uml21ToSpmif4 < output file >[ < sequence diagram 1 >][ <sequence diagram 2 >][…] • Eg: • Java –jar XmlTransformer.jar E10_Rhap71_SPT21_AMSTEBad.xml Uml21ToSpmif4 SPMIF_AMSTE_bad.xml • The XmlTransformer application is extensible with new transforms. • The ‘Uml21ToSpmif4’ argument specifies the transform to execute. • Uml21ToSpmif4 represents the transform that accepts Rhapsody UML 2.1 in XMI 2.1 exports and transforms them to S-PMIF (version 4) • The Uml21ToSpmif4 transform supports specifying specific sequence diagrams to transform. If none are specified, it transforms all sequence diagrams. • The Uml21ToSpmif4 transform will output warnings for messages in processed sequence diagrams that do not have an underlying operation specified
Transform the S-PMIF File into OPNET XML • You will need the following libraries in your classpath: • JAXB Reference Implementation Files: • activation.jar • jaxb-api.jar • jaxb-xjc.jar • jaxb-impl.jar • jsr173_1.0_api.jar • GNU Getopt (for the command-line): • java-getopt-1.0.13.jar
Transform the S-PMIF File into OPNET XML (cont.) • Use the following invocation: • java -jar spmif2opnet.jar -i<input S-SPMIF file> • [-o<output OPNET XML file>] • [-p<OPNET properties file>] [-P DIRECT | SCALED | ORDERED | RM] • [-n] (Generate OPNET Network) [-h] (Print this help message) • Eg: • Java –jar spmif2opnet.jar -i SPMIF_AMSTE_bad.xml –o amstebad_SPMIF_opnet.xml –n –P RM
Cygwin script • If Cygwin installed both steps are handled in one script • Be sure xmi2opnet.pl is available • ./xmi2opnet.pl <input XML file><Rhapsody Project Name> • EG: ./xmi2opnet.pl E10_Rhap71_SPT21_amsteGood.xml TomCase2_good
Import the OPNET XML File into OPNET • Open OPNET Modeler 14.5, and select File New • Select a New Project, name it • do not use the Startup Wizard • From the Project Menu: • Topology Import Topology From XML File… • Select your OPNET XML file • Select the Logical Network • Check the Task and Server Definitions to verify the data made it in • If you chose to generate the network, check its structure
Import the OPNET XML File into OPNET (cont.) • Sometimes the net has problems with ports. • Select all links. Under Topology select Verify Links/Choose “transceivers for selected links” • We have simple work-around in code • Select all devices • Right click on background • Select: Choose individual DES statistics. • To see Response times set under Global Statistics/Custom Application • Task Response time • To see CPU utilizations set under Node Statistics/Server Jobs • CPU Total Utilization • Run the OPNET Simulation! (running man)
Miscellaneous OPNET Lessons • Always make sure that the interarrival time of any thread > 0 • On each life line in the thread • There are checks in both Java programs for this • Sometime realization has not been set in the UML • This results in zero service times • Tests for this are being made now • And that the total sum of the thread's execution time > 0 • Detailed picture of the behavior of a single OPNET device • e.g. the utilization several tasks on a particular server • Make sure you turn the “DES Values per Statistic” up by an order of magnitude • Ensures that the behavior you want to see is not missed because of low sampling
Miscellaneous Lessons (cont.) • "Detailed/Specialized Server License" is required • Our generated simulations depend on it • OPNET's simulation compilation process is much easier when you use the recommended environment • OPNET 12 and MSVC 7 (.NET 2003) • OPNET 14 and MSVC 9 (.NET 2008) • Simulator options “force recompile” to make sure you compile with the same MSVC version • On systems with multiple versions of MSVC • If a ‘Default” Node gets created in the Network diagram • This means that a SAExecutionEngine was not set for a class in the UML • Usually a modeling problem