04-17-2013 11:40 AM
I'm looking for a better way to manage scaling factors. What I've decided to do assign the slope and offset for a channel's scaling to a global variable. Each channel will require 2 global variables (one for slope and one for offset). Then when I want to update them I can do so from the Define Global Variables window. Also I can save the defined variables to a text file and me or my colleges can double check that values and have the file on hand if needed for reference later when working on spreadsheets.
Here are my questions:
1. What do you think about the plan above. Other suggestions?
2. Can I customize the data file header so that the value stored in a variable is written to a designated column? I would like to be able to write the slope and offset for each scaled channel above the channel name in the file header.
Regards,
Craig
04-18-2013 12:40 PM
Hi Craig,
What led you to consider controlling your scaling factors using global variables? Is there a certain aspect of global variables that is required for your application?
What type of data file are you creating, and how are you planning on writing to the file? Are you writing to a text file or a spreadsheet?
Once I have more details, it will be easier for me to suggest the best way to go about developing your application. Thanks!
04-18-2013 01:16 PM
Hi Emily,
Our data acquisition system has about 25 channels using the Scaling Modules and calibration factors. The metrology lab calibrates flow devices, thermocouples, pressure transducers, etc once a year and we update the scaling factors. Also it frequently happens that a device malfunctions and/or is repaired or replaced. In these cases the calibration factors have to be updated as well. Keeping up with and making sure the scaling factors are all updated is a little tedious when I have to click on the scaling module, click on the channel then compare the numbers in the a and b fields with the most recent calibration reports.
Each time I update the scaling factors I create a new worksheet name because someone working on spreadsheets may need the scaling factors from a test performed months ago. It'd be real simple if the scaling factors were in the data file. Since there not I have to check which version of the DasyLab worksheet we used for that test on that day and then find and open that worksheet and get the scaling factors.
I decided to use Global Variables because I wanted to write the slope and offset for each channel in the data file above the channel name. The more I learned about using the Global Variables I have come to realize that I don't think this is possible with the Basic DasyLab version I have, maybe not possible the Pro version either. But I did learn that I can enter all the scaling factors in one place (Define Global Variables window) and I can save the scaling factors to a text file. I can save this file with the ASCII data file for every test. Now the other folks in my group can help me keep track and make sure the factors are up to date without having to know or use DasyLab.
It's not that is's really a big deal to open each channel and check the scaling factors but if it's something I can do from my office when I'm not in the lab and have collegues cross check to make sure they're up to date there's a better chance that we won't miss updating any and the txt file are accessable to everyone who wants to see the scaling factors for a particular test day.
We are writing our data to ASCII files using the Write Data module. We're using Basic DasyLab V12.0
Thanks,
Craig
04-18-2013 01:25 PM
Craig,
This is very easy and can be performed this way.
In the linearization module, instead of using number you put in the field ${Var_xxx} where xx is the variable number. You can also achieve this, by right clicking in that field and selecting global variables.
Now you could also use the action module to save those variables in and *.ini file in any place you want.
For this I would suggest DASYLab Full because you have unlimited actions module and layouts that you can use to make a user screen for entering the variables dynamically
04-18-2013 01:39 PM
"In the linearization module, instead of using number you put in the field ${Var_xxx} where xx is the variable number. You can also achieve this, by right clicking in that field and selecting global variables."
This is what I learned to do a couple of days ago just before I learned about the SAVE option in the Define Global Variable window. We are using the Basic version in which the action modules are disabled. I started to learn about these until I discovered they were not an option for me. Maybe in the future we'll upgrade to the Full version but it's a price that a project not the company pays for so I don't think it'll happen.
"Now you could also use the action module to save those variables in and *.ini file in any place you want."
I remembering seeing an option in the Define Global Variables window that says write to ini file. Is this what your talking about? If it's available in the Basic version, please tell me more about how this works.
Craig
04-18-2013 01:48 PM
In the Basic version, I would just say that any number in the variable is saved in the worksheet. So that could be a solution for you. Unfortunately you would not be able to use different scenarios.
The Read and Save to INI in the global variables is the main INI file locate in the program folder.
The one I meant is really in the action module.
I feel that you should upgrade it to the full version. The price difference is not to high compared to the hours that it would take you to make changes.
04-20-2013 08:16 AM
In the dialog for defining globals there is a checkbox: In Datei-Header schreiben (DDF und ASCII)
This writes the variables to the file header, but only one per line.
You can define a global string like: strfmt (${VAR_1} ,8 ,5 )+" ; "+strfmt (${VAR_11} ,8 ,5 )+" ; "+strfmt (${VAR_21} ,8 ,5 )+" ; "+strfmt (${VAR_31} ,8 ,5 ) etc.
Check the box to write this string to the data header and you should be where you wanted to.
04-25-2013 11:01 AM
Yes,
That does what I asked. Great tip. Now I want to know if it's possible to customize the header information written by dasyLab when I check the HEADER box under ADDITIONAL INFORMATION in the WRITE DATA: ASCII FORMAT window of the Write module.
I noticed that when this box is unchecked absolutely nothing can be written to the header, even by the means you suggested with the global strings. Am I correct?
Thank you
04-26-2013 03:16 AM
In the "Write Data" module hit the "Comment..." button.
Even if the right-click menue does not offer the option to select global variables/strings from the list, you are able to enter the placeholders ${STR_XYZ}, and ${VAR_XYZ} to add the corresponding contents into the comment.
The attached image shows an example: gstring 1 and 2 have content "hello" and "cu". Their content appears in the ascii file in the header after the start oft the measurement.