TwinCAT system is launching Rexroth drives stright to OP when the final machine state is set to INIT - twincat

I am working on a TwinCAT system. We have TwinCAT booting and the Bosch Rexroth drives being powered simultaneously. The TwinCAT system is supposed to set the final state of each individual drive. However all 4 of the drives are booting and then going to OP as soon as they finish booting. We need to hold off on booting the second drive until the first drive has finished initializing as the second drive is slaved to the first through an encoder and the first drive needs to finish booting before the second drive as the emulator for the first drive isn't sending the appropriate signals yet and the second drive then presents an error and wont boot normally.
I have found a crude temporary fix for this in the form of applying control power to the drives and getting them to boot completely before booting the PLC. I have tried to set the Final Machine State for the drives in the I/O stack for the drives and then call out the transition change in the plc program itself. That has not been consistent though. I would like to find the reason why the drives are bypassing the Final Machine State setting in the PLC to begin with. Though any help or advice would be much appreciated.

Related

Packet Corruption: Why sometimes ffmpeg .bat batch video editing makes my computer unstable unable to restart?

I'm doing very time consuming ffmpeg video editing. That's why I put my commands into a .bat batch file and run them over night. Usually that works fine, but from time to time when I look the next moring I see an error message of this kind:
From that state on, I didn't find any good way to close the console. When I press the [x] button in the top right corner, it freezes. When I try to kill the application using the task manager nothing happens. Even explorer.exe cannot be closed using the task manager. A shutdown won't do anything. During the last month I had this problem about three times and the only way I could close it was to long press the power button of the computer until it was turned off "the bad way".
Any ideas what to in such situations?
Or even better: How to prevent those situations?
What can the reason(s) be for the error?
Do you understand the message?
When the computer is started again the next morining and I run the same .bat file again everything works fine. So the same error does not repeat and the video is edited nicely!
Edit: Now, about one week after posting this question the problem occurred many more times! It is very annoying. I guess it has to do with the external hard drive connected by USB. Sometimes it randomly interrupts the connection! That might be the reason for the behavior. Whatever its causing the error, I want to learn a solution how to deal with this in future. I don't want to always push the reset button of my computer. I want a proper way to be able to shut it down.
To narrow down the cause, what is causing this error, and what is not, here is a list of seven seven seemingly isolated solutions that each alone or all together should fix your problem:
The .bat Batch File
Apparently there is nothing wrong with your coded .bat batch files.
If that was the case, then none of your past videos would have rendered.
But just to be sure, try to run your .bat in a different laptop or computer on the heaviest and most demanding video editing project files just to make sure that the .bat files in fact and without a doubt flawless.
The Computer CPU
Make sure that your CPU runs flawlessly not just for 30 minutes but for the hours long burn tests that are the video
projects at night you mention. Poor contact between a concave or convex heatsink and cpu or lack of or too much of thermal paste can make cpu too hot and unstable during prolonged cpu intensive burn tests. A software like OCCT or Intel
Burn Test should be able to run for hours in your case without a
single fault.
The Computer RAM
To test your memory you can use MemTest86 or my favourite the open source MemTest86+ which should run for hours without a single memory error.
The OS Integrity
Run CMD as admin, and type chkdsk c: /f or chkdsk c: /f /r /x and press Y to check and repair (after a reboot) the local hard drive c: or any other partitions that are the source or destination of your rendering projects. When your computer encounters a sudden shutdown or detects a corrupted file system, sometimes this is the cause of a corrupted OS file. This checks for the integrity of the most important system files. Also sfc /scannow is another way to check System Files which scans and repairs system files.
The Harddrive
Connect your external drive locally, and run both a short and deep long test to make sure the harddrive has zero cluster faults. A SMART test from Crystical Disk Info famout for their Crystal Disk Test, can be a good way to see all the past errors on a Harddrive. Also, try to run the nightly batch files on the HDD connected internally. That way you can rule out the next item:
The Cable Quality
Cat rated UTP networking and USB cables are notoriously known for their poor manufacturing quality and low reliability. Not just over time, but new out of the box they can be the cause of disconnects, bad connections and low throughput. There is not something like they work 100% or they work 0%. Sometimes they sit right in between and "work, but to a degree" enough to be sold, with the absolute bare minimum and sometimes under minimum quality strands that are anything but cupper. So check your cables, replace the cables with other cables that you have laying around. CCA (Copper Cladded Aluminium) is the garbage to stay away from. Get proper Cupper only cables.
USB to SATA (HDD) or M.2 NVMe (SSD) Adapter Chip
Some USB-to-SATA adapters are notorious for their low stamina, stopping working when the adapter chips become exhausted in professional usage over prolonged continous workloads, resulting in disconnects even if they would be connected via a cupper USB 3.2 cable to the computer! The internet is full of forums with people having problems with older generation cheaper JMicron chips causing interruptions causing failures in copying files from or to the PC. Realtek chips are somewhat better, but often the solutions on the last page shows all problems went away when they bought an expensive adapter that uses an ASMedia chip.

Is there a way to keep internal drive segments unmounted while booting from external device

For forensic imaging of drives and/or segments with a native Mac application, I'm booting from external device (usb, hdd, etc.) into BaseSystem. I want to keep the internal drives and/or segments unmounted during the boot process (there is no way of knowing drive/segment volume names and/or UUID before booting). Later will disable disk arbitration, mount these drives/segments and image them.
I've created a deamon (System/Library/LaunchDeamons) for mount blocking (on external boot device), but it only blocks newly attached devices, not internal ones.
Note 1: I've created boot image from BaseSystem.dmg of Sierra (10.12.1), and modified the contents.
Note 2: Since there is no way of knowing drive/segment volume names and/or UUID before booting, it is not possible to use fstab.
I need a direction to follow, any comment may help. Thanks.
Nobody, even commented. I found the solution from a clue keyword from a friend: autodiskmount

VirtualBox How to move hard drive from one controller to another

Virtual Box SAS storage controller allows faster IO than SATA one:
SAS is to SCSI what SATA is to IDE: it allows for more reliable and faster connections.
from https://www.virtualbox.org/manual/ch05.html
By default new VM is created with hard disk attached to SATA controller (at least for Windows VMs). In order to make IO operations faster in guest system, one might want to move a hard drive to SAS controller.
How to do that for Windows guest OS without breaking anything?
Here is my own solution which seem to work.
Prepare (this is required to make Windows install drivers for new controller, without them Windows will fail to boot).
Add SAS controller.
Attach new hard drive to the new SAS controller.
Boot your system, wait while drivers are installed/updated. Reboot. Power Off.
Now we are ready to relocate existing hard drive:
Attach existing hard drive to SAS controller.
Detach it from old controller.
Make sure that Solid-state drive checkbox is in the same state as it was before.
Again: boot your system, wait while drivers are installed/updated. Reboot.
NB: Don't forget to backup your important files before trying this.
You might want to enable Use Host IO Cache on SAS controller.

C++ Builder - Handle to OS to Iterate Through All Drives

I'm using Borland C++ Builder for a project which connects to a database.
There is a configuration which does backups to a USB drive. The problem with the current approach is that the drive is manually configured by the end user and sometimes things get messed up. E.g. People move the USB drive to a different port, get a different letter and then the back up process no longer works. As a side note, we have other "better" processes for backing up to the cloud, etc., however some locations don't have internet access and aren't running on a RAID... so backing up to USB gives them a saving grace from a HD crash.
I'm hoping to do some coding to help remove this issue. I'm hoping to be able to get a handle to the OS (Windows 8/7/XP) and be able to identify the drives on the machine. Once I have those, I can then iterate through them and check for a path location (e.g. File marker, so if a the file exists, I know its the USB we supplied). Then once I have that, I can do the back up.
As a worse case scenario, I will be able to iterate through all 26 letters to test each drive. However I'm using this as a learning opportunity and hoping to get a handle to the OS so reduce the number of checks/fails I can run into. Besides, I'm curious if anyone has a better approach :)
I don't think there's much to be gained by trying to do something more advanced than iterating over the 26 drive letters.
Before attempting to check whether or not the marker path exists you could add a call to GetDriveType and compare the return value against DRIVE_REMOVABLE. This will make sure that your code doesn't spin up the CD/DVD drive, or hit the network in the case of a mapped share.

Network Shares of Removable Drives Disappear (Windows)

I have two removable drives. I can set the access rights so that they can be shared and used from another network computer, but when I start my main computer the next time and the drives are switched off, they seem to lose the share settings and I have to set the access rights again.
Is there a way to prevent this and to automatically share a complete drive so that it can be accessed across the network as soon as it is switched on the next time?
The long and the short of it is "No"... I had the same issue with a removable drive and there's not a way to do it. You CAN however, write a small service that will share the drive automatically on boot-up. Short of that, Windows just simply will not re-share a removable drive after reboot.
~md5sum~
I've had this problem, and after some research came to this registry solution that increases the number of shared removable drives that windows retains (why Windows is worried about not having enough space to remember unlimited numbers of shares is beyond me). http://forums.cnet.com/7726-6122_102-3230783.html#3230783

Resources