S1ack 0 Posted March 28, 2023 TL;DR OP has never used Delphi before. Been tasked with replacing circa 2000 Delphi 5 based HMI with an Ignition based system. So, a mega lack of knowledge by the OP For Nostalgia...? This HMI talks to an Omron PLC (programmable logic controller), which is on an ISA card in the WinNT machine, via a compiled C library *I think*. Installing Delphi 5 on a fresh WinNT VM to examine forms etc.. I have Delphi throwing error dialogs upon opening what is the 'header' form, complaining about classes not found.... Classes not found: TParts, TDspItem, TDspChg, TTxEdit Are these common things from back in the day? or Obscure? I guess that's the immediate question - can I get this project to load forms without throwing errors? Googling is not providing results. Or the signal to noise is low. Thought I'd ask here - if it appear to be what I think it is - an active forum for people who use Delphi or what Delphi has become in 2023. I ran through the Delphi 5 install again thinking I'd select custom install and perhaps get lucky with some option to install what ever it is that makes Delph aware of those classes it's not. That was a bust - but there were some errors during the install about not being able to open install logs. And another about how I Why am I doing this? Biggest issue: Attempting to get a complete picture of all the data to/from the HMI and the PLC . Including access information like what is read only from the HMI and what is read/write. Frankly I do not know if this is a worthwhile endeavor to figure out the mapping. But my other option is a heavy slog reverse engineering from the PLC side of things (learning curves attached with that, whereas the PLC logic was a few click conversion to a modern piece of hardware). I've been provided with all of the Delphi files by the customer, and have looked through them extensively, looking for definitive mapping of all the PLC memory areas that the HMI uses. This leads me to believe it's several hundred words in the 'DM' area. The MainSrc.pas file implies that the HMI calls functions to read write from an included library. I've reached out to Omron about doumentation for this TSysmac_C thing but they have not been helpful. Occasionally there are ASCII files within sub folders (of the root folder that contains the Delphi project files) that do list PLC memory locations but my fear is that it's not complete. And it also suggest some multiplexing going on. Frequently these files do not have column names, so I though poking arond in Delphi 5 miht fill in those blanks. Lastly, at least I can color check things and make the new HMI look and feel like the old - (Which was requested). Share this post Link to post
programmerdelphi2k 237 Posted March 28, 2023 51 minutes ago, S1ack said: Classes not found: TParts, TDspItem, TDspChg, TTxEdit These classes do not belong to Delphi, they will be defined in external units, that is, they are defined in some other file accessed by your project in Delphi5... check all the units (.Pas files) inside the project folders. In Delphi you can ask it to search for some text in all project files, check the "Find in files..." option in the Edit menu, if it exists in Delphi5. If they are found, then you need to add their path in the project settings -> Project, Options, --> Library Path... This way, the compiler will be able to find and compile without errors. Share this post Link to post
Pat Foley 51 Posted March 28, 2023 (edited) Check the .dfm files by using a text editor. Most likely the classes you are looking were dropped on the form back in '97. If so, you load those into IDE using package(s) *.dpks before opening the unit.pas The unit's dfm loads with the {$rec *.dfm} directive in the implementation, or the classes could be loaded at runtime If available and pathed as p'2K mentions. I think I have an Omron under the bench somewhere but it uses a 232 port. Sorry. Pat Edited March 28, 2023 by Pat Foley It's an OTC sorry. Share this post Link to post
S1ack 0 Posted March 28, 2023 Thanks for the reply. 42 minutes ago, programmerdelphi2k said: In Delphi you can ask it to search for some text in all project files, check the "Find in files..." option in the Edit menu, if it exists in Delphi5. Did that. Finds many - declarations or definitions (like I said I'm a noob). 28 minutes ago, programmerdelphi2k said: If they are found, then you need to add their path in the project settings -> Project, Options, --> Library Path... This way, the compiler will be able to find and compile without errors. No Library path that I could see. I added the root folder of the project to 'search path' hoping it's recursive. Saved and re-opened the header form. No luck. I'll be going to the customer tomorrow to fiddle with an NT system they have on life support as a backup HMI. Hopefully I'll observe the project in a more functioning manner than the the VM I am trying to create. I asked the customer to search his hard drive for the SYSMAC item, and it hit on C:\ProgramFiles\Borland\Delphi5\Imports - I'll be looking at that. Share this post Link to post
S1ack 0 Posted March 28, 2023 10 minutes ago, Pat Foley said: Check the .dfm files by using a text editor. Most likely the classes you are looking were dropped on the form back in '97. Interesting. OK. Lots of hits... 13 minutes ago, Pat Foley said: If so, you load those into IDE using package(s) *.dpks before opening the unit.pas The unit's dfm loads with the {$rec *.dfm} directive in the implementation, or the classes could be loaded at runtime If available and pathed as p'2K mentions. Does the above hits 'make it so'? i.e. your 'dropped on the form' is what happened. I am clueless about the package *dpks means I should do. At first I thought you were implying that the classes I'm looking for are there inside the form. But that seems strange. Now I'm thinking it's just another means of adding it to the project - drag and dropped onto the form when under construction. Which assumes I'd still need the source of the class(es) Delphi cannot find. Share this post Link to post
Pat Foley 51 Posted March 28, 2023 8 minutes ago, S1ack said: Does the above hits 'make it so'? i.e. your 'dropped on the form' is what happened. Yes, but it appears that the dfm was saved in binary. Reading in text editor is enhanced when saving dfm as text. Besides the standard TButton and TControls like VB, Delphi user could build or be provided a custom Control to drop on form (even nonvisual controls). The package or library is *.dpk that puts the Control on the rail and registers the control so IDE "knows" what is dropped in design window. These components are streamed in and their events connected at runtime. Share this post Link to post
programmerdelphi2k 237 Posted March 28, 2023 (edited) 1 hour ago, S1ack said: Did that. Finds many - declarations or definitions (like I said I'm a noob). You need find "WHERE" the TParts class is defined... not where it is used!!! for example: any class is defined like this: Txxxxxx = class( .... ).... then, you need find "what unit (Pas file) is defining your class desired, in case "TParts" then, you can put the path (c:\xxxx\xxxx) folder on "Search Path", for example. TIP: look at "USES" clause and see the unit names... maybe you can find a peculiar name... like, uMyParts -- you understand? not necessary this name of course! Edited March 28, 2023 by programmerdelphi2k Share this post Link to post
Anders Melander 1783 Posted March 28, 2023 1 hour ago, S1ack said: I asked the customer to search his hard drive for the SYSMAC item, and it hit on C:\ProgramFiles\Borland\Delphi5\Imports - I'll be looking at that. Files in the Imports directory have been generated by the type library importer (generated pascal wrappers around COM libraries). This most likely means that some of the missing controls (e.g. the TSYSMAC_C control) are ActiveX controls. Probably ActiveX controls that were provided by Omrom for communication with the device. Googling for SYSMAC_C Omrom leads to a few hits. Notably, one that mentions a Sysmac_C ActiveX control. TTxEdit sounds like a custom edit control. Googling for Delphi TTxEdit lead me to a Korean message board with a message from 2007 with this link: ftp://ftp.nsk.su/pub/msdos/misc/ttxedit.arj Unfortunately, that site is long gone. You can probably replace the TTxEdit control with TEdit. Share this post Link to post
DelphiUdIT 176 Posted March 28, 2023 (edited) I don't think you'll fix that easily, those components were part of communication packages that no longer exist. They were imported from ActiveX (Omron never supplied wrappers in Delphi, I'm going by memory) registered either as integrated communication packages or separate components. The CX_ServerLite and CX_Compolet components are currently available but they absolutely do not support the WINNT environment. If you don't have the components installed in your VM or you don't have the Type Libraries or ActiveX wrappers (*_TLB.pas), you can't do anything with Delphi. It is probable that to install the components in your WM, even if you could find them, you would need the SYSMAC_BOARD drivers (I think you are referring to a C200PC-ISA1 PLC, it's the only one I remember ever seeing). If you have the original PC available you could theoretically recreate all the wrappers from the installed ActiveX. Not an easy job but doable. But first check if you have *_TLB.PAS files somewhere, like in the IMPORTS sub-directory of DELPHI5 (in the original source, from the customer, ....): If "Yes" you can copy in your WM, register them and load all the FORMS. Bye P.S.: may be also if you have the *_TLB.pas files registered, some parts of the Form will not be design correctly if you don't have the components installed (normally they are DLL or EXE or OCX in that time). Edited March 28, 2023 by DelphiUdIT Share this post Link to post
Lars Fosdal 1792 Posted March 29, 2023 BTW - when searching in files, use "in directories" and check "Include subdirectories" and point to the topmost folder that contains your source code. "In projects" does not necessarily include all units, since you can reference a unit without adding it to the project. Share this post Link to post
Jirka52 2 Posted March 29, 2023 Hi. Try to use "Total commander" and search for *.pas files which contain text e.g. "TDspItem" Share this post Link to post
S1ack 0 Posted March 29, 2023 Thank you all for the replies. 14 hours ago, DelphiUdIT said: I don't think you'll fix that easily, those components were part of communication packages that no longer exist. They were imported from ActiveX (Omron never supplied wrappers in Delphi, I'm going by memory) registered either as integrated communication packages or separate components. The CX_ServerLite and CX_Compolet components are currently available but they absolutely do not support the WINNT environment. If you don't have the components installed in your VM or you don't have the Type Libraries or ActiveX wrappers (*_TLB.pas), you can't do anything with Delphi. It is probable that to install the components in your WM, even if you could find them, you would need the SYSMAC_BOARD drivers (I think you are referring to a C200PC-ISA1 PLC, it's the only one I remember ever seeing). If you have the original PC available you could theoretically recreate all the wrappers from the installed ActiveX. Not an easy job but doable. But first check if you have *_TLB.PAS files somewhere, like in the IMPORTS sub-directory of DELPHI5 (in the original source, from the customer, ....): If "Yes" you can copy in your WM, register them and load all the FORMS. Bye P.S.: may be also if you have the *_TLB.pas files registered, some parts of the Form will not be design correctly if you don't have the components installed (normally they are DLL or EXE or OCX in that time). I realize it's long shot. And I'm starting to believe it's not worth the trouble vs my other option of reverse engineering from the PLC. Only problem with that is comments in the PLC (they did not use symbols/names of the addresses) may not have a high correlation with the names in Delphi / on the screens. Yes, PLC is/was a C200PC-ISA13-DRM SYSMAC: Customer supposedly has all the original disks. This is their routine when they rebuild the WinNT... Quote 1. Install Win NT 4.0 with service pack 6A High Encryption Pack (NTFS file system). 2. Install MDAC 2 SP1 (Microsoft Data Access Components such as ODMC, OLE) 3. Install backup copy of Ulvac software (\NLD6000 and \UlvacStd folders). 4. Install Omron FinsGateway ver 2.0 (allows communication between Omron and Microsoft Windows programs) and install Omron Sysmac Compolet 2.0 (Omron network used to communicate with the PLC). 5. Go to Program Files-> FinsGateway Service Manager. Set the property of the 2 files running: CPU and Sysmac board units from manual to auto and start. 6. Install Borland Delphi software (may not be needed). Ulvac software written using this program. 7. Copy ShardMem.dll file from \UlvacStd\Dll folder to \Windows\System32 folder. 8. Add shortcut to desktop for Ulvac software start-up. Use C\NLD6000\Main\Mserver.exe C:\Nld6000 for target. I asked if I could image those install disks and they are going to oblige. If not having the board causes problems with rendering the HMI or opening forms (assuming I get the missing classes issue fixed) well then I'm out of luck. Share this post Link to post
DelphiUdIT 176 Posted March 29, 2023 23 minutes ago, S1ack said: If not having the board causes problems with rendering the HMI or opening forms (assuming I get the missing classes issue fixed) well then I'm out of luck. I have never used Omron components (although I have been a direct customer of Omron for more than twenty years) because I developed my own series of components, starting from the communication protocols. This is because I had to develop applications that already used fiber optics before the 90s and Omron didn't have high-performance components at that time (let's just say it didn't have components...). However, I managed to find in my archives the COMPOLET 2.0 (year 2003) and they are for WINNT3 SP3 or Higher. If you want I can send to you a private message with link (on my server) to download them. If you are able to install these, with Delphi 5 you can extract the TLBs. I don't know if something else (e.g. FINS GW) is needed to install them (I hope not). Bye Share this post Link to post
S1ack 0 Posted March 30, 2023 So, I went to the customer yesterday and had success. On my VM I can now open forms without error, and most importantly see the PLC addresses within the object inspector. Which was my goal. blah, blah, blah... They had setup the Windows NT machine with a network share to an XP machine so I could move files off on as needed. In my limited knowledge hind sight, the issue, as many of you tried to point out was my VM installation did not have packages / components installed. I managed to do that yesterday. If somewhat clumsily stumbling into a positive result. The machine's OEM had apparently developed standard components in Delphi. Where the project files were all contained within folder \NLD6000 (the machine model) there was another folder \UlvacStd that had a \cmp subfolder filled with .pas, and .dcu files. I had this already, but copied it again to the VM, initially I naively tried to just add the path to libs tab under menu Tools | Environment Options . Did not work. Looking at the Windows NT machine the components were inserted into dclusr50. On the VM I tried to insert them all - selected all *.dcu - and install failed. Tried again selected all *.pas - install failed but looked much better than before with hints, warnings, and errors being reported. So I deleted all components that it errored on, and continued trying to install. Did not work. Brute force back door clutching at straws: I removed C:\Program Files\Delphi5 from the VM, and replaced it with the same from the Windows NT machine. Bad Idea. Replaced original Delphi5 folder, then copied the Windows NT \Delphi5 onto it selecting to overwrite all. Then when Delphi next launched (complaining about unlicensed modules), I selected ONLY the (4) .pas files that corresponded to the (4) class names the form I originally tried to open complained about. There was a logner list than (4) things in a tree structure dialog, which I took as it bringing along dependancies? In any case, this time it all installed without error, and boom I had a new palette. Hot damn tamale. 21 hours ago, DelphiUdIT said: However, I managed to find in my archives the COMPOLET 2.0 (year 2003) and they are for WINNT3 SP3 or Higher. If you want I can send to you a private message with link (on my server) to download them. If you are able to install these, with Delphi 5 you can extract the TLBs. I don't know if something else (e.g. FINS GW) is needed to install them (I hope not). Thank you very much but that will not be necessary, I have .iso images of Compolet, and FINS gateway CDs that the customer had. Share this post Link to post
S1ack 0 Posted April 6, 2023 (edited) More general questions... Is it obvious to veteran Delphi users that this TDspItem is using the Bit1-BitAlarm properties to select a color for the button/panel? Because that's what I'd assume looking at it. Is it a one-for-one bit-to-color mapping? or are the bits enumerated to an int to select the color. Here 4 bits could do 16 colors, but there are only 9 colors for the control. Here 2 bits and 4 colors which implies an integer selects the color. Or is that a stupid question and the controls are different so the action could be different. One would have to look at the source. The most likely answer. I suppose. Unfortunately 1 semester of Pascal in 1989 - and I am not sure I am up to that task. I've looked at it and I get the feeling that the bits are resolved to an integer and that sets the color. I could post the source, unless that is against the rules. Edited April 6, 2023 by S1ack Share this post Link to post
DelphiUdIT 176 Posted April 6, 2023 15 minutes ago, S1ack said: More general questions... Is it obvious to veteran Delphi users that this TDspItem is using the Bit1-BitAlarm properties to select a color for the button/panel? Because that's what I'd assume looking at it. Is it a one-for-one bit-to-color mapping? or are the bits enumerated to an int to select the color. Here 4 bits could do 16 colors, but there are only 9 colors for the control. It is one-to-one color mapping, means the every 8 DI+ BitAlarm are assigned the a Color0-Color7 + ColorA(larm). Graphically, I don't know if the control provides for the possibility of displaying all 9 states at the same time. Share this post Link to post
Pat Foley 51 Posted April 6, 2023 I suppose the D5 copy is the owner's. My concern are the gas trains meeting ASME codes for the interlocks to work properly.* I been in a plant where an intern changed the overall 16 color scheme and some things quit working. This image is marked up with where to click at to bring the color property editor. Also a text box shows effect of copying a shape control and pasting it into a text editor. * Not jumper wired or modified to prevent Tripping. Share this post Link to post
S1ack 0 Posted April 12, 2023 On 4/6/2023 at 2:47 PM, DelphiUdIT said: It is one-to-one color mapping, means the every 8 DI+ BitAlarm are assigned the a Color0-Color7 + ColorA(larm). Graphically, I don't know if the control provides for the possibility of displaying all 9 states at the same time. So you are sure about this. I have looked as the source - bit my lack of experience is not helping. I can do that in Ignition with scripting but it's more involved that the other option. I sorta see it if I follow the 'FBit' which I take to be the Formbits i.e. the bits passed form the form (as seen in the object inspector) to the control source as Bits0-8. But I probably have that terminology mutilated somewhat. Here it looks like the individual bits, if set are then setting a value to the equivalent integer of the bit positition. If I follow FColor with the same assumption that it's the colors as seen in the object inspector.... Towards the bottom is what looks where the colors are set... But I really have no clue how the Fbits are tied to the Fcolor. There seem to be myriad uses of 'value' in between the two, But like I said. I'm a noob. I attached the source .pas. DspItem.pas Share this post Link to post
S1ack 0 Posted April 12, 2023 On 4/6/2023 at 3:58 PM, Pat Foley said: I suppose the D5 copy is the owner's. My concern are the gas trains meeting ASME codes for the interlocks to work properly.* I been in a plant where an intern changed the overall 16 color scheme and some things quit working. This image is marked up with where to click at to bring the color property editor. Also a text box shows effect of copying a shape control and pasting it into a text editor. * Not jumper wired or modified to prevent Tripping. >My concern are the gas trains meeting ASME codes for the interlocks to work properly.* Doubtful, OEM is Japan based. It's not a plant, it's a plasma etching machine. Etches semiconductor / optical wafers used in fiber optic comms or so I am told. > This image is marked up with where to click at to bring the color property editor. OK, not sure what to do with that information. This is from my NT VM... >Also a text box shows effect of copying a shape control and pasting it into a text editor. OK, also not sure what to do with that. Share this post Link to post
DelphiUdIT 176 Posted April 13, 2023 (edited) 12 hours ago, S1ack said: But I really have no clue how the Fbits are tied to the Fcolor. The color value (for example clAcqua) is matched to the input (status or value). Color, other than visual meaning, has no effect on the code (it shouldn't). Typically those controls were designed and used as a "level": the highest value "won" over the others and that was the state (color) displayed. The component is closely linked to the hardware (PLC), it must be thought of as a representation of the state and the PLC vice versa must be programmed to coherently represent the state. If not, you need to build your own component and/or derive from an existing one by overriding the methods. Bye P.S. To better specify, the component could work like this: the displayed color is represented by the highest active bit in Bit1, Bit2, Bit3 ..... etc., if more bits are active the highest one "wins", but typically ONLY one of these should be active.; the alarm bit has priority over all and if active the component will display the matched colour. Edited April 13, 2023 by DelphiUdIT Share this post Link to post
DelphiUdIT 176 Posted April 13, 2023 11 hours ago, S1ack said: There seem to be myriad uses of 'value' in between the two, But like I said. I'm a noob. That "variable" (Value) is not a global variable but a local one. It is in fact a different "object" in each single procedure. Very often these variables are automatically generated by component imports such as COM objects or wrapper or getter/setter generators. However, it is a standard acquired by programmers to use for example "Value" as a generic input datum in a procedure / function / method. Share this post Link to post
Pat Foley 51 Posted April 18, 2023 On 4/12/2023 at 3:53 PM, S1ack said: OK, also not sure what to do with that. Still should follow National Fire Code and National Electric Codes. Should able to type in a desired color number vs messing with editor. Copying controls off the design screen into Notepad++ allows an easy compare of contents. The coloring of the controls was changed when a door interlock was added which caused the original 20 displays to lose their ability to reflect the status. The added control's status colors magic numbers were used to code the status color value somewhat then status color changes were commented out for original displays. Reverting to original intent colors reflecting status for all depictions could readily implemented. Attached shows Two of Tee's added following their status settings all the controls are having their Color0 set. I added a diamond and alert kind. Pat Share this post Link to post