Papyrus-RT and Simulink

 

Demonstrate your understanding on the two new tools introduced for modeling behavior: Papyrus-RT and Simulink. You will be modeling (semantically) the same system in both tools.

There will be 2 parts to this assignment. You will be creating a system to generate random numbers, process them in in some manner, then compare the results for output. You will implement the system in both Papyrus-RT and in Simulink.
1. The following is the basic behavior of the system regardless of implementation:
a. You must generate 3 random numbers between 1 and 100.
b. Each random number must be passed to some other component to process the number in some way:
i. The first, called A, will double the number.
ii. The second, called B, will add 37 to the number.
iii. The third, called C, will square the number and subtract 100.
c. All three results will be stored for comparison.
d. The highest of the three values will determine the winner:
i. If A is the highest, then A wins; if B is the highest, then B wins, etc.
e. You will need to keep track of the winner in each round (A, B, or C), and a count for each of them to determine an overall winner.
f. Ultimately, your competition will have 100 values, thus 100 rounds of competition, and the number of winners should add up to 100.
2. The following should be considered for your Papyrus-RT implementation:
a. You will need 4 capsules: 1 central capsule for the generator and comparison, and 1 for each of A, B, and C.
b. You will need protocols for communication between the appropriate capsules.
c. This assignment will require passing of parameters with messages – you will need to look into how to do this.
d. A, B, and C should only receive messages with a number, process it in their own way, and send it back to the central capsule.
e. The central capsule should wait to receive all three results back, compare them, and determine that round’s winner (logging output), as well as update counters for the winner.
f. At the end of the 100 runs, the system should pick an ultimate winner; that is the system (A, B, or C) that had the most wins over the 100 rounds.
3. The following should be considered for your Simulink implementation:
a. You will need a variable to keep track of wins for A, B, and C.
b. You will also need to count the number of wins for each of A, B, and C.
c. Processing for A, B, and C should take place in separate subsystems.
d. Your values should work for BOTH simulation AND generated code.
e. Make sure to set all model properties as appropriate (things like solver type, step size, the type of output, etc.)

4. Once both are completed, you will need to “officially” run each 3 times as follows:
a. Run your Papyrus-RT system by generating the code, and running it 3 times just as we did for Lab 5, redirecting output to files for inclusion in submission.
b. Simulate your Simulink model twice, then generate the code and run it once for the 3 runs. You will need to capture the output in the workspace after each run.
What to Submit
• Your Papyrus-RT Implementation
o Include all structure diagrams, state diagrams, and code snippets in the same manner and detail as for Lab 5.
• Your Simulink Model Implementation
o A screenshot of the completed Simulink Model
o You must show the inside of any contained subsystems by opening them up and providing additional screenshots.
• Your Papyrus-RT Outputs
o The contents of the 3 files containing your output for the 3 runs.
• Your Simulink Outputs
o A screenshot of the workspace after the two simulation runs – delete all values after each run
o A screenshot of the workspace after generating and running the Executable file, and loading the resulting .mat file into the workspace.

This question has been answered.

Get Answer

Leave a Reply