PLC Programming from a VM

Join Date
Apr 2002
Location
Just a bit northeast of nowhere
Posts
1,117
Greetings all!

For the past year, I've been using a linux PC running windows XP in VMware Player for all my PLC programming needs. I've written a blog entry about my experiences with this setup, it's advantages and some of the pitfalls I encountered along the way. You can find it here:

http://forum.unitronics.com/index.php?/blog/16/entry-67-thoughts-on-linux/

It's a long post, and I'm just too lazy to copy-paste it right now :sleep:

Thanks!

TM
 
Like alot of people, I still use Windows XP for running my work-related programs. I know, lost in the 90's, but it works well for me.

About a year ago, I had a PC crash that set me back severely. I didn't lose any data - for years now, I've kept all my project data in a single folder, and copy-pasted to my backup hard drive regularly. However, it took three days to reinstall all the software after I recovered the PC.

That got me thinking - there's got to be an easier way to do this.

As the first entry on this blog describes, I've dabbled with Linux for a while, and with some sound advice, I decided to make the leap. I wiped Windows from my PC and installed Linux Mint 11. Then I downloaded VMware Player, created a new Vitrual Machine, and installed XP on that.

I was prepared for a raft of headaches arising from this - oh no, linux! oh no, vmware! - hardware issues, software issues, pain, hate, discontent! What I got was - nothing at all. No problems, no issues. The whole thing ran magnificently. Best of all, I can now back up my entire windows virtual machine to my backup drive.

Why is this so grand, you ask? Because my work PC is now essentially indestuctable. I can drop my laptop in the swimming pool, buy a new one, load Mint and VMware, drag-drop my saved VM into my home directory, and get right back to work. Alternatively, I can upgrade to a new pc and get rolling equally fast.

In the process, I've learned a few things, so if you decide to go this route, you may find these experiences helpful -

1. You can't do this with a netbook, at least not an Acer. Not enough ram, and atom chips lack the needed horsepower. Get a laptop with a 64-bit architecture, that you can upgrade to at least 8 Gig of Ram, and a hard drive large enough to accomodate everything you'll need. On the ram side, get as much as you can - mine has 5 gig, and I'll be upping it to 8 gig after the holidays.

2. The temptation is to use a minimalist distro, so you can allocate maximum resources to the VM (where you are doing all the work, after all). Resist this. I've played with Puppy, DSL, Bodhi, and Mint LXDE, and what you gain in performance for the VM is neglible, particularly in relation to the difficulty of using a minimal distro (unless you're into that kind of configuration headache).

Choose something that provides all you need up front. Linux Mint is an excellent option - it's based on the widely used Ubuntu, but includes alot of extras that Ubuntu makes you find yourself. I'm using Pinguy OS, which is derived from Linux Mint, and offers even more eye candy - who wants an ugly desktop?

3. As you can probably guess, I tried a lot of distros. Everybody makes a big whoop about live cd and live usb, but I found testing them that way to be a little pointless - you can't add software (need to test with VMware) and performance lags going that route, so you don't get a true flavor of what you'll have when installed. Apart from seeing if you like the screen, you'll pretty much have to install it to try it out.

So the first time you go to set up linux, create a home partition on your hard drive. When you install most distros, you'll have the option to assign this partition as your home directory. You can install the new system into the rest of the drive, and usually not have to move your important personal files around.

WARNING - that's not fool-proof, so make sure you back up your files first. If it works, it will save you alot of time and aggravation. But if something gums up, it'll kill you if you haven't backed up first.

4. When creating your Windows VM, dedicate some thought to division of responsibility. Simply put, if it doesn't need to be in the VM, put it in the linux host instead. I have about 2 gig of PDF reference files that used to be under windows, that now rest comfortably in my linux home directory, outside my VM. Accessing them is a breeze, with or without windows open, and it keeps the VM smaller. When you do run a backup, you can just backup the contents of the home directory - drag, drop, done - and preserve everything you need, including your VM and external files.

On the hardware side, 99% of everything I've tried has worked great. The most obscure thing I use is PCanOpen Magic Pro, with a USB adapter, and it worked right out of the box. I use an Iconcepts USB to serial adapter for most programming jobs, and it runs flawlessly.

Oddly, the only thing I've had trouble with is a Unitronics 1040 PLC - can't do direct USB to the panel. Apparently, there is a known issue with the linux driver for the usb-serial chip Unitronics used in this device. It's a linux issue, not a Uni issue (just to make that clear). So I just use my usual serial port adapter instead - no problems there.

Detailed instructions for how to do all of this are readily available on the web. Personally, I've found it a huge help (already recovered once [me and my distro hopping]).

Best of Luck, and remember - backups are your friend. This mainly about making them more complete and portable.

TM


tmoulder

A few more helpful tidbits:

1. When you set up your virtual machine, choose "multiple files" for your virtual hard drive. Makes copying alot easier if, as I found out too late, your backup drive is FAT32, and won't accept a single file larger than 4 gig. Theoretically, it can lead to a performance hit, but I haven't noticed one.

2. Don't pre-allocate the drive space. There's really just no reason to, and why use space you don't need?

3. If, like me, you have an original XP install disk, go out RIGHT NOW to microsoft's website and download the service pack stand-alone installers (1a, 2 and 3). MS has discontinued support for any version of XP prior to SP3, and you won't be able to get updates unless you install these directly. SP1a and SP2 can be downloaded through linux, but for whatever reason, MS only allows downloading SP3 from a windows environment.

On a side note, if you have a kvetchy program that doesn't like the later SPs, you can create a VM with any combination you like going this route.

TM


THE PLC KID

No worries dude. Good write up. I love my VM's but never used them on linux distros much. I will have to try it out.

Thanks
 
Hi PLC Kid,

There's several good reasons for using linux as the host, as opposed to Windows. Chief among these is no gradual loss of performance on the host, which will in turn impact the VM. Also linux is free, as in "free beer". So is VMware Player.

One huge advantage - not directly related to linux - is, it's portable. There's a VMware Player for every major OS, so if you absolutely must use a Windows machine, or Linux, or even a Mac, you can get your work VM up and running.

This can be huge. My entire XP VM will fit onto a 16 gig memory stick, so even if I had to borrow somebody's laptop, the only thing I'd have to install on their PC is VMware Player, then copy in my VM. Before I return it, copy out and uninstall the player.

For that matter, it would be neat to create a live USB install, with the needed software built in, and the VM installed on it. You'd need a pretty big USB drive, but imagine - you could fit your work computer in your pocket, and use any available laptop at your destination.

Way beyond my abilities though - I'm a user, not a hacker :)
 
Stuff I've used this successfully with:

1. AC Tech servo drives (ethernet, lan and wireless)
2. Seimens S7 PLC (Seimens USB-serial cable)
3. Unitronics PLC, V570 and 1040 (usb serial adapter, wireless ethernet)
4. Trio 206x motion controller (USB)
5. PCanOpen Magic Pro canopen networking software
6. BruMaster and DSMPro servo drives (usb-serial adapter)
7. IQ Master (usb-serial adapter)
8. SLC 504 PLC (usb-DH+ adapter)
9. Giddings and Lewis MMC 4-axis motion controller (usb-serial adapter)
10. Exor HMI panel (usb-serial adapter)

Note that in every instance where I needed an adapter, I would have anyway, even with a bare-metal install - you just can't find serial ports on laptops anymore.

This list is not complete by any means, just what I can recall off the top of my head. Ethernet is a little trickier this route, since you first have to set up comms to the device from linux. Once you can ping your target, you can reach it from the VM.

Thanks,

TM
 
Hi TurpoUrpo,

Correct me if I'm wrong, but my understanding is that KVM is a module built into the linux kernel that virtual machine 'ware can take advantage of to run VMs more efficiently, but itself is not really a program, like VMware and VirtualBox.

I did try QEMU, but I found it too bare-bones and unstable. VirtualBox was a bear to configure, and no USB support on the free product (which seems kinda brain-dead to me). So VMware was the natural choice - easy, user- and usb- friendly, and free.

Thanks!

TM
 
For that matter, it would be neat to create a live USB install, with the needed software built in, and the VM installed on it. You'd need a pretty big USB drive, but imagine - you could fit your work computer in your pocket, and use any available laptop at your destination.

I have a 500gig external harddrive I can run VMware directly fromwithout having to load it onto the host machine. I do notice some lag but I set this up as a "I am in the middle of BFE and I need to work"

Last time it got used, one of our engineers got his laptop zapped with 480 thru his USB port. As luck would have it, I was about 2 hours away so I got the copy of the program he was working on out of his hardrive. Dropped it on the external drive, went to best buy and bought the cheapest laptop they had and he was back in business the next morning. With the player sitting on the external drive he got the job done and we gave away the low end laptop as a door prize during a company party.

Now days when I travel I have 3 external drives. First is a back up current projects so I can carry them with me (it is docked with the server until I travel). The second is the one I described above. The 3rd is a clone to my laptop. This is in case my laptop hardrive fails, which is highly likely with the enviroments I have to work in.
 
Has anyone tried the Repository Software for maintaining copies.
I Know there are some tricks with Siemens (Multiple Folders) applications
But you can store the archived image.
I have used it in the past and intend to set it up at home.
It is open source and maintains current copies on all your equipment.
 
I've been using the XPmode built into Win7. Partially because it's a free license. For the most part I have been happy with it, but one thing I don't like is it seems like there are too many different files I have to backup for the VM.

How many files/directories do you need to keep track of with VMware for backing up? In how many different places are they?
 
I've been using the XPmode built into Win7. Partially because it's a free license. For the most part I have been happy with it, but one thing I don't like is it seems like there are too many different files I have to backup for the VM.

How many files/directories do you need to keep track of with VMware for backing up? In how many different places are they?

Why not only backup the vm itself?
 
Hi Turpo,
It may be just my ignorance of what all the files are for, but when I first started doing the VM thing I googled around in order to find out how to back up the thing. The tech in this particular thread I read suggested that the VM is actually not just one file in one spot, but that in fact is fragmented all over the place. I will see if I can't dig that thread back up.

Damian
 
Why would it be?

This is path to my xp mode vm hardisk.

C:\Users\XXX\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode.vhd
 
The tech in this Win7 forum suggests backing up all of the following.

.vhd = Virtual Machine virtual hard drive image
.vmc = Virtual Machine settings file
.vsv = Virtual Machine saved state file
.vmcx = Virtual Machine description and registration settings



http://www.sevenforums.com/virtualization/19604-how-copy-virtual-xp-machine.html

This isn't the same thread I saw before, but I think the Tech is the same.



Below are the instructions I made for myself so that i don't forget. I got the impression that If I needed to do a complete restore that I needed all these files.

=======================================
C:\Users\Damian\Virtual Machines
Copy contents of folder "Windows XP Mode_vmcx - Backup" into Parent directory
Windows XP Mode.vmcx
=======================================

=======================================
C:\Program Files\Windows XP Mode
Copy contents of folder "Windows XP Mode base_vhd - Backup" into Parent directory
Windows XP Mode base.vhd
NOTE: not necesssary to copy
KEY.txt
VXPEULA.txt
=======================================

=======================================
C:\Users\Damian\AppData\Local\Microsoft\Windows Virtual PC\Virtual Applications
Copy contents of folder "Windows XP Mode - Copy"
to overwrite conents of folder "Windows XP Mode"
This contains all the installed programs and settings
=======================================

=======================================
C:\Users\Damian\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines
Copy contents of folder "Windows XP Mode - Backup" into Parent directory
Windows XP Mode.vhd
Windows XP Mode.vmc
Windows XP Mode.vmc.vpcbackup
=======================================

=======================================
C:\Users\Damian\AppData\Local\Microsoft\Windows Virtual PC\VMCXBackup
Copy contents of foler "Windows XP Mode_vmcx_vpcbackup - Backup" into Parent directory
Windows XP Mode.vmcx.vpcbackup
=======================================
 

Similar Topics

Hello colleagues, Some time ago I started my adventure with programming. With your help and the courses, things are starting to come together...
Replies
13
Views
586
Dear All, I need a sample PLC program to count the output pulse of a mass flow meter so that a specific amount of mass (for example 100gm)can be...
Replies
2
Views
79
Hi Please I have zeilo smart relay #SR2A201BD but I don't have it's programming cable. Can I use any general usb/rs232 converter? Or need...
Replies
2
Views
78
Hi, Does anyone have thoughts or know of, can point in the right direction any published materials with a plumbing centric point of you explaining...
Replies
1
Views
125
@ All: what is your best guess on a potential range in increase in efficiency in % (i.e. saved programming hours, greater output, etc.) when...
Replies
5
Views
291
Back
Top Bottom