AzeoTech Posted July 1, 2008 Share Posted July 1, 2008 A customer recently asked whether DAQFactory supports recipes. The answer is definitely yes. This is actually a somewhat common request, but the term "recipe" can have several meanings. In this case, a recipe is simply a group of setpoints. By calling up a recipe (by name) the device is loaded with all the setpoints required. The user asked for 12 setpoints, but I'm going to stick with 2 to keep things simple. Attached is a sample that shows a simple recipe system. It allows selection and setting of a group of recipes. Loading and saving of recipe groups to disk (in a comma delimited ASCII file that could be edited in Notepad). It also shows how to Add new recipes from within DAQFactory. Deleting and editing would be done similar. I'll admit that the screens aren't the most fancy, but they demonstrate what they need to. Feel free to post replies to this blog if anyone has any questions, or if you'd like to see how to do the other type of recipe system. The attached file requires DAQFactory 5.77 or newer. I've split the functionality into several sequences: StartUp: initializes the variables and preloads the recipes (not really required, or you could auto load from disk if you wanted). Recipes are stored as a two dimensional array of strings, where each row is a recipe and each column a setpoint with the first column holding the name of the recipe. I used strings to allow for the name, even though the setpoints are numbers. It doesn't really matter since unless you have a billion recipes the space / performance difference between storing numbers and strings is minimal. ResetDisplay: this function updates the combo box with the selection of recipes. This is called at startup, when a new recipe is added, and when recipes are loaded from disk. LoadRecipe: this function is called when the user hits the Set button and loads the currently selected recipe into the device by setting the two setpoint channels. AddRecipe: takes the settings in the edit boxes and adds a recipe with those settings. Called when the user clicks the Add button Load/SaveRecipes: loads or saves all the recipes to disk. The recipes are stored as a simple comma delimited file. DAQFactory's ReadDelim() and WriteDelim() functions make the real easy. recipesample.ctl Link to comment Share on other sites More sharing options...
karanp Posted November 28, 2009 Share Posted November 28, 2009 i having getting error when click set button or other button C1000 channel or function not found: LoadRecipe Line 4: Line 1 - Unable to perform quick sequence action Link to comment Share on other sites More sharing options...
AzeoTech Posted November 28, 2009 Author Share Posted November 28, 2009 The StartUp sequence is not marked AutoStart, so you will need to manually run it before using the app. I've uploaded the file with StartUp autostarting, but it will only work with more recent (5.79+) versions of DAQFactory. recipesample.ctl Link to comment Share on other sites More sharing options...
karanp Posted December 9, 2009 Share Posted December 9, 2009 thank you for your help, working fine now Link to comment Share on other sites More sharing options...
bull8042 Posted March 6, 2010 Share Posted March 6, 2010 I have been using a variation of this code with great success until I upgraded DF recently. Now when I try to add a recipe, I get the following error: Append() in variables not supported in this version of DAQFactory: when it tries to execute this line - "recipes.Append(newrecipe)" I can't seem to find where this function has changed or been deprecated in any documentation. How is appending handled now with regards to this function when a variable is involved. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 6, 2010 Author Share Posted March 6, 2010 I'm guessing you are using Express? Append() is not supported in Express. You can do basically the same thing by doing: recipes = concat(recipes, newrecipe) Link to comment Share on other sites More sharing options...
bull8042 Posted March 7, 2010 Share Posted March 7, 2010 Thank you, that works just fine. As a side-note, I am using DAQFactory Base Release 5.84 Build 1636 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.