While/time loop from pc clock
Hi Guys
I have some code that (currently) uses a while loop to periodically open a file and read from it (in its simplest form....and...the details are not germaine to this post)
The requirements have now tightened and the loop (While or Timed??) must read the file once every two minutes based on the computer clock (accuracy is not too important, certainly not milliseconds)
e.g. time is 11:35.... read file
time is 11:36.. ..do nothing
time is 11:37.....read file
time is 11:38.....do nothing
etc. etc.
In simpler terms (if thats possible)....have the loop perform the code inside it every two minutes with the time sequence coming from the pc clock.
I've looked at timed loops (but never used them) and they seem a possibility
So, could somebody show me an example of the best way to do this.
Thanks for your assistance and best regards
Ray
Solved!
Go to Solution.
Hello Ravens Fan
I have had an attempt (unsuccessfully) at your suggestion, but not much luck I'm afraid.
I'm kicking myself because I should know how to do this.
I have attached my attempt. Would you please take a look at it and see where I'm missing the next ingredient.
Kind regards
Ray
Attachments:
timed while loop.vi 8 KB
Similar Messages
-
[SOLVED] System time is +4hrs from hardware clock
Hello again.
Now I can't set up my system`s time properly. (Set system time from hardware clock)
Timezone is GMT+4 (Europe/Samara) and hardware clock (RTC) is set to proper time so does UTC.
But system`s time itself is 4 hours in the future from HW clock!
# hwclock --hctosys --utc
does nothing.
# timedatectl set-local-rtc 1
or
# timedatectl set-time "$mytime"
both do nothing and output following error:
Failed to issue method call: The name org.freedesktop.PolicyKit1 was not provided by any .service files
Also, removing /etc/adjtime does nothing!
How can I fix it?
Last edited by eruditorum (2012-11-25 10:52:14)ewaller,
hwclock from util-linux 2.22.1
Using /dev interface to clock.
Last drift adjustment done at 1353744432 seconds after 1969
Last calibration done at 1353744432 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2012/11/25 05:40:17
Hw clock time : 2012/11/25 05:40:17 = 1353822017 seconds since 1969
Sun 25 Nov 2012 09:40:17 AM SAMT -0.907738 seconds
Last edited by eruditorum (2012-11-25 04:35:10) -
1ms Time Loop / Event Trigger from Counter
Hi. I'm pretty new to LabView so I'm am hoping this is an easy question:
I need to read the pulse signal from some reluctors (toothed wheels that pulse a signal with each passing tooth). The amplitude of each pulse is above 2.2V so I was planning on using TTL counters.
I need to record the status of 5 counters with each increment of one of the counters For the RPM and tooth count, I can do this with a 1ms timed loop.
Question: Can windows successfully give a 1ms (accurate) timed loop? I know this depends on how much I am doing inside the loop but, for now, I just need to read 5 counters and store the data with a timestamp.
Is it possible to make a counter throw an event? If the counter is incrememented, can LabView be notified to then go off and handle a block of code?
Thanks for any help you can offer!I assume you also have an analog input card for the chasis?
So, it's probably possible to get 1ms timing with software timed loops, however based on my quick check of the manual for your chasis
http://www.ni.com/pdf/manuals/372780c.pdf (see section 2-2 for example)
You can use an Analog Comparison Event or a PFI channel to trigger a sample (i.e. your generated pulse is the sample clock). This could allow you to use your pulse to trigger an analog sample. Now, this doesn't get you timing information (it just gets you the value of the analog input at the time the event occurs). To get a time, you can use the counters on the digital card in the same way. You have the counters be driven by a fast sample, on-board clock. Then you can use your pulse events again to sample that clock. So each pulse, you get one analog voltage sample and one time sample from the counter. The resolution on this counter will be great, depending on how fast your counters can be driven (sometimes NI counters can actually be driven faster than the fastest available clock on the card or chasis).
Or you can just do the software loop. -
Time Out Dump while extracting data from table CKIS
Dear Friends,
I am getting TIme Out dump for the below code, while extracting data from table CKIS.
Table CKIS doesn't have any Indexes. Please guide me to resolve this.
Regards,
Viji.
form get_keko_ckis.
SELECT kalnr kalka kadky tvers bwvar matnr werks kokrs
FROM keko
INTO TABLE i_keko1
FOR ALL ENTRIES IN i_final_modify
WHERE matnr = i_final_modify-main_f
AND werks = p_werks
AND kokrs = p_kokrs
AND kadat = p_kadat
AND bidat = p_bidat
AND bwdat = p_bwdat.
IF sy-subrc = 0.
SORT i_keko1 BY kalnr kalka kadky tvers bwvar.
SELECT kalnr kalka kadky tvers bwvar posnr typps kstar
matnr menge gpreis
FROM ckis
INTO TABLE i_ckis_temp
FOR ALL ENTRIES IN i_keko1
WHERE kalnr = i_keko1-kalnr
AND kalka = i_keko1-kalka
AND kadky = i_keko1-kadky
AND tvers = i_keko1-tvers
AND bwvar = i_keko1-bwvar.
IF sy-subrc = 0.
SORT i_ckis_temp BY kalnr kalka kadky tvers bwvar.
LOOP AT i_ckis_temp INTO wa_ckis_temp.
wa_ckis-kalnr = wa_ckis_temp-kalnr.
wa_ckis-kadky = wa_ckis_temp-kadky.
wa_ckis-posnr = wa_ckis_temp-posnr.
wa_ckis-typps = wa_ckis_temp-typps.
wa_ckis-kstar = wa_ckis_temp-kstar.
wa_ckis-matnr1 = wa_ckis_temp-matnr1.
wa_ckis-menge = wa_ckis_temp-menge.
wa_ckis-gpreis = wa_ckis_temp-gpreis.
CLEAR wa_keko1.
READ TABLE i_keko1 INTO wa_keko1
WITH KEY kalnr = wa_ckis_temp-kalnr
kalka = wa_ckis_temp-kalka
kadky = wa_ckis_temp-kadky
tvers = wa_ckis_temp-tvers
bwvar = wa_ckis_temp-bwvar
BINARY SEARCH.
IF sy-subrc = 0.
wa_ckis-matnr = wa_keko1-matnr.
wa_ckis-werks = wa_keko1-werks.
ENDIF.
APPEND wa_ckis TO i_ckis.
CLEAR: wa_ckis_temp, wa_ckis.
ENDLOOP.
ENDIF.
REFRESH: i_keko1, i_ckis_temp.
ENDIF.
endform. " get_keko_ckisHi Try minimising the conditions in where clause
SELECT fields..... FROM CKIS
WHERE KALNR = KEKO-KALNR AND
KADKY = KEKO-KADKY AND
TVERS = KEKO-TVERS AND
TYPPS = 'M'.
after this, deleting unwanted records from internal table as per pending conditions...
Regds,
Anil -
To exit from the while(1) loop
Hi all ,
I have a simple question that if in a callback function of a command button, i use a While(bLoop)
loop , where bLoop is a boolean variable initially set to TRUE, then how can i break or exit from this while Loop by using a control on the front panel , which exits the while loop by setting bLoop = FALSE .
I have tried it but it is not exiting
Solved!
Go to Solution.The problem here is that CVI normally only executes one callback at a time. While you are in one control callback, no GUI processing and subsequent calls to other callbacks normally occurs.
You can try the following approach - but it is not really the best method:
while (b_loop) { // Inside a callback
... // Perform your tight program loop
ProcessSystemEvents (); // Force CVI to see if any GUI controls need servicing
If you have a different control callback to clear the global b_loop, this quick-and-dirty approach might work for you.
You should only use this technique for very simple programs - it can rapidly spiral out of control and end up in a mess if you're not careful. NI recommends that you do not use ProcessSystemEvents() inside a control callback.
JR -
Break out of a while loop from outside the loop
Hello,
I have an application where I have some nested while loops. Is it possible to break the innermost loop from a control that is outside of the inner loop? My inner loop is running a scan and read operation on the serial port and is reading data as it somes in. I need this loop to break when the user presses a button located in one of the outer loops so that another section of the vi can execute. Thanks in advance.
Greg
Gregory Osenbach, CLA
FlukeGreg,
You should place the terminal of the button in the innermost loop and wire out from there to the other locations the value is needed. If these are nested loops, the controls will not get read until the outer loop iterates again and this can only happen if the inner loop has ended anyway. Thus your scheme will not work.
Alternatively, you can place the control in a loop that executes in parallel,then use local variables of it in the other locations, but the above solution is better.
LabVIEW Champion . Do more with less code and in less time . -
Controlling a SubVI with while loop from another VI
Dear All,
this might be an easy Question but i couldn't catch an answer for it.
first of all i have a VI which i will use as a subVI , this VI is simply as shown in the "test_out of scope.vi" attached file
now i will use it inside another VI called "Main VI" as shown in the file "Main_VI.vi"
i'm just wondering , why couldn't i control the "Frequency" and "Stop" as i can do so while running the SubVI only without accessing it from another VI ?
isn't it possible to access objects inside a while loop from another VI if i just connected them in the connection Pane terminals ??
Thanks in advance to everybody
Message Edited by Mohammed.Ashraf on 06-09-2009 10:27 AM
Eng. Mohammed Ashraf
Certified LabVIEW Associated Developer
InnoVision Systems Founder, RF Test Development Engineer
www.ivsystems-eg.com
Attachments:
Main_VI.vi 10 KB
test_out of scope.vi 30 KBDo you need the sub-vi to run iterations for an undertermined period of time?
If so, then why not implement it as a parallel loop to the main one. Maybe part of a consumer loop.
If not. Where the main loop would take care of each iteration and call the sub-vi in one shot. Then no need for a loop in the sub-vi.
It's all a matter of how you want the software to behave. Have you looked at Event Structures?
R -
Hi, I would like to ask about how to capture data from real time loop.
Hi,
Here is some overvier of my project:
I have done real time control using labview 9.0. I used PID controller.
In order to optimise this controller, I need to capture data from my sensor(input) and actuator (output).
1. For example while real time control is running. I need to capture 1000 sample data (sensor(input) and actuator (output)).
Then I will used these data for PID optimisation on the other loop without intefere my real time loop.
2. When PID optimisation is completed, I will sent its PID parameter to real time control loop.
3. These operation is done in parallel.
Anybody can help me to solve these. Your idea may solve my problem.
TQTypically you will have to use RT FIFO or Queue communication to avoid any impact to your time critical loop.
Best regards
Christian -
Oracle mgw more time while fetching data from MQ
Dear All,
Good morning.
I am using oracle 11.2.0.3 version and using MGW to connect to MQ series (IBM WebSphere MQ ,Version: 7.5.0.0).
We are experincing delay while retriving message from MQ for some times and it is not happening always.
MQ2AQ
Found MQ MSG
>>2014-12-22 09:25:49 MGW Engine 1 TRACE Polling
Polling thread: JOB_MQ2AQ new msgCount = 1
2014-12-22 09:25:49
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:49 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:49
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:50 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:50
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:51 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:51
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:52 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:52
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:53 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:53
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:54 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:54
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:55 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:55
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:56 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:56
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:57 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:57
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:58 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:58
MQ2AQ
MQ MSG DEQ Start
>>2014-12-22 09:25:59 MGW Engine 1 TRACE worker0
entering deqMessages for job JOB_MQ2AQ
2014-12-22 09:25:59
MQ2AQ
MQ MSG DEQ Retry
>>2014-12-22 09:25:59 MGW Engine 1 TRACE Polling
Polling thread: skip polling JOB_MQ2AQ msg count=1
2014-12-22 09:25:59
MQ2AQ
MQ MSG DEQ Finsh
>>2014-12-22 09:25:59 MGW Engine 1 TRACE worker0
leaving deqMessages for job JOB_MQ2AQ with seqno 1544 deqMsgCount = 1
2014-12-22 09:25:59
MQ2AQ
MQ MSG ENQ to AQ
>>2014-12-22 09:25:59 MGW Engine 1 TRACE worker0
entering enqMessages for job JOB_MQ2AQ with request 1544
2014-12-22 09:25:59
MQ2AQ
ENQ MSG 2 AQ Finish
>>2014-12-22 09:26:02 MGW Engine 1 TRACE worker0
leaving enqMessages for job JOB_MQ2AQ with seqno 1544
2014-12-22 09:26:02
MQ2AQ
MSG REC
>>2014-12-22 09:26:02 MGW Engine 1 TRACE worker0
leaving commitMessages for job JOB_MQ2AQ with seqno 1544
2014-12-22 09:26:02
Above log took 11 sec to retrive the message from MQ
But the below log took 1 sec and i use the same message in both time.
MQ2AQ
Found MQ MSG
>>2014-12-22 09:35:01 MGW Engine 1 TRACE Polling
Polling thread: JOB_MQ2AQ new msgCount = 1
2014-12-22 09:35:01
MQ2AQ
MQ MSG DEQ Start
>>2014-12-22 09:35:01 MGW Engine 1 TRACE worker0
entering deqMessages for job JOB_MQ2AQ
2014-12-22 09:35:01
MQ2AQ
MQ MSG DEQ Finsh
>>2014-12-22 09:35:01 MGW Engine 1 TRACE worker0
leaving deqMessages for job JOB_MQ2AQ with seqno 1545 deqMsgCount = 1
2014-12-22 09:35:01
MQ2AQ
MQ MSG ENQ to AQ
>>2014-12-22 09:35:01 MGW Engine 1 TRACE worker0
entering enqMessages for job JOB_MQ2AQ with request 1545
2014-12-22 09:35:01
MQ2AQ
ENQ MSG 2 AQ Finish
>>2014-12-22 09:35:01 MGW Engine 1 TRACE worker0
leaving enqMessages for job JOB_MQ2AQ with seqno 1545
2014-12-22 09:35:01
MQ2AQ
MSG REC
>>2014-12-22 09:35:01 MGW Engine 1 TRACE worker0
leaving commitMessages for job JOB_MQ2AQ with seqno 1545
2014-12-22 09:35:01
It showing Polling thread: skip polling JOB_MQ2AQ msg count=1" multiple times. what is it mean?
Can anyone share any good doc which i can refer to debug oracle message gate way issue.
Thanks,
Shine.Your messaging gateway question would be better addressed in the SQL PL/SQL forum
All Places > Database > Oracle Database + Options > SQL and PL/SQL > Discussions -
How to stop while loop from looping
Hi, need a little help in the respect to while loops. Basically i have a while loop within an while loop within another while. So what i want to do is run the program within the outer while loop. The problem is that when i start the program it runs once, which is ok, but its the runs again and again and again. I need it to only run once untill i press the inner while loop bolean to set it going and to stop and to restart, but i can not manage to keep the inner loop from initerating. I just wonder if its a problem with the field point? because i know it works, but using a different example. Any help greatly appreciated.
Thanks Stuart
Attachments:
examplealib.llb 199 KBUse case structures around your middle and inner loops tied to the booleans you want to control the loops. Inside each loop, use a local variable of the boolean tied to the continue terminal of the loop.
You need to use local variables because an input to a loop (wired from outside the loop) is read only on the first loop iteration. Any subsequent change to a control terminal outside of the loop is not seen by the loop.
To create a local variable, on the diagram, right click on the terminal of interest, then select Create >> Local Variable. Then right click on the local variable and select Change to Read.
P.S. You know your stop button is wired to an empty case and doesn't do anything. -
Time Stamp Error while extracting data from R/3
Hi,
We are getting time stamp error while extracting data from R/3.
To solve this problem we did replication and run RS_TRANSTRU_ACTIVATE_ALL program. still we are facing same problem.
Please suggest me to solve.
Thanks
Subba RaoHi,
Time stamp error arises when the time stamp of the data source in source system and target system are different.
For we have again activate data source in R/3 system using transaction RSA5 or RSA6 and in BI system goto transaction RSDS and replicate the data source.
You can also find time stamp details for a data source in tables ROOSGEN and ROOSOURCE tables in BI and R/3 system respectively.
Here are some useful links.
[R3 016 Time stamp error where is it in BI?;
[time stamp error in bi7;
[Timestamp error in BI7;
Thanks,
Venu -
Tried to install OS X Yosemite on my MacBook. Got message that it could not be installed on my computer due to error while extracting files from package "Essentials.pkg". When i quit the installer as recommended it goes in a loop and gets stuck.
Hey corrafromlondon,
Thanks for the question. After reviewing your post, it sounds like the installer file isn't working. Have you tried deleting the installer and redownloading the installer? I would recommend that you read this article, it may be able to help you isolate or resolve the issue.
How to install OS X Yosemite on your Mac - Apple Support
you can find the Yosemite installer app in your Applications folder or Launchpad.
Thanks for using Apple Support Communities.
Have a nice day,
Mario -
Song loop from particular time
Ok,
I think this is something easy, but I dont know what to use.
I got a song that I cut at 54.4 sec and after the first
complete play I want this song to loop from 11.95 sec to the end!
Is there a way using action script or using a movie clip with
the song inside(cause I tried to put a gotoandplay to a particular
frame at the end, but it begin the song from the beginning)
thanks a lot in advanceUse the Sound class. Let's say your song is named mysong.mp3.
Once you import it into your library, select the icon in the
library, and choose linkage (right click on the icon) and then
click Export for ActionScript and Export in first frame. Name it
something (for this example we'll name it mysong). Click OK.
Then on your main timeline, enter the following code:
my_sound = new Sound();
my_sound.attachSound("mysong");
my_sound.onSoundComplete = function() {
// first parameter is the number of seconds the sound is
offset, the second parameter is the number of loops
my_sound.start(11.95, 99);
When you want to start the sound the first time, add this to
your frame or button code:
my_sound.start();
Study the other methods and properties of the Sound class.
This gives you a lot more control of sounds than placing them on
the timeline does.
Good luck,
Albee -
I have a iMac desktop and a macbook pro. If I purchase a time capsule, can I use it as the central location for my files for both computers? Can I access the files on the time capsule from my macbook pro when I am out of town?
Yes, with some provisos.. it is designed as primarily a backup location for Time Machine.
Look at Pondini who has a great deal of info in his KB of all things Time Machine .. as well as Time Capsule.
Q3 here. http://pondini.org/TM/Time_Capsule.html
Remote access is via BTMM and iCloud.. just look it up.
But the TC must be the main router in the network for it to work. -
Error while loading : Time conversion from 0CALDAY to 0FISCPER
Hi ,
I get the following error when loading to an ODs .
My 0FISCPER is mapped to one of the date fields from the extractor (Document date) and also Have 0FISCVARNT as part of data fields .
" Time conversion from 0CALDAY to 0FISCPER (fiscal year ) failed with value 20060405 " .
thanks .Hello CG
Please refere this forum
Time conversion problem
Thanks
Chandran
Maybe you are looking for
-
Automate Open and Close of Inventory Periods
Hello, I have a request below. I want to Automate the Inventory Periods to open and close for all sites once purchasing period has been closed. sites with pending transactions will not be closed and an email will be sent as an alert. Thanks a lot and
-
Perhaps via USB. I have a large amount of data that I want to back up and it is taking a very long time (35GB is taking 3 hrs, I have 2TB if files in total)...? I want to use TimeCapsule as back-up for an archive which is curently stored on a 2 TB WE
-
I got myself a MacBook Air yesterday after long time of wondering if I should. First impression - I'm quite happy for this sturdy little machine with great battery life. I have OS X 10.9.2 with the latest updates. It will take me a while to get used
-
Mac Mini to Mitsubishi WS-55809
My Mitsubishi WS-55809 is 1080i projection HDTV. It only has DTV (which the cable box uses) and 2 Component inputs. There are multiple S-Video and composite inputs. I have fallen in love (of course) with the component video out of a Apple TV and my T
-
BPEL Error in SOA approval process
Hi, In my composite workflow, i have added a java code to get manager email id from manager login to send an email notification to manager. I have set Oimclient.jar and Jps-manifest.jar in class path and successfully deployed the workflow. When i hav