From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Designing a dynamic logging framework

Solved!
Go to solution

I'm currently wrestling with the design of a logging framework for the OOP redesign of an application of mine. The application is a simple state machine with events right now, but could be something more in the future. The application is a controller for a biological system, and as such has a few abstract classes:

 

1. Application, which dictates the way the controller will be used, be it to control pumps, run a couple simulations, or run a series of queued simulations

2. Controller, dispatches to different controllers to allow user choice. Communicates with "System" via the "ControllerInterface" interface

3. Model, to interface with system in a simulation setting. Receives commands via the ControllerInterface

4. Pumps/Sensors to interface with real system. Receives commands via the ControllerInterface

 

I'm mostly interested in logging outputs to an excel spreadsheet, a TDMS file, an SQLite database, or a true RDBMS that supports documents, like PostgreSQL.

 

My first idea is to have both the Controller and the Model commit their latest data (as an array of strings, or if possible, a cluster) to some sort of queue/functional global which the logging framework can then consume and dispatch to the chosen log method. This would allow each controller implementation to decide what it wants logged, while also letting the logging framework decide how the data is ultimately ordered in the final log.

 

An example output report may look like this:

 

 

Has anyone else designed this sort of framework that could possibly chime in on my design? Any insight is appreciated

0 Kudos
Message 1 of 4
(3,388 Views)

Hi ijustlovemath,

 

Your method seems like a good approach. I would suggest using case structures to set the log method. As far as the order of the data logged, it will follow the data flow you have established in LabVIEW. You could always sort the data in the array like in this example for a 2D array:

https://decibel.ni.com/content/docs/DOC-12264

 

Otherwise there is always the option of post-processing in Excel.


Do you have any more specific questions about how to create this program?

 

Best,

 

Hannah Z

Applications Engineer

National Instruments

0 Kudos
Message 2 of 4
(3,333 Views)
Solution
Accepted by topic author ijustlovemath

Thanks for the response! I ended up going with a named queue and processing it afterwards:

 

0 Kudos
Message 3 of 4
(3,330 Views)

Great to hear! Thank you for posting it to the forums - I'm sure others will find it useful for their applications too!

 

Have a great day.

 

Cheers,

 

Hannah Z

Applications Engineer

National Instruments

0 Kudos
Message 4 of 4
(3,302 Views)