pysimCoder icon indicating copy to clipboard operation
pysimCoder copied to clipboard

scopy.py and RTPlot.py

Open robertobucher opened this issue 1 year ago • 2 comments

I've been asked to modify the 2 plots system in order to have the execution/simulation time on the X-axis instead of the sample value.

I've implemented a temporary solution (not yet in repository) where i have this solution:

  1. for the RT-scope in block diagram I send an additional parameter when I open the scope.py application with the sampling time: then I use this value to modify the X-axis on the plot
  2. For RTScope.py I put a new editor field with the sampling time in dialog and this value is used to recalculate the time value on the X-axis

A better solution is to send the time value in the data exchanged with the block diagram, but in this case there are a lot of blocks to be changed (serial, TCP, and UDP output).

Discussion is open!

robertobucher avatar Jan 12 '24 15:01 robertobucher

Hi, sorry for the late answer but I had a lot of exams this week and wanted to focus on that.

I also consider moving this to the blocks will be better long term solution (we can use get_run_time() function and get the time during each iteration) as time would be the last or first element in data array. Probably first, it seems more natural.

RTScope could then let user select whether he wants to view run time or sample value (and ommit received time in that case).

I am not sure whether sending time as first element should be default setting since it could cause troubles with other scopes in case someone uses them. Either way I think the user should be able to turn this option off because there might be a usecase that I want one device to send reference value over TCP/UDP to other device and in that case I want to send it without time.

michallenc avatar Jan 19 '24 17:01 michallenc

The solution for the RTScope block is simple. I can put a new input in block 0/1 to choose between "sample number" or "time" on X-axis in the plot.

In my opinion, the simplest solution is to have the execution time value in all other communications sending blocks and ignore the time in the receiving blocks. External sending applications should send a "dummy" time value.

I think that this solution is simple to be implemented.

I'm waiting Before starting to program this solution.

robertobucher avatar Jan 30 '24 06:01 robertobucher