Sign in to follow this  
AzeoTech

Recipes in DAQFactory

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this