FreeMaster 3.0 reading variables via Activex

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeMaster 3.0 reading variables via Activex

Jump to solution
2,168 Views
LorenzoB
Contributor II

I am using Freemaster 3.0 ActiveX to read and write some variables from an external program.
The reading of each variable takes a few milliseconds using the ReadVariable command for each variable, to improve performance I wanted to know if there was a command that could read all the variables (or a part) in one go.

 

regards

Lorenzo

LorenzoB
Tags (2)
0 Kudos
1 Solution
2,139 Views
MichalH
NXP Apps Support
NXP Apps Support

Hello,

unfortunately, there is nothing like ReadMultipleVariables or similar call which would enable to read multiple values in a single call to ActiveX/JSON-RPC interface. It is actually a good idea, this call would reduce the overhead of the RPC. We will add it to the plans for some future version.

One theoretical way for you is to put the variables to a structure or array and use ReadUIntArray (or some other ReadXxxArray) RPC call. 

We are also planning to optimize the ActiveX and JSON-RPC servers in FreeMASTER so it would be running in an isolated process and its performance would not depend on the GUI thread load. Today, the RPC may take longer when UI is busy e.g. with drawing graphs or rendering HTML page. This new version will be coming later in 2022. We have an internal prototype which I could share with you for testing purposes.

Regards,
Michal

 

View solution in original post

0 Kudos
4 Replies
2,140 Views
MichalH
NXP Apps Support
NXP Apps Support

Hello,

unfortunately, there is nothing like ReadMultipleVariables or similar call which would enable to read multiple values in a single call to ActiveX/JSON-RPC interface. It is actually a good idea, this call would reduce the overhead of the RPC. We will add it to the plans for some future version.

One theoretical way for you is to put the variables to a structure or array and use ReadUIntArray (or some other ReadXxxArray) RPC call. 

We are also planning to optimize the ActiveX and JSON-RPC servers in FreeMASTER so it would be running in an isolated process and its performance would not depend on the GUI thread load. Today, the RPC may take longer when UI is busy e.g. with drawing graphs or rendering HTML page. This new version will be coming later in 2022. We have an internal prototype which I could share with you for testing purposes.

Regards,
Michal

 

0 Kudos
1,669 Views
StefanXYZ
Contributor I

Hello Michal,

I would appreciate a beta-version that would read a list of cached variables.
At the moment, each variable takes approx. 20ms.

Could you please verify, if I am using the correct command for reading cyclicly approx. 20 variables?

def readCachedVal(name):
  """
  Read the value that is currently in the cache of the freemaster app. Update rate is the rate that is defined in the variable
  declaration in the  freemaster project.
  :param name: string with name of variable as declared in the freemaster project
  :return: no_error: true if no error occurred
  :return: full precision number of the latest read value (cached value), i.e. what is present inside the freemaster app
           the
  """
  x = FM.ReadVariable(str(name))
  return x[0], x[1]

Thank you

Stefan

 

0 Kudos
1,665 Views
MichalH
NXP Apps Support
NXP Apps Support

Dear Stefan,

the version 3.1.4 which is going to support Read/WriteMultipleVariables API is on the way to be released by end of this month. Please wait for this official version.

Our recent measurements though show that the RPC overhead is typically not so bad in most of the cases when both FreeMASTER server and a client script are on the same machine. You should not expect really a drastic improvement with the MultipeVariable access - it will be most likely comparable to a sequential read or write of individual variables. Typically, the most limiting "bottleneck" of the performance is the communication speed of the UART or other interface used.  I recommend to analyze a communication line with a logic analyzer or hardware oscilloscope to see how the line is utilized and where are potential gaps - perhaps in MCU response time etc.

Using a faster communication like direct USB-CDC communication, CAN or Ethernet (TCP or UDP) should address the performance issues a better way.

Regards,
Michal

 

0 Kudos
2,127 Views
LorenzoB
Contributor II

Thanks for your reply, the test version might be interesting,
I first have to hear from my client to know the urgency, at the moment the system is working, mine was just an attempt to find an even more efficient way. In any case, perhaps in the new version we will still have the opportunity to use this new methodology.
I'll check and let you know.

 

regards

Lorenzo

LorenzoB
0 Kudos