Sequence structure and Latch action
Dear Sir or Madam,
I have a sequence with commands in each frame. Is there a way to have a
LATCH ACTION, between frames??.
Thanks in advance for your any help.
Sincerely,
Luis Diaz
[email protected]
I would recomend that you get rid of the sequence structures and use a state
machine. A State machine will give you a much more powerful and flexible
program. Browse the example programs available at the Resource Library of
NI's Developer Zone zone.ni.com). There is even an example called Pause/Resume
& State Machine.
"Kevin B. Kent" wrote:
>Luis Diaz wrote>> Dear Sir or Madam,>>>> I have a sequence with commands
in each frame. Is there a way to have a>> LATCH ACTION, between frames??.>>>>
Thanks in advance for your any help.>>>> Sincerely,>>>> Luis Diaz>> [email protected]>>Not
quite sure what you mean here.>You can pause between each frame, there are
2 ways to do this.>Add a frame AFTER the frame to pau
se>1) put in a timer
(Wait MS) you can hardcode this wait or have>a value that the user can enter.>2)
put in a while loop and have a button to proceed, or use some sort of>logic.>>All
this will do is send the commands and then wait for the timer to expire>or
the loop to end.>>A more elegant approach is to use a state machine. This
is a combination of>a case structure inside of a while loop. You have much
more control over the>>sequence of events and it is much easier to read and
debug.>>Again all this will do is wait between cases (if setup that way)>>Using
the state machine you can have a case return to itself which>is esentially
a LATCH.>>There are samples of the state machine at various locations.>>Let
me know if you need more help> Kevin Kent>
Similar Messages
-
Control references and sequence structures
My supervisor and I were discussing one of his programs, and he asked
me if I knew why he kept getting "Object reference is invalid" on a
property node that was using a reference. I couldn't figure it
out either, and eventually I said to try moving the actual control
itself (on the block diagram), into the first pane of the sequence
structure, and just feed the wire through.
This solved all of our problems... however both of us were
stumped with why what I suggested actually made it work. Anyone
know why this is?
Oops... I just realized that I made this on the breakpoint board
instead of the LabVIEW board...sorry. Although I suppose that the
people who frequent this might be the best to answer this...
Message Edited by Novatron on 07-14-2005 05:24 PMThere should be no difference between the two code versions IF you adhere to proper dataflow.
(Of course it is conceivable that the program is a mess and there is a race condition, e.g. if the reference is initially invalid and you set it elsewhere in the code via e.g. a local variable of the reference. In this case, a subtle change (e.g. the sequence structure) can rearrange the execution order for it to suddenly work by accident.)
I would be very curious to see a working example that demonstrates your described behavior.
LabVIEW Champion . Do more with less code and in less time . -
Question about stacked sequence structure
Hi,
I made a numeric control outside a stacked sequence structure, and connect the control both to frame 1 and frame 2. In frame 2 there is a while loop structure. And now I start the labview program with the control A. Then, after frame 1 finished, frame 2 started, now I want to change the control to B and deliver B into frame 2. But the indicator in frame 2 shows that the control is still A. So I wonder how can I change the control and deliver it to the frame after the frame has started? Thank you!
NI Software : LabVIEW version 7.1
OS : Windows XP
Regards,
jackaudenDataflow dictates what you are seeing. The control does not get read once the sequence starts. This is as expected.
Some possible solutions:
Just don't use stacked sequence! I don't and never feel limited by this choice.
Create local variable of the control and read from it inside frame 2.
Do you REALLY need a stacked sequence? Why???
LabVIEW Champion . Do more with less code and in less time . -
Making sequence structures a state machine
Hey I would like some help I need to work on changing my code and get rid of the flat sequence structure and replace with a state machine I have attached my code at an earlier state but would like some input on changing it over to a state machine in the sequence at the bottom of the code this program is used to cycle a valve and the sequences need to be done in order .any input would be great.
Attachments:
valve Cycles with temp.vi 132 KBRight click on the Flat Sequence and pick Replace with Stacked Sequence (never would have thought I'd say that.)
Right click on the Stacked Sequence and Replace with Case Structure.
Now a lot of wires will wind up broken. So you'll need to hunt them down and fix them. Those wires will probably need to go to shift registers so there values are maintained for the next loop iteration. Keep a copy of your original VI so you have something to refer back to.
Create a Typedef Enum and define what your states will be.
Start wiring the Enum into a shift register at the left of the loop, then into the selector of the Case Structure. Rename all the cases to what their respective state should be.
Wire enum constants in each case to direct what the next case should be. It will run out of the case structure to the right hand shift register.
Keep working and cleaning still everything is fixed.
Try running your VI to see if it behaves like it originally did.
Now you are safe to start making modifications to make it behave like you really want it to. -
How to find Latch and what actions need to be taken when there is a latch
Hi
Can you please tell me how to find Latch and what actions need to be taken when there is a latch?
Thanks
Regards,
RJ.1. What is a latch?
Latches are low level serialization mechanisms used to protect shared
data structures in the SGA. The implementation of latches is operating
system dependent, particularly in regard to whether a process will wait
for a latch and for how long.
A latch is a type of a lock that can be very quickly acquired and freed.
Latches are typically used to prevent more than one process from
executing the same piece of code at a given time. Associated with each
latch is a cleanup procedure that will be called if a process dies while
holding the latch. Latches have an associated level that is used to
prevent deadlocks. Once a process acquires a latch at a certain level it
cannot subsequently acquire a latch at a level that is equal to or less
than that level (unless it acquires it nowait).
2. Latches vs Enqueues
Enqueues are another type of locking mechanism used in Oracle.
An enqueue is a more sophisticated mechanism which permits several concurrent
processes to have varying degree of sharing of "known" resources. Any object
which can be concurrently used, can be protected with enqueues. A good example
is of locks on tables. We allow varying levels of sharing on tables e.g.
two processes can lock a table in share mode or in share update mode etc.
One difference is that the enqueue is obtained using an OS specific
locking mechanism. An enqueue allows the user to store a value in the lock,
i.e the mode in which we are requesting it. The OS lock manager keeps track
of the resources locked. If a process cannot be granted the lock because it
is incompatible with the mode requested and the lock is requested with wait,
the OS puts the requesting process on a wait queue which is serviced in FIFO.
Another difference between latches and enqueues is that
in latches there is no ordered queue of waiters like in enqueues. Latch
waiters may either use timers to wakeup and retry or spin (only in
multiprocessors). Since all waiters are concurrently retrying (depending on
the scheduler), anyone might get the latch and conceivably the first one to
try might be the last one to get.
3. When do we need to obtain a latch?
A process acquires a latch when working with a structure in the SGA
(System Global Area). It continues to hold the latch for the period
of time it works with the structure. The latch is dropped when the
process is finished with the structure. Each latch protects a different
set of data, identified by the name of the latch.
Oracle uses atomic instructions like "test and set" for operating on latches.
Processes waiting to execute a part of code for which a latch has
already been obtained by some other process will wait until the
latch is released. Examples are redo allocation latches, copy
latches, archive control latch etc. The basic idea is to block concurrent
access to shared data structures. Since the instructions to
set and free latches are atomic, the OS guarantees that only one process gets
it. Since it is only one instruction, it is quite fast. Latches are held
for short periods of time and provide a mechanism for cleanup in case
a holder dies abnormally while holding it. This cleaning is done using
the services of PMON.
4. Latches request modes?
Latches request can be made in two modes: "willing-to-wait" or "no wait". Normally,
latches will be requested in "willing-to-wait" mode. A request in "willing-to-wait" mode
will loop, wait, and request again until the latch is obtained. In "no wait" mode the process
request the latch. If one is not available, instead of waiting, another one is requested. Only
when all fail does the server process have to wait.
Examples of "willing-to-wait" latches are: shared pool and library cache latches
A example of "no wait" latches is the redo copy latch.
5. What causes latch contention?
If a required latch is busy, the process requesting it spins, tries again
and if still not available, spins again. The loop is repeated up to a maximum
number of times determined by the initialization parameter SPINCOUNT.
If after this entire loop, the latch is still not available, the process must yield
the CPU and go to sleep. Initially is sleeps for one centisecond. This time is
doubled in every subsequent sleep.
This causes a slowdown to occur and results in additional CPU usage,
until a latch is available. The CPU usage is a consequence of the
"spinning" of the process. "Spinning" means that the process continues to
look for the availability of the latch after certain intervals of time,
during which it sleeps.
6. How to identify contention for internal latches?
Relevant data dictionary views to query
V$LATCH
V$LATCHHOLDER
V$LATCHNAME
Each row in the V$LATCH table contains statistics for a different type
of latch. The columns of the table reflect activity for different types
of latch requests. The distinction between these types of requests is
whether the requesting process continues to request a latch if it
is unavailable:
willing-to-wait If the latch requested with a willing-to-wait
request is not available, the requesting process
waits a short time and requests the latch again.
The process continues waiting and requesting until
the latch is available.
no wait If the latch requested with an immediate request is
not available, the requesting process does not
wait, but continues processing.
V$LATCHNAME key information:
GETS Number of successful willing-to-wait requests for
a latch.
MISSES Number of times an initial willing-to-wait request
was unsuccessful.
SLEEPS Number of times a process waited a requested a latch
after an initial wiling-to-wait request.
IMMEDIATE_GETS Number of successful immediate requests for each latch.
IMMEDIATE_MISSES Number of unsuccessful immediate requests for each latch.
Calculating latch hit ratio
To get the Hit ratio for latches apply the following formula:
"willing-to-wait" Hit Ratio=(GETS-MISSES)/GETS
"no wait" Hit Ratio=(IMMEDIATE_GETS-IMMEDIATE_MISSES)/IMMEDIATE_GETS
This number should be close to 1. If not, tune according to the latch name
7. Useful SQL scripts to get latch information
** Display System-wide latch statistics.
column name format A32 truncate heading "LATCH NAME"
column pid heading "HOLDER PID"
select c.name,a.addr,a.gets,a.misses,a.sleeps,
a.immediate_gets,a.immediate_misses,b.pid
from v$latch a, v$latchholder b, v$latchname c
where a.addr = b.laddr(+)
and a.latch# = c.latch#
order by a.latch#;
** Given a latch address, find out the latch name.
column name format a64 heading 'Name'
select a.name from v$latchname a, v$latch b
where b.addr = '&addr'
and b.latch#=a.latch#;
** Display latch statistics by latch name.
column name format a32 heading 'LATCH NAME'
column pid heading 'HOLDER PID'
select c.name,a.addr,a.gets,a.misses,a.sleeps,
a.immediate_gets,a.immediate_misses,b.pid
from v$latch a, v$latchholder b, v$latchname c
where a.addr = b.laddr(+) and a.latch# = c.latch#
and c.name like '&latch_name%' order by a.latch#;
8. List of all the latches
Oracle versions might differ in the latch# assigned to the existing latches.
The following query will help you to identify all latches and the number assigned.
column name format a40 heading 'LATCH NAME'
select latch#, name from v$latchname; -
Copy and paste action sequence?
i have an action sequence set to play on application start, but i also want to set it up to play whenever a user navigates to that specific page
Hello.
You can't copy-and-paste action sequences yet.
But you can if you were to open it in Flash Builder, but this would require a lot of 'fiddling about' with. -
Labview Crashes when adding case and sequence structures
I am running into a problem that I have never experienced before - when I am adding case and sequence structures to a version of code I am writing, Labview 6i crashes (i.e CPU allocation jumps to 95% on the task manager and hangs there) requiring an "end task". I am writing the code within XP Pro running on a 1.7 Ghz Pentium 4 machine with 512 MB.
The code is used to control valves and temperature controllers on a Noble gas analysis line and is fairly simple. There are multiple nested sequence (30 steps long) and case structures within a while loop. The code itself is around 1.9 MB, so given the speed and on-board memory of my machine I doubt that I am reaching and physical limit in terms of the memory or proce
ssing power required.
Has anyone ever seen something like this? Could the code have been corrupted by an email transfer? If so are there ways to recover? Any help would be greatly appreciated.Yes. At least to 6.0.2. Also, you might be able to fix the problem by doing a mass recompile of the directory that the vi resides in, this fixed a similar problem I had about a year ago. Just start Labview, but don't open any of the VIs in that program, then select Tools->Advanced->Mass Compile. I am not sure why it worked for me, but it did, I think it cleans up the code a bit.
Jon D
Certified LabVIEW Developer. -
Event structure in sequence structure troubles
Hello, for class I have to write a simple LabView calculator but I'm having some issues. This is my first taste of labview so I know the code isn't the best but I just would like to know what's causing my hang up. I have two similar event structures with in a sequence structure. When I run it it goes through one loop of the while loop and then hangs, I tried stepping through it but can't figure out where it goes. If I don't have the second event structure it works more or less fine. Been working on this all day and hit this wall. Thanks.
Attachments:
lab1_3_try.vi 132 KBYou cannot have two event structures like that. Event structures queue up events, even if they cannot react to them because of dataflow. Your second event structure will also queue up all the events, but cannot execute them because it is not in the dataflow. In addition, your events are configured to lock the front panel until the event completes, and since some events can never complete, your panel is locked up forever.
Don't duplicate code twice, just keep state (A or B) in a shift register and do everything in a single event structure in a single loop.
What prevents you from hooking up the numeric terminals and buttons? Try to eliminate all these local variables keep the data in a shift register instead. Place each button terminal inside it's assiciated event and make them latch action. Now you can use "value changed" events instead of "mouse down".
LabVIEW Champion . Do more with less code and in less time . -
Use of user status and business actions
Hi all,
I'm new at status profiles, user status and business actions.
Currently we are using status profiles and user status for orders - but business actions aren't assigned to the user status. In a project I should evaluate whether we can use those business actions.
After reading a lot of documentations there is still one question left. What are the business-actions for and how can I use them?
Let's say I've a status profile with following user status with according business actions:
- status: new; business action: to progress
- status: in progress; business action: to confirm
- status: confirmed; business action: decline or close
- status: closed; business action: close
What happens when a user sets the status of an order to "confirmed"? Will be done additional checks for my order? - If yes: Wich checks will be done and exists there an API to effect these checks or to implement additional checks?
Regards,
ChristianChristian;
If you´re wanting to speak about Status Profile in OP. You can execute whole theses steps in T-code BS02, when in this IMG:
1. Enter a Status Profile.
2. Assign the status profile to an Object Type.
3. Define the User Status.
4. Assign Business Transactions to user statuses.
5. Translate the status profile and user statuses.
You can also to use this function to simulate the status development for a particular object.
To do this, select a status profile and branch to the screen "Allowed Object Types". Then place the cursor on one of the object types.
Using the function Extras -> Status simulation, you can simulate the status changes that could be caused by performing various business transactions, or by changing the staus manually, during the lifetime of the object concerned.
You can also branch directly from simulation to status maintenance for the object concerned, to display information on which transactions are allowed or disallowed in the current situation.
The log function records all the changes you simulate and allows you to navigate freely to see what effects these are having.
Status profile info
Using the function Extras -> Status profile info, you can display a list of all the entries you have made for a particular status profile. The list is structured as follows:
The first block contains the permitted object types.
The second block contains the user statuses.
The third block contains the following information for each user status:
which transactions it allows
which transactions it allows with a warning
which transactions it disallows.
I hope help to you
Regards
Luciano Nobrega -
I'm attempting to create a calibration program, using the printer port, and a Vernier Serial Box by modifying a calibration program designed for the serial box.
There are six calibration points, and to collect them, I have it controlled by while loops so that the numbers are taken when a button is pushed, and this is inside a sequence structure so that I can get the six different points. I feed these numbers into two different arrays (for x and y values) and then try to use the linear coefficient analysis on these points, but the values for the slope and intercepts it returns are not correc
t.
If I cut out the array and coefficient analysis, and feed the same numbers in directly without the while loop and sequence structures, it produces the proper values... I don't know why the numbers it is producing are different, and I'd really like to know.
Thanks,
Karinne.I would use a data manager sub-vi that would be called by each from of the sequence structure that produced a data point. The data manager sub-vi could auto append new items or could place items in a specific entry of an array. Later on when you want to calculate the linear fit, call the sub-vi to return the array of values.
Stu -
I need to make a task with less as3 code and more timeline structure and event dispatcher !
I went to an interview in a big company. I had to make a task in which there is a wall with 3 lines and 5 columns filled with bombs.When you click on a bomb the bomb changes its scale, a robot enters, goes under the bomb and takes it, then goes to a smaller wall, makes the bomb smaller and place it at the same place it had been in the previous wall.I made the task with tween througout as3 code.The interviewer told me it was good but i need to make it with the less code possible and with more complex timeline structure and to use event dispatcher.What is the best way to do this ?
The immediate thing that comes to mind is they might want to see that you can balance work between design teams and development teams.
To do that, the robots movements (pick up bomb, bomb grows/shrinks, arms/treads/legs moving, sequences of 'doing things') can be timeline based so animators can work on those separate from code.
Developers would be working on the logic of keeping score, moving the robot around to the correct spot with path detection, collision detection, etc.
It's very similar to thinking in simple factories (which Flash is good at being automatically with timelines), and a bit of MVC (or just VC in some cases).
Big companies have lots of different types of employees so you'll probably be very specific in your role so you're efficient. -
IT0009: payment method "cheque" and dynamic actions
Hello,
I need your help on this issue.
I have looking for answers on the different posts but i didn't found any similar problems.
For a customer, i have to settle, in case of departure (leaving) action , the creation in background of an infotype 0009 from infotype 0000 with payment method 'C' - Cheque and the BEGDA equal to the first day of the month. It is a payroll need.
The dynamics action is easy to do but i have an error which makes appears the infotype. Actually, the information City is mandatory in SAP standard (?) in case of payment 'C' - Cheque.
I did the test and when i create infotype 0009, the name of the person, from infotype 0002 i guess, is put in the field but not the adress, city and postal code. If i select payment cheque, an errror alerts me that the city is mandatory for this payment method. If i put something, no problem, but i would like to automate it and retrieve data from IT0006. That is strange is when i delete the payee information (last and first name field) and validate the screen, no more error, even if i select payment cheque. And if i save and go back on the record, data from IT0006 (city, postal code and payee) have been automatically put in the infotype.
I would like to reproduce the same thing by the dynamic action but i can't access these fields because they are not part of the P0009 table but the Q0009 structure and i don't access it through dynamic action
Do you have some experiences to share on this topic ?
Thanks in advance.hi
To replace a check or to create a check instead of a bank transfer, the system must be able to access the
correct payment method. The standard system contains predefined payment methods. However, you can
also specify your own values.
The standard system contains the following methods of payment:
- C (Check)
- D (Transfer)
- M (Check with manual assignment of check number)
Reward points -
Event Structures and Do /While Loops
I have an Event Structure inside a Do/While Loop. One of the buttons in the event is STOP which stops the do while. The Stop Button itself is inside the event as suggested in the help. My problem is when I hit the stop button everything inside the Do/While runs 1 more time. Other than than the code works perfectly. is this normal behavior for a Do/While ..Event Structure??
The attached file is the code in a nutshell. I know it can sometimes be diffcult to TS w/o the actual code. Prob is I wrote it in LV2011 on the Lab PC and I have LV2010 at my desk. I don't have internet access in the Lab..of course.
If I hit the OK button 2x's it "does something...does something...build array" then again a second time. The build array is added to with each click of a button in the event structure. If the user hits the STOP it dumps the 2x's worth of data out to excel..except I get 3 rows of data rather than 2...as if the inner loop ran one more time.
Anyways. the only thing that caught my eye is the fact that I don't have a sequence structure around the "build data here" portion of the code. Would that affect how the STOP inside the do while loop is handled??
Attachments:
event_Do_While.JPG 90 KB -
Elapse vi in sequence structure
Hi Guys
I know there a thousand way to implement a time elapse funciton, but i am curious the reason it does not work
I set first elapse vi tartget time 5 seconds, second 2 seconds and third 3 seconds in a for loop
It works in first and second iteraion. after a few iteration, the second and third elapse vi do not count time any more( I seems that the elapsed time is overwritten by first one. If you probe the three time elapsed output, it is always 5.
Attachments:
sequence timer.vi 104 KBWell, if there are a thousand ways to do it, there are probably about 995 better ways to do it.
That being said, I believe you have to put a condition for each elapsed time that resets the timer on the first iteration of the while loop. And get rid of the elapsed times with nothing happenning. And learn how to use dataflow instead of sequence structures.
One FYI, too. Leave everything at the defaults except for the stuff you are changing - i.e., the reset and the time target. BIG HINT: i can = 0 only once.
Dataflow basics here.
Another BIG HINT:
Error in and Error out are inputs and outputs that could be used to enforce dataflow.
Bill
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all. -
Can you move back to a previous frame in a sequence structure?
I have a VI that contains a sequence structure with seven frames. I would like to add a button on the front panel to allow the user to move back to the previous frame. Is this possible?
ThanksI don't think that's possible. Try replacing the sequence structure with a
state machine.
A state machine is a case statement embedded in a while loop. Each case
outputs at least an integer to indicate the next case to be executed and a
boolean to indicate if the while loop should continue. The integer is wired
to a shift register. The input side of the shift register is wired inside
the while loop to the conditional terminal of the case statement. Outside
of the while loop, the input side of the shift register would be wired to a
constant indicating the first case to be executed.
To mimic a sequence structure, each case would take the incoming integer and
increment it by one. To move back to the previous frame, the integer would
be decremented instead.
"Jeff - PP
L" wrote in message
news:[email protected]..
> I have a VI that contains a sequence structure with seven frames. I
> would like to add a button on the front panel to allow the user to
> move back to the previous frame. Is this possible?
>
> Thanks
Maybe you are looking for
-
I signed on for a chat with someone, waited 15 minutes and then it closed with no one appearing and is now telling me to quit my browser and start again which I do not want to do as I have a load of windows open I need to keep available
-
Calculation of dates_service profile not taken into account
Hello everyone, I am trying to make dates calculation based on working days only. I have read few posts on the scn and known by experience that it should work with customizing service profile on crmd_serv_sla. However, after making all steps, it does
-
Netgear PCI Wireless Card in a Power Mac G4
I have a Netgear PCI Wireless Card MA311 and I'm trying to make it work in my Power Mac G4. Does anyone know of any drivers I can use or any way I can get online with it? An alternate option is the Linksys Wireless-B USB adapter (ver.2.8) that I have
-
G/L GR/IR Crearing account problem in linkage to Taxes
Dear All, There is an error message i am getting at the time of posting MIRO and the error message is No taxes alloed for G/R I/R Clearing account. So Please help me out Thanks, Tiru
-
Creating XML from large result sets
We are trying to create XML docs from queries that return somewhere in the neighborhood of 13000+ rows, each with as many as 30 columns. It seems someplace deep within the xmlgen utility or the xsu methods, we throw an OutOfMemoryError. This happens