How can I use a local TwinCat 3 runtime with Hyper-V enabled? - plc

I'm trying to run TwinCat 3 XAR in a PC where I need to have hyper-V ON to run Azure IoT Edge (which uses hyper-V). Is there a way to run XAR with hyper-V turned on? Is there any way to isolate the cores from hyper-v or something else?

Edit 22 April 2022
For a complete tutorial on this see my blog post.
There is a way to accomplish this. You can do this by instead of having a local runtime, you can run the code on a runtime in a virtual machine. I got the idea from this reddit post.
To make it work I did the following:
Download and install VMware Player. Its free for non-commercial use. You can also use the paid Pro (Workstation) version. I'm not sure if this also works with Virtual Box.
Install TwinCAT BSD on the virtual machine as described in this excellent YouTube video by Jakob
If you're using VMware Player and need to enable UEFI you need to do the following as noted by YouTube user Eivind Hilde:
Follow the guide in the video, but skip the step where the firmware type is set.
Try to boot the VM. it will fail.
Open the .vmx file in the VM directory with notepad .
Find "firmware = "bios" and replace with "firmware ="efi"" and save. If this line doesn't exist, just add it somewhere.
It will now boot, and you can follow the guide in the video for the rest.
Run your TwinCAT project on the virtual machine, without the need to disable Hyper-V. 🎉
Previous answer
I don't think so. InfoSys mentions:
Hyper-V environment:
The runtime environment cannot be started inside a Hyper-V environment. This refers in particular to virtual Hyper-V machines, which are run in a privileged Hyper-V machine. As soon as a component of the computer uses Hyper-V, only the engineering environment (XAE) can be used on this computer, not the runtime environment (XAR).
But they also mention that:
TwinCAT attempts to detect these Hyper-V environments; however, it is in the nature of virtualization approaches that they do not wish to be detected and TwinCAT therefore cannot carry out any 100% detection.
So maybe there is some way you can prevent TwinCAT from detecting a Hyper-V environment. However, that is something I can't answer.

Related

Visual Studio Code on Windows server 2008

Can I install Visual Studio Code on Windows server 2008 ?
I am a developer but I sent the information to my administrators and they told me that the setup file crashes after launched
I get seput file from hee https://code.visualstudio.com/download
procesor: Intel(R) Xeon(R) Gold 6142 CPU # 2.60Ghz - 2.59 GHz
RAM: 8 GB
64-bit
virtual machine
1 CPU - 2 cores
Windows Server 2008
First time answering here so bare with my vintage reply formatting. (also pardon that i couldn't capture screen due to server is on a intranet that not accessible on this device causing a long reply)
Being a unfortunate fellow that need to work on legacy Systems and Application frequently, i happen to have a fresh 2008R2 server recently setup by my team's Server Admin with following specs:
processor: Intel(R) Xeon(R) Gold 5220 CPU # 2.20Ghz - 2.19 GHz ,
OS: Windows Server 2008R2 x64 ,
RAM: 8GB
The versions that is able to install was 1.70.3,which is the same version that is the last supporting versions for Windows 7 as well,if you happen to need to work on devices using that OS version.
although i'm uncertain whether it is a VM or not, i'd like to point out a few more things that your question did not cover but need to consider:
The installer version (System setup vs User Setup)
aside from the x64 |x86 | ARM installer differences, as you've not mentioned which versions of the build and which exact setup installer you sent to your admin, i've first replied which build version successfully installed on 2008R2, which as of writing the latest build was 1.73.0 and on run,it pop up a error message as follow regardless of System/User Setup:
This Program does not support the version of windows your computer is running.
in our current case that we want specific previous versions installer, VScode FAQ on previous versions have a URL lists that enables you to download a specific build version of your preferred setup. For my case (and also refer below to exactly why this one), i've go for System setup, and i know the aprox. supporting version was ~1.70.0, so i used the link as below and replace the {version} to start:
https://update.code.visualstudio.com/{version}/win32-x64/stable
Active Domain, Multiple user sessions etc.
Per VSCode requirements page stated,
VS Code does not support multiple simultaneous users using the software on the same machine, including shared virtual desktop
infrastructure machines or a pooled Windows/Linux Virtual Desktop host
pool.
as im not sure do you work solo or do have fellow colleagues to code on the server at the same time, you might need to reconsider to install using user or System setup.
if your intentions are to use exclusively on a specific AD account, then user setup should probably be good enough.
however, if the intentions was to setup say a shared Remote desktop connections on the VM that allows multiple RDC sessions simultaneously for coding,programming etc., so you intend to install a system setup to allow all users on said server to be able to use VScode, then you might run into the problem the VScode requirements stated it does not support.
in addition, as i was remote connected as administrator , when using a 1.70.2 user setup ,a different warning message as follow was thrown:
This user Installer is not meant to be run as Administrator. If you would like to install VS Code for all users in this system, download the system Installer instead.Are you sure you want to continue?
as the installer itself also checks with the operator on this matter, your admin may have skipped on the exact reasons why the install failed and just told you the installer crashed.
if you absolutely need VScode to run on the server but can't install for reasons, the last resort (aside from going for alternatives like notepad++) is to Setup a Portable Mode builds on your own workstation/devices first, then upload the package to the server and use it from there.
i wouldn't go into too much detail in that as this reply already span for a starwars trilogy length but keep in mind, version limitations still apply, and whatever add-ons you need, you need to download them first before bundle it into the package to upload and run on your server.
Anyone that is a System admin or infrastructure architects , do correct me on my novice understanding on Server settings etc. as although i'm primarily a programmer, i did end up touching a lot more things that i'm not specialized into over the few years of vendor career work so there bound to be incorrect/inaccurate concepts i spilled. cheers.

How do I run a Twincat program without PLC?

I am a beginner in Twincat and have been playing around with it. I watched this playlist where this guy explain structured text and successfully runs a program on his system. However when I try to run on my system, I get error 0x1028. Then I read that I have to configure parallel port as IO port in Twincat - got no idea how to do this. Help please!
You don't need to configure any parallell ports in TwinCAT 3 to run TwinCAT 3 software on your machine.
Not sure what 0x1028 means, but if you're running a 64-bit machine (which you these days most likely are doing) you need to enable Virtualization Technology Extensions (VT-x) in the BIOS of your computer. You also need to run the command C:\TwinCAT\3.1\System\win8settick.bat (as administrator from the CMD)
You could alternatively run TwinCAT in a virtual machine. How you achieve this is described here: https://alltwincat.com/2018/06/14/twincat-virtualization/

how to install operating system on a virtual machine programatically

It may be a duplicate question but i could not find it anywhere.
Anyway, my goal to install operating system(both linux and windows) programatically on a virtual machine running on vmware hosts.
Although my search, I am quite lost about where to start.
Is there a framework or project you can suggest?
You could use templates; i.e. create a VM, install the Linux distribution of your choice and make the VM a template. Then don't create VMs but deploy the template.
Alternatively, google for the Linux distribution of your choice and something like "network installation". You'll need a DHCP server and probably a TFTP and/or web server.
Working with Templates and Clones
Creating VMware Virtual Machine Templates
Try having a look at Vagrant: http://www.vagrantup.com/. It allows you to install/uninstall a predefined VM from the command line.

How to host the OpenStreetMap Locally

I want to host the OSM (OpenStreetMap) locally. I need the basic idea what are required for hosting the OSM and how the task can be done in a step wise manner. I have to host it in Windows7 environment.
Any kind of help will be useful.
switch2osm contains detailed instructions and requirements for setting up a OSM server. If you have a Windows system then better set up a Linux VM inside it.
A bit too old but I will just put it here for someone who is searching for the same thing.
An exact instance of OpenStreetMap can be hosted locally by following the installation guide of OpenStreetMap.
Quoting from the Link:
"These instructions are designed for setting up The Rails Port for development and testing. If you want to deploy the software for your own project, then see the notes at the end.
You can install the software directly on your machine, which is the traditional and probably best-supported approach. However, there is an alternative which may be easier: Vagrant. This installs the software into a virtual machine, which makes it easier to get a consistent development environment and may avoid installation difficulties. For Vagrant instructions, see VAGRANT.md.
These instructions are based on Ubuntu 12.04 LTS, which is the platform used by the OSMF servers. The instructions also work, with only minor amendments, for all other current Ubuntu releases, Fedora and MacOSX
We don't recommend attempting to develop or deploy this software on Windows. If you need to use Windows, then try developing this software using Ubuntu in a virtual machine, or use Vagrant."

Physical to virtual conversions?

Can I really do this?
As I am reading up on virtualization, I am getting more excited. The latest thing I am realizing, that it may actually be possible to take my existing XP Pro development workstation(VS 2005/vs2008/sql server etc) and simply convert the entire installation to a virtual image and load onto my new box? Sounds to good to be true? Does it really work that easy? If I can take a complete "dump" of a machine and simply move it onto my new workstation, not even need to find all my old install disks, that is truly amazing.
Does one of the VM products support this better than others? that may tip the scales for me to pick one platform over another..
How is it that I have not gotten onto this VM bandwagon sooner!?
Edit/Update: Just as a quick update in case anyone is interest. Got the machine, decided to go with vmware and had a heck of a battle, first trying to figure out which product to use, and then actually getting anything to work. The instructions are not obvious and wasted my 6 hours trying to a) get a vmware working, and b) actually trying to do a conversion of my old XP machine into a VM - never got it working.
In frustration I downloaded MS Virtual PC in minutes, had it up and running in 5 minutes, and was creating VM's within the hour....VERY easy. I haven't however figured out how to convert my old XP machine into a VM - but, now having a VM running, it seems obvious to me that I wouldn't want to actually run a primary development setup in my VW window anyway.
Definitely VMware Converter.
VMware Workstation is the most user friendly and fully-featured app that I've used and is well suited for debugging. Check out an awesome video demo of the record/replay feature here.
VMWare has p2v. By far the easiest solution you could take, and it's pretty easy to convert the VMDK into a VHD if you want to use a different solution.
Three options I have used.
1) Vmware convertor will create an image for you you can move around forever. You can then run it for free in the VMWare player.
I think the easiest thing would be to connect an external drive to your computer, convert a computer into an image onto that drive, plug the drive into another machine, and try it out..
2) Ghost is ghost.. You can use something like norton ghost or a linux equivalent to mirror the drive onto a larger one. If you have driver issues you can do an inplace re-install over the existing xp install and it will replace the drivers and leave all your applications, data, and settings intact.
3) Go Mac. They're strange. You can link two macs up with a firewire cord and it will copy over your entire setup, including virtual machines. I have my laptop backed up and if it dies, I can transfer the identical computer onto another one in minutes as all the internal components in Apple are intel and the drivers are one and the same.
Options I've heard of:
4) Microsoft Virtual PC. A fourth option that I have been hearing good things about is Microsoft Virtual PC. They bought the technology from another company and
5) Citrix - This one is intriguing because it would conceivably work as well, if not better than VMware. At least that's what I hear from my Citrix friend.
Welcome to the club of virtualisation. I set up a virtual machine on my Vista Os and running xp simultaneously. Its great as some apps don't work in 64bit (ie. those old 16bit apps.). You can try Microsoft Virtual PC 2007 its most probably the most user friendly. It's what I use. You can try Virtualbox too.
You can set up a partition and allocate space to the new operating system for this to work. Or use a spare formatted secondary drive if you have one.
Best of luck!
We now do all development in VM's.
The desktops are locked down tight and out IT manager is happy.
We use VirtualBox and it's fine.
There are fairly clear instruction for using physical disks directly for VirtualBox anyway.
The P->V transofer is not terribly hard.
Can't say the same of MS VPC or VMWare.
Here's a link to XenConvert, which is specifically designed for this "P2V" (Physical to Virtual) conversion, to show that the answer to your first question is "yes", it can be done.
http://www.citrix.com/site/ss/downloads/details.asp?downloadId=2318170&productId=683148
However, that tool is designed for stuffing your XP machine's image into a server, rather than onto your desktop machine.
For your more specific problem of doing this for your desktop, you're talking more about "Client Virtualization" (as opposed to Server Virtualization), where tools like XenClient, KVM, Virtual Box, qemu, Parallels, VMWare Workstation, etc. are better suited, and each will have their own P2V conversion technique.