Simplified Queue functions
The one problem with using the Queue functions is that they are all primitives. With that in mind MK and myself developed a Queue handler API that incorporates the primitive functions - as well as more advanced functions into a polymorphic VI.
We hope this improves your Queued State Machine experience.
Visualize the Solution
CLA
LabVIEW, LabVIEW FPGA
Attachments:
Queue API.llb 404 KB
VADave wrote:
We also used to use enums but to make a generic Queue handler we had to adapt to strings. We chose not wire the errors into the primitives so that an error generated in elsewhere by the code will not impact the operation of the Queues.
The main code error cluster is routed to the error cluster of the Queue handler so that we can trap on any error and redirect the queue to the error case. The error trapping is done be the Queued Error handler.vi which is placed to the left of the program cases.
In the Error case we look at the Queue element to tell if it is a programming error - misspelled string, missing case etc. or a genuine error from the program. We felt that there is a negligible chance for a Queue error since only the Queue handler vis interact with the actual Queue.
Could you share an example of your main code to illustrate the use of your VIs and what you are describing here. I've been working on a very similar set of VIs to publish on DevZone as a reference design/design pattern for this purpose and at the ame time clean up/consolidate the myriad of different implementations currently posted on DevZone.
I agree with your use of strings for the queue element to make the tools more reusable and digestible by less experienced LV users, though using a unique TypeDef Enum and associated library to manage the queue for each application would be stronger SW design. In some cases I think it is appropriate to choose ease-of-use over robustness.
Christian Loew, CLA
Principal Systems Engineer, National Instruments
Please tip your answer providers with kudos.
Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
Similar Messages
-
I am trying to use IMAQ acquire and other IMAQ functions with Queue functions.
i am trying to use IMAQ acquire and other IMAQ functions with Queue functions.
i mean i would like to acquire the image in a queue and deque it afterwards. would be the queue function accept the IMAQ data type?Refer posting, http://exchange.ni.com/servlet/Redirect?id=8879554
-
What is the purpose of queue functions?
well what is the relation of queue functions of Labview
and queuing theory, like MM1 system MD1 system etc.
thanksOthers may have a better explanation and example, but I have found that queues in LabView are very useful when you need to transfer a lot of information quickly and want to make sure you don't overflow or drop elements. They are better at this than using variables because the writer can keep writing whether or not the reader has read the last element.
For instance, recently we were trying to record data on a cRIO device and get the fastest rates possible. We were recieving data from the FPGA FIFO and writing directly to file. When you try to record 32 channels of 32 bits/element at 1 kHz you begin to test the limits of your write to file function. Queues worked better than variables for this because every so many cycles the write function would sort of hiccup and pause, causing the elements in the queue to increase (backup). If we were using regular variables we would have had to wait for the recording to catch up before we could continue reading data. This would mean we would be overflowing the FIFO or missing data points. However, with a queue, elements could back up a little and then the record function would catch up. (As a side note, write to binary file worked faster than TDMS in these benchmark experiments.)
Can anyone explain it better?
[will work for kudos] -
How Queues functionality helps in Service Module
Hi,
How Queues functionality helps in Service Module.
how to get the queue details assign to the service call(Technician)
Please Suggest
Regards
VikramSridharan,
How to add technician to a queue.
Employee should be user of SAP?
Please Suggest.
Vikram -
Enum edits break queue function
I am using an enum datatype with a queue to create a data manager
subvi. The problem starts when I add items to the enum: all the wires
to the queue functions break. I understand that I changed the datatype
and that the queue functions are some kind of polymorpic functions that
adapt to the datatype you wire to it. What I would like to know is how
I can easily make the queue functions adapet to the new datatype. Or
should I fall back to strings instead?Hi Aart-Jan,
It looks like CHAOS has a solution! Oh well, for what it's worth...
I coded this (attached) under 7.1, used a strict (simple) enum bundled with variant, but was unable to reproduce the problem. I've experienced odd behaviour related to type-def ambiguity at the output of case structures, and where shifted value is supposed to determine type in other cases. I'd try, instead of deleting/replacing the queue operators, deleteing/re-wiring, forcing shift-register to use queue-type from case shown.
Cheers,
D.
Message Edited by Dynamik on 09-14-2005 04:24 PM
When they give imbeciles handicap-parking, I won't have so far to walk!
Attachments:
quetyp.llb 20 KB -
Petition: "Insert to queue" function for creativ
I would really appreciate such an option in zens. I was disappointed that my micro didn't have it. It might be confused with "add to selected" but it's quite different, let me explain it by an example.
For instance with "add do selected" i added 00 songs to my selected music. While listening to those songs let's say in shuffle mode(that's i use most), all of a sudden I wanted to listen R.E.M losing my religion, and just after that let's say linkin park-numb. So what I do is although it's in my selected music I enqueue losing my religion as st and numb as 2nd. These songs play and aferwards it continues with other songs in my list. The use of it is I can do it any time I want, i don't need to create a playlist in a certain order each time my tastes change.
I remember there was such a function in winamp, maybe it was a plug-in or a patch, I'm not sure.
I guess an "insert to queue" tab in the menu appearing when you tab the scroll pad in the "selected music", would be very useful and I would be very grateful for it. It wouldn't be a hard thing to include in the firmware i guess.
SSR said Rio Karma had such an option. It would be nice if my zen had.
So, to sum up:
I signed for the petition to include "insert to queue" in the next firmware for all zensa play next or insert into que option would be good.
Also when adding music to a playlist on the player, i've found the only wauy to insert a track somewhere is to open a playlist, then add a new track, then go to selected music, if you select change order it wont let you put the new track in the playlist, loaded in selected musis, only at the top or the bottom of a playlist.
the only way round this is to have just the playlist and the aditional tracks loaded then to save them as a playlist with the same name, it will say "playlist already exists on player overwrite?" save it, then clear the selected muisc, re-load the playlist with the new tracks at the bottom or the top, and then sort out the order.
save and overwrite the playlist again, and the new tracks have been inserted.
theres got to be an easier way than that, come on creative. -
I need a queue function in itunes !!!!!!!
Hello
Am I the only who thinks it is very annoying that itunes does not have a queue funktion. If you want to pick the next song, you have to create a play list to chose what to hear next. So I would love if itunes has added this function to their next version.
Fillip DkSeveral people have made this point, but Apple doesn't read thre forums.
How about putting your suggestion to Apple with this feedback form:
http://www.apple.com/feedback/itunesapp.html -
I have a producer consumer with multiple consumers. Each consumer has its own queue. Say three consumers. I am using a que library where obtain queue, enqueue, dequeue are all wrapped in upper level functions.My question is should these wrapper VIs needs to be re-enterant? TIA
CLD,CTD
Solved!
Go to Solution.
Attachments:
Queue.jpg 108 KBMainVi.jpg shows how data is passed from UIR loop to other loops.
The image attached as "AnotherThread.jpg" different queue are used to enqueue and send data to other loops.
Can the same wrapper marked as shared clone be used across each queue and can still create separate queues? Or should there be different wrappers created, one for each queue?
CLD,CTD
Attachments:
MainVi.jpg 185 KB
AnotherThread.jpg 159 KB -
RW_SERVER_QUEUE: Stop Cleanup Queue Function
How can I stop the rw_server_queue function "clean_up_queue" from running? I don't want all my scheduled jobs lost if I stop/start the report server.
Jon,
Thanks for your response. I am running in 8i. Can
reports be scheduled via dbms_jobs in 8i? I have
searched the documentation and do not see any
examples showing how to do that.Yes, you can use dbms_jobs in 8i to schedule a stored procedure. The stored procedure can use util_http to request the report. Look at pr_example below.
Re: Auto running of Reports -
SAP HANA D3 Library errors - "queue" is not a function
Hello all,
i have a question regarding D3 Integration into SAP HANA and hope one can help me.
The last days i developed a D3 Choropleth (spatial data) with hover effects, tooltips and a legend. I have an existing SAPUI5 and HANA XS application running and now i wanted to integrate my D3 Choropleth.
1 ) First of all, i added the following tags into the head section of the index.html file of my SAPUI5 project as i need those libaries.
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript" src="http://d3js.org/queue.v1.min.js"></script>
<script type="text/javascript" src="http://d3js.org/topojson.v1.min.js"></script>
2) Then, i added the program code of my D3 Choropleth into the view.js of my SAPUI5 project:
var html2 = new sap.ui.core.HTML("d3choropleth", {
content: "<div class='D3Choropleth'>" + "</div>",
preferDOM: false,
afterRendering: function() {
.... here is my code ...
I have a SAPUI5 shell with different NavigationItems (tabs) and for this D3 Choropleth tab i am writing:
case "WI_choropleth":
oShell.setContent(html2);
break;
When i start my SAPUI5 project and klick on the tab where the D3 Choropleth should be rendered, i get the following errors:
d3.scale.threshold is not a function
d3.geo.albers center is not a function
queue is not a function
Moreover, i have to say that my D3 Choropleth works standalone outside HANA very well, that is why i assume it is a library integration issue.
In my browsers (firefox) developer console i can see that there is a D3 library loaded by default (as it is one of SAPUI5s components) with the path: sap/ui5/1/resources/sap/ui/thirdparty/D3.js.
BUT this is a really old version of D3 (2.9), the current release is D3 (3.4), so maybe the problem is that the D3 libary that is loaded by default overwrites my integration of D3 (script tag above)?
Does anyone have the same issues and knows how to solve that? Furthermore it seems that the d3 queue library is also not integrated as the error "queue is not a function" occurs and i also ask me how to solve that error.
We have SAP HANA Developer Edition Revision 80 (by AWS), HANA Studio and Client are on revision 73 (64bit).
It would be great if anyone could help me with my issue.
Further question: Is the current release of D3 going to be integrated into the next HANA revision?
Thanks a lot & regards,
AndreasHi Andreas,
You are right. The way you integrate the libraries in your code is not the way that will work for HANA XS projects. This is why it doesn't accept the queue function (library is not loaded) and also why the 3.x only D3JS funcitons are not accepted (only the internal D3JS library is loading and these functions were not a part of 2.9 yet).
To integrate third party libraries, you need to add XSJSLIB files to your project. These need to pass the server-side JSLint checks before accepted by the XS engine. (Client-side checks that fail might not count though).
Please see this post from David Brookler for more information.
http://scn.sap.com/community/developer-center/hana/blog/2013/12/23/db001-using-libraries-in-xs
Best regards,
Tobias -
Does Charm supports the stms function "Adjust queue"
Hi Gurus.
Our SOLMAN Prod is on version 7.0 SP 25 and I'm trying to activate new system to use the CHARM for transports.
In the new satellite system, the "Adjust queue" function in STMS was used.
Does CHARM supports this function?
Any suggestions will be greatly appreciated.
Thanks,
TessHi,
Yes, ChaRM support this functionality.
If you have configured transport routes between systems in different transport groups, the requests to which the transport files are to be transferred are displayed in the import queue of the target system.
Before you can import these requests, you have to transfer the data files and co-files belonging to the requests by Adjusting the Import Queue.
See also: http://help.sap.com/saphelp_smehp1/helpdata/en/06/ea457a12a711d3b46f006094b9ea64/content.htm
This is the only information i have. I hope that helps.
Thanks
Regards,
Vikram -
Project Server 2010 - Manage Queue anomalies
Morning All,
I'm currently experiencing an odd situation with the Manage Queue function in our Project Server. For the entire year I've been using PS the Manage Queue has never consisted of much more than a couple of projects awaiting check-in.
I logged on last week and saw that timesheets are now in the queue. This is particularly odd as we don't use timesheets so I'm unsure why these are now showing in the queue.
The screen shows the following:
Queue Type = timesheet
Entry Time = 1am
Complete Time = blank
Project Name = N/A
Job Type = either Archive Custom Fields, Archive System Settings or Archive Resources
Job State = waiting to be processed
Percentage Complete = 0%
Owner = SVC_SPFarmadmin
This week it's also trying to archive projects. Everything is as above except Project Name isn't blank and Job Type says Archive Project.
I'm the administrator for PS and (as far as I know) I've not made any changes that would cause these to now be queueing.
I was wondering if anyone might know why this is happening, if it will cause any major problems and if there's a way to stop this occuring. Everyone here is as confused as I am as to what's going on.
Thank you in advance for your help!
Clair.This issue might need detailed troubleshooting, I would suggest you raise a support case with Microsoft.
Cheers! Happy troubleshooting !!! Dinesh S. Rai - MSFT Enterprise Project Management Please click Mark As Answer; if a post solves your problem or Vote As Helpful if a post has been useful to you. This can be beneficial to other community members reading
the thread. -
Hi,
I am getting an error in CIF Inbound queue (function: CIF_ORDER_INBOUND_30A). The error text says "Only 0 decimal places are permitted for unit of measure PC".
Can anyone point out the solution to resolve this error? It would be a big help for me as I am new to APO and so getting difficult to find a clue for it.
Thanks.
Regards
MansiHi Mansi,
Please check the cif queue you will get the order number from that order number you can find out material code. Then check the material master unit of measure in MM03 you have used some alternative unit of measure and system is unable to convert order to alternative unit of measure because of decimal setting. If you go to CUNI and check the unit if measure PC it is not permitted for decimal places. If you need decimal than change the UoMof Material and use diff UoM or allow the decimal for PC which is not good practice.
Regards,
R.Brahmankar -
How can I make a generic version of this function
Hi,
I have a lot of functions that follow the same general format:
public static List<ProductRecord> listProducts(int category, Connection con)
throws SQLException
// prepare a statement
PreparedStatement stmt = con.prepareStatement(SQL_LIST /* sql to list product records */);
try
// set some parameters
stmt.setInt(1, category);
// execute the query
ResultSet rs = stmt.executeQuery();
// create a vector for storing the result
Vector<ProductRecord> list = new Vector<ProductRecord>();
// append all records to the list
while (rs.next()) {
list.add(new ProductRecord(rs));
// return the list
return list;
finally
stmt.close();
}Is there a way I can streamline this using generic functions?
It would be great if I could write a generic function that could simplify each function to something like:
public static List<ProductRecord> listProducts(int category, Connection con)
throws SQLException
return someSpecialFunction<ProductRecord>(SQL_LIST, con, category /* would use a argument list here... */);
public static <T extends DatabaseRecord> T someSpecialFunction(String sql, Connection con, Object ... params)
// prepare a statement
PreparedStatement stmt = con.prepareStatement(sql);
try
// set some parameters
for (int i = 0; i < params.length; i++) {
stmt.setObject(i+1, params);
// execute the query
ResultSet rs = stmt.executeQuery();
// create a vector for storing the result
Vector<T> list = new Vector<T>();
// append all records to the list
while (rs.next()) {
list.add(new T(rs)); /* dont know how I could achieve this */
// return the list
return list;
finally
stmt.close();
I dont seem to understand generics engough to be able to complete the function.
Any ideas or suggestions on how I could achieve this would be greatly appreciated.
Thanks in advance!
- RobertYou'll need to pass T.class as well, because you can't do "new T(rs)" but you can do "Tclass.asSubclass(Tclass).getConstructor(ResultSet.class).newInstance (rs)" (I've not tested my code)
public static <T extends DatabaseRecord> T someSpecialFunction(String sql, Connection con, Class<? extends T> Tclass, Object ... params) {
list.add (Tclass.asSubclass (Tclass). getConstructor(ResultSet.class).newInstance (rs));
} -
Flush Event Queue doesn't work with "Key up"
Hi,
probably just a simple thing I am missing here. See the attached VI (including SubVI). In case 1 I fetch the Key Up event for ENTER and issue a Value Change on the Stop Button. This results in a check for the string length and in case it is too short brings up a dialog telling you the ID string is too short and brings you back to the ID entry. Unfortunately - when confirming the dialog with ENTER instead of using the mouse on the button theKey Up event fired again and therefore fetched by the Event Structure.
So I thought I just flush all events in the queue. To be sure, I put a time value on the flush function which proceeds AFTER the dialog is completed, so the ENTER Key Up should be deleted as well. Bummer is - it doesn't work. Anyone know why?
I tried as well with the dynamic event, which I unregistered right after the Stop Event is issued in the Key Up case. I then "re"register for the Key Up event at the same time/position as the flush event queue function is positioned now in the VI below. Still no joy.
What is my mistake? Thanks a lot.
Solved!
Go to Solution.
Attachments:
Manual_ID_Entry.llb 47 KBcomrade wrote:
I don't understand 2 things:
a) Why is the Key up event even fired? It doesn't come from the VI where the event structure resides and to which "Instance" the event is bound (VI->Key up), but from the dialog box (which is a different VI). Unless a calling VI inherits all events from its SubVIs or something like that.
b) Why isn't the event fired by the button in the dialog box discarded as the flush event queue function is supposed to perform?
Because you are slow. Not you personally. But compared to the computer, you just don't stand a chance. So you hit the Enter button on the dialog. That dialog's OK button activates on the key down. So the dialog is long gone by the time you manage to get your finger off of the Enter key. In fact, you loop should be back around to be waiting for an event first. So it is waiting for an event when you finally get your finger off of the button. Hey, we have a Key Up event!
Your current checking for the validity of the id is just flat out annoying. Use the Key Down? event to check for a valid character being entered. Notice the '?' in my choice of event there? That means it is a filter event. This means you can throw away (discard) the character being pressed before the control even sees it. You could also discard if there are already enough characters (Greater Or Equal, not Equal).
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Maybe you are looking for
-
Problem in rendering the XML using XSLT in Netscape 7
Hi there, I have used the XSLT to generate HTML codes from the XML datafiles. It works fine in Internet Explorer, but when I tried it on Netscape 7.0 , it just displayed the xml data, without the tags.. For example, In the xml ,I have the following :
-
Font is fuzzy not sharp lost crispness
the font on my computer has just gotten fuzzy. its lost its crispness, isn't sharp and is in all areas. how should I fix this?
-
How do I get LR to recognize a catalog?
I moved drives around and LR lost it's way...it didn't recognize the old drive in a new physical location. I've now got the data from the old drive on the new drive (larger) in the old location. I still can't figure out how to make it find the old ca
-
Why does my Safari open with American version, and home page with Apple iPhone 5 advert even though I have changed them in preferences, it happens every time no matter how many times I change them, when I open Safari its back to the USA and Apple hom
-
Dreamweaver CS4 Cannot get Spry.Data.NestedXMLDataSet with XML to work
Please help! I've created a page in Dreamweaver CS4 with a spry dataset. This works great. I've downloaded Spry.Data.NestedXMLDataSet and installed it but I keep getting an error that nested datasets are not supported. Thoughts solutions. Thanks, M