Displaying enumeration values on time series

Moderator: Moderators

Displaying enumeration values on time series

Postby curtiselaugh@gmail.com » Tue Aug 30, 2022 5:07 pm

I have values in a block I would like to monitor on a time series chart. However, this value is an enumeration. Currently, the time series assigns the value 0 to any enumeration literal selected. Is there a way to associate each enumeration literal with a number - say an integer - and then plot that integer on the time series, to represent the value of the enumeration? I have been able to give each enumeration literal a specification integer, but this does not help the value show up on the time series chart. It would be great if I could do this, but I have found nothing after searching high and low.

Thanks!
curtiselaugh@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 13
Posts Rating:0
Joined: Tue Jun 14, 2022 11:08 am

Re: Displaying enumeration values on time series

Postby curtiselaugh@gmail.com » Tue Sep 06, 2022 2:09 pm

As far as I know, you cannot plot enumeration literals on a time series chart. However, you can bind an enumeration value type to an integer value type, and then plot that integer. This solution is similar to the one covered by MBSE Execution https://www.youtube.com/watch?v=hyBh7riHJO8.

Create an integer value type which will correspond to the values in your enumeration.
Define a constraint block, which contains the logic (your choice) you will use to make your mapping (case, if-else, ternary).
*important* Create your parameters for the constraint, but instead of typing the parameter, which will correspond to the enumeration as the same enumeration type, just type it as a String. This is important. For some reason you can't get any language (I tried almost all of them) to use comparison operators on enumeration literals. You must mismatch the constraint parameter bound to the enumeration literals, making it a string, in order for the comparison logic to work.
Now, in the element of definition using your enumeration literal, add the constraint property you just defined (and also don't forget to add an integer value property, which will serve as the enum literal's proxy), and then bind the constraint to your value properties in a parametric diagram. When Cameo warns you about the mismatch, just ignore.

Now you can see your enumeration literals change on your time series plot!
curtiselaugh@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 13
Posts Rating:0
Joined: Tue Jun 14, 2022 11:08 am

Re: Displaying enumeration values on time series

Postby curtiselaugh@gmail.com » Mon Sep 12, 2022 4:22 pm

Now I'm back with a better/different solution. Instead of exporting CSV data from time series charts, v19.0 at least allows you to export simulation data from simulation configurations. In a simulation configuration diagram, drag in an "execution listener" and configure it to look for the data you want. Then specify the file path for the eventual CSV file. Every time you run the sim config, this file is updated. If you are following this post, my original problem was representing enumerated data on time series charts. I wanted to do this so I could then export that data to a time-series CSV. Well, as luck would have it, execution listeners are able to record non-primitive types - or enumeration literals!

So there you go.
https://docs.nomagic.com/display/CST190/CSV+export
curtiselaugh@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 13
Posts Rating:0
Joined: Tue Jun 14, 2022 11:08 am


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 1 guest