LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Renaming typedef file caused constants reset

Hello!

Here's a short description of the problem I encountered:

I renamed the filename of the typedef that was used in my state machine for state coding (see for example State Machine template shipped with LV). As result I lost values of ALL constants that coded states in my state machine, i.e. they were reset to value of the first value in state enum.

Note: when opening state machine that used the typedef
I got the message something like "VI was changed in memory. Reload from disk or view from the memory?". And 2 buttons: View and Discard. I clicked "View".

Then after restoring all constants manually, I saved my work to archive and tried to rename typedef file again, the result was the same - all constants reset to first value of enum.

I restored files from archive, again renamed typedef file,
then closed my app WITHOUT saving state machine that used typedef. After opening my program I got the message "Searching for my typedef", pressed "Browse..." and loaded typedef from renamed file. Constants were left without any change (uh-r-r-a!).

Before posting this message to forum I tried to make an example to show the problem, but o-o-ps I failed to do it.
It didn't repeat even with my program.

This post can't be considered as bug report, as I can't repeat the problem. But I think the problem exists as I lost values of all constants after renaming typedef file, and this is the fact.

So my advice (that old as the world) to everybody is to save work even when innocent actions are made such as renaming typedef file names.

Probably somebody encountered this problem and knows how to repeat it.

Thanks for attention.
Any comments appreciated.
Rashid.

Using LV 8.0 (LV Run Time Engine 8.0.1) on Win XP with Russian locale, all VIs used in my programs have names in cyrillic sometimes mixed with english letters, e.g. "russian name (typedef).ctl".
0 Kudos
Message 1 of 4
(2,694 Views)
Hello Rashid,
 
I've tried playing around with this at length, and I can reproduce similar behavior -- but I have to follow some very specific steps:
 
  1. Select File >> New... and browse to "Standard State Machine"
  2. Select File >> Save.
  3. You will get a dialog asking "Do you want to save the new, unsaved files?" Click Yes
  4. Save StateMachineStates 1.ctl and StandardStateMachine 1.vi somewhere on your harddrive
  5. On the block diagram, right-click one of the enum (typedef'd) constants and select "Open Type Def."
  6. Select File>>Save As...
  7. Select "Substitute copy for original" and click "Continue..."
  8. Save the control as StateMachineStates 2.ctl
  9. Close the type def
  10. Select File >> Save on StandardStateMachine 1.vi
  11. From Windows Explorer, double-click on StateMachineStates 1.ctl
  12. Add a new item to the enum; save and close
  13. With StandardStateMachine 1.vi still open, rename StateMachineStates 2.ctl as StateMachineStates 3.ctl from Windows Explorer
  14. Rename StateMachineStates 1.ctl as StateMachineStates 2.ctl
  15. Double-click on StateMachineStates 2.ctl; notice that LabVIEW shows you the VI loaded in memory instead of the one on disk (ie, there are no extra items in the enum)
  16. Close all open VI's and controls
  17. Reopen StandardStateMachine 1.vi and notice the broken arrow. All the enum constants have been set to a default value.
 
Does any of this sound familiar (I realize this is a shot in the dark)? Did you rename your type def's from windows or from LabVIEW? LabVIEW should update your typedef's appropriately if you renamed it from within the development environment. If you do not save your state machine VI, however, the next time you open it will ask you where to find the *.ctl file.
 
I hope this helps shed some light on the issue -- thanks!
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 2 of 4
(2,660 Views)
Hello, Charlie,

I can say absolutely sure that I always used LabView to rename my typedef file. I never use Windows Explorer to rename typedef files (or any other LV files) in my practice.

Besides, when the values of my constants were reset there wasn't any broken wires. The block diagram wasn't corrupted. Everything was fine except default values of my constants. Due to that I noticed this error a little later - after renaming typedef file I ran my program and couldn't understand why it fails to act as should. When debugging this problem I went down to my state machine and only then I saw that all my state constants are reset to default values.

I never used "Substitute copy for original". I used only
"Rename" when renaming my typedef file.

I didn't add any items to my typedef. The only things I did are:
- renaming my typedef enum label in the *.ctl file;
- and "Save as.." -> "Rename..." - renaming my typedef file.

Besides, when I did try renaming 2nd time to reproduce such behaviour: I left typedef enum label without change and the behaviour was the same.

So, such behaviour (loosing constant values) I get TWO times.
But after I worked around this (see 1st post) I couldn't already reproduce this behaviour.

If I'll succeed in this one more time again, and be able to reproduce this behaviour, I'll certainly post to you my steps.

Thanks for attention.
Rashid.

P.S.

1. As to broken wires if I get it right - in your case you added new items to typedef but your case structure in state machine was not updated to contain new states handlers. If so, then it's obvious why you got broken wires. But as I didn't change the typedef itself (only renamed it), I didn't get broken wires.
2. I wouldn't be surprised if I'd have done something in the weird way: I mean renaming by Explorer or saving, closing and so on. I was doing everything from the LabView environment. As far as I remember I didn't rename the state machine vi file at that, only typedef file. And my state machine was always opened. The only file I was opening/renaming/closing was typedef file. And as far as I remember I opened it by "File -> Open..." and not right-clicking at constant and "Open TypeDef..".
3. I understand that my description is foggy 🙂 and that it's difficult to find this weird set of steps, but who knows. Anyway I appreciate your help.

Message Edited by Rashid on 06-13-2006 12:03 PM

0 Kudos
Message 3 of 4
(2,647 Views)

Hi Rashid,

Thanks for the additional information. My post was just a shot in the dark at trying to reproduce it. If you happen to chance upon some steps that reproduce the behavior, please be sure to post and I'd be happy to investigate more.

As always, thanks for the awesome feedback!

Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 4 of 4
(2,622 Views)