LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modify LabVIEW code while it is running

Solved!
Go to solution

Hi everyone! I'm quite new in LabVIEW and I have a question.

If I modify a code while it is running will there be any problems? This code is a measurement automation code and I really don't want to screw the measurements up.

Thank You,

 

Edit 1: the code is in a shared hard drive. Assume that the code is running on a computer and I modify the exactly same code from another computer, will there be troubles?

 

Diego

0 Kudos
Message 1 of 17
(4,635 Views)

You can not modify code while it is running.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 17
(4,627 Views)

Thanks for the answer, but my question was not clear (I'm sorry): the code is in a shared hard drive. Assume that the code is running on a computer and I modify the exactly same code from another computer, will there be troubles? 

0 Kudos
Message 3 of 17
(4,616 Views)

Well... In reality the OS (I am guessing Windows) should have the file locked when LabVIEW has it open in the development environment (executing or not)  so still you should be unable to modify code while it is running.

 

If you are talking about modifying the source code of a LabVIEW executable, then you will have no problems. 

 

But just in case Windows and LabVIEW does allow you to modify a VI while it is open in another development environment. I believe when you are running in the development environment the code is compiled when you press the arrow, then that compiled code is running. So any changes made by an outside source would not effect the running VI. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 17
(4,599 Views)

Hi diego,

 

by default Windows is blocking access to executables which are running: so you are back to "you cannot edit code executed right now"… (I don't know how other OS behave in this case.)

 

Solution:

When you want to provide updates to your code you should copy the update to your shared drive. On the local computers you need to have an additional tool copying the update to the local computer: avoid running executables from the shared (network) drive…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 17
(4,590 Views)

I tried this experiment: I created on the shared drive a simple vi with a while loop and I launched it on my computer. Then I used another computer and I opened the same vi (in this shared drive) and I modified it and saved the changes. After that I came back to my computer and the code was still running without the changes, like if I didn't do anything. Finally I closed the vi and re-opened it, finding the changes made on the other computer. My concern is the following: if I save the modifications using a computer different from the one which meanwhile is running the code, will there be errors or problems during the execution of the original vi or will I be safe because Windows and/or LabVIEW "locks" the running vi and only after I close it the modifications will be noticed? Thank you again.

(English is not my first language, I hope I'm clear enough)

0 Kudos
Message 6 of 17
(4,578 Views)
Solution
Accepted by diegocava

@diegocava wrote:

I tried this experiment: I created on the shared drive a simple vi with a while loop and I launched it on my computer. Then I used another computer and I opened the same vi (in this shared drive) and I modified it and saved the changes. After that I came back to my computer and the code was still running without the changes, like if I didn't do anything. Finally I closed the vi and re-opened it, finding the changes made on the other computer.

 


I think you answerd your own question here.

 

Like I said When the LabVIEW development system runs a VI. The VI is compiled at launch, so any changes to the VI file will not effect teh VI currently running in RAM.

 

But what you are doing is "dangerous" and you should not be remotely modifying code that is currently running on another machine.

 

Modify a copy, stop the running process, and run your new code.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 17
(4,569 Views)

Thank you for the patience.
Why are you saying that doing this is "dangerous"? 

0 Kudos
Message 8 of 17
(4,565 Views)

It is just bad practice because you run the risk of introducing bugs and not having an unmodified version to fall back on.

 

If I bruoght down a production test system by doing something like that, I would lose my job. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 17
(4,558 Views)

I see, I was thinking that you were talking about some informatics-kind of danger. Thank you again for your help and time

0 Kudos
Message 10 of 17
(4,555 Views)