Solved

industrial computing problem

Posted on 2002-04-10
26
380 Views
Last Modified: 2010-04-04
hi,
ive explained this here as i need to show a image

http://www.inthe.fsnet.co.uk/

heres hoping someone understands what im on about :-)
it doesnt need to be perfect but more points for a workable complete solution

Barry
0
Comment
Question by:inthe
  • 9
  • 5
  • 4
  • +5
26 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6930671
very complex

igor itugay can help you,
i guess

look also for the devexpress forumlibrary
(its free, after registering into the forum of
www.devexpress.com)

there is a tcontrol connecting tool,
which may help you with the visualizing

meikl ;-)
0
 
LVL 17

Author Comment

by:inthe
ID: 6930672
i have software already for doing this but its simulator is crap
(unless you can click mulitple buttons at 10th of a second :) so im linking to the ocx it has to have complete control myself as it will be easier to remake the simulator in delphi ,the above is actually only a addon so i dont have to use 2 IDE's for building and simulating.

ive seen delphi's "data diagram" which is something similar in a remote way to what im after ..
0
 
LVL 17

Author Comment

by:inthe
ID: 6930677
thanks meikl ill have a look at devexpress,i think ive tried them before,cant remember :)
0
 
LVL 17

Author Comment

by:inthe
ID: 6930732
i registered but i cant find an actual link for downloading them only a demo of what they can do.
 on viewing the demo the link component wont really help as it needs to only be able to do 90 degree angles or straight lines ,i was thinking images or bitbuttons would be easiest way (i have the correct images for glyphs if need be),theres probably a simple way of doing this with anders melanders dragdrop comps,i may have a good look at torrys later,if you knwo any other grid/canvas type stuff that may help let me know .

cheers Barry
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6930741
you will become a welcome-mail
after registering with a download-link
and a aetup-password

at melander should also be a statemachine-component,
but terrible the server seems to be down there

well, looking further
0
 
LVL 17

Author Comment

by:inthe
ID: 6930755
ok i'll be back later on :)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6930765
take also a look to my paq
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=delphi&qid=10331656

maybe it gives you a suggestion

0
 
LVL 17

Expert Comment

by:geobul
ID: 6930789
Hi,
First that comes in my mind (popup menu instead of drag-drop):

- a form with a grid of empty images (80x7) placed in OnCreate;
- an array of records (80x7), describing the contents of the grid (element type, element name, etc.);
- an ImageList containing all possible elements (M, I, Q, lines...);
- a StringList with elements names;
- a popup menu assigned to all images in the grid (with element names);

so: right-click on an image (from the grid) and select the apropriate element from the menu. Assign the image from the list. Ask for name (M1,I2, etc.) or create a name dynamically. Remember the assignment (element type and name) for output in a text file.

Regards, Geo
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6930818
Geobul, I would create a TImage descendant which would centralize the elements.
He will need a component dropping palette like the IDE.
On dropping the new component aligns itself on the drop area which could be a simple TPanel.
He will need a verifier/cleaner method which deletes unconnected elements and changes line elements to the proper type without dangling connections.
If the also connects the elements on dropping he will get the net to simulate for free.
0
 
LVL 2

Expert Comment

by:peymanz
ID: 6930948
Seems like a very interesting project,

I would have started with the logics of the application and not the actual GUI which is put on top of that. It is allways easier to put a face on a non visual component than stuffing visual feedback with logic. Or maybe thats already been developed?

regards
// Peymanz
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6931011
That was my idea (poorly worded). Make a component which doubles as visual feedback and logic element.
He has to represent a net with simple elements which have 4 connections. The net has a single root node.

The visual component also handles the logical connections to neighbours.
A verifier creates a well formed net by deleting elements which are unconnected to the root (upper left node) and changing the element type of line elements if they have dangling connections.
It also simplifies the net by deleting rows and columns which ony contain line elements.
After that he can use the logic part = 4 connection properties and element type for the simulation.
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 6931031
Barry, while I am aware that this does not really conform to EE rules, I would like you to mail me at avw@gmx.ch for some clarifications on the subject. Of course the final results of our private exchange will be posted here for others to read, but I have the impression that posting all this here (including source code in progress) would just make that thread too long to be useful as PAQ later on.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6931048
yep, avonwyss,

thats true,
i myself have not the
time for an implementation and
it is more complex than the
picture does introduce, i guess

you comes from switzerland (schweiz)?

meikl ;-)
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 9

Expert Comment

by:ITugay
ID: 6931083
Hi Barry,
hi all.

Just take a look at the task. It looks like matrix of items where every item has some properties and information about next item in the matrix. If I'm right, then there is a way I would do visualization and editing:

Let suppose we have some canvas to draw and edit the matrix. At first, let split it by virtual rows and columns (13 x 80). Every odd column intended to show items properties. Every even column to show relations between items.  Now we can show content of the matrix by easy way. Editing is too not difficult for this case.

It just a core of the way to go. I can prepare some sample (if it is necessary) and if I'm not wrong about the task.

------
Igor.


0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 6931084
meikl, right, I'm from little Switzerland ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6931107
not far away from me (~300-400 km), avonwyss

hi igor,
i thought on you,
as i read this q,
because i guessed thats
a project you like

meikl ;-)
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6931154
you are right, meikl :-)
0
 
LVL 17

Author Comment

by:inthe
ID: 6932312
geobul
no popup menus as i will be using a popup-form already as a menu to assign the elements details.

robert,avonwyss,igor,
its not actually that complex,the idea is simply to give the user/programmer a visual interface to the plc code.
sorry explaining stuff isnt a strong point of mine :)

to break it down so you know what im trying to achieve
imagine if you have 2 inputs and one output

I1    i2                                O1
[ ]---[!]---BLANK --- BLANK--- BLANK ---@

the above logic says
"if input1 and not input2 then output1"
i need to drop objects on some grid and get back

I1 i2 Q1

obviously the blanks could also be filled in

the main part i need help with is in what to use for dropping/assigning object onto and what to use as object .

in reality the item have no relation to its ajoining items
except in last grid column can only be output and no output can be in any of first six grids.

i have to go cause im late but really for the best explanation here is the software im redesigning:

http://www.schneider.com.au/Products/ICandAutomation/Zelio/ZelioSoft.zip

when starting the software choose new project and go into "free-mode" here you can see exactly what im after.

its 4.4 mgs and doesnt need to be installed just extract to a dir and run & can be deleted after.
0
 
LVL 3

Expert Comment

by:SteveWaite
ID: 6932816
Hi Barry,
My thoughts..
I would start by declaring an array for the grid.
Items pointed to by entries in the grid would each have position and connection properties to start with.
I would do a search through the array looking for connections and apply the logic from the connected items.
Depending on complexity, more than one pass may be required. You might store results of first by creating another grid and doing a pass on that.
0
 
LVL 17

Author Comment

by:inthe
ID: 6933267
hello all,
my asccii above didnt work :)
01 meant to be above the @

had to rush off hence the garbage posted last night,bad timing on my part to ask a q as time really isnt on my side.thanks to alls initial input (now im more confused :)

ive done nothing like this before so i try to explain in more clearly to clean it up,

visually :
its a 7*80 matrix
every odd column can only have an object ,
every even column must have only a connection
(connection line could be one of three elements may be a - or a | or a T for continuing on line below)

on the logic side the details about elements i would need would be their name and position in grid.
 i made a good discovery last night that i dont need to know about a T junction (which was the part that worried me in doing the logic)as each row is saved seperatly in a tag.
the file format they used is a basic version of xml so to test i wrote a parser for it to read it into stringgrid which works well.

so to recap what im after (hopefully) is a unit/example that has some form of grid/canvas and i can drop objects/something from a selectable pallet(as per delphi but on same form) onto and give me back object name and object grid position.nothing too fancy just something to give me the idea.

what i will do then is write object name back into stringgrid in right position and save.



ps,
when typing at e.e and you type some code have you ever pressed F9 ?
 
Regards Barry
0
 
LVL 17

Accepted Solution

by:
geobul earned 300 total points
ID: 6933619
I realize that the code is huge, so I'm sorry for that. If you have questions, please ask.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls, ToolWin, ExtCtrls, ImgList;

const
  Rows = 20; // grid rows
  Columns = 7; // grid columns
  Elements = 2; // the number of elements buttons - first part of buttons

type
  TForm1 = class(TForm)
    ToolBar1: TToolBar; // 4 buttons on it, .Images := ilSmall;
    Input: TToolButton; // first button - input
    Output: TToolButton; // second button - output
    Line: TToolButton; // third - line
    Clear: TToolButton; // last - empty cell
    ilLarge: TImageList; // holds 4 images 50x50 - grid
    ilSmall: TImageList; // holds 4 images for toolbuttons
    procedure ButtonSelect(const Index: integer);
    procedure InputClick(Sender: TObject);
    procedure OutputClick(Sender: TObject);
    procedure LineClick(Sender: TObject);
    procedure ClearClick(Sender: TObject);
    procedure ImagePress(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  end;

var
  Form1: TForm1;
  ImgGrid: array[1..Rows,1..Columns] of TImage;

implementation
{$R *.DFM}

procedure TForm1.ButtonSelect(const Index: integer);
var
  i: integer;
begin
  with ToolBar1 do begin
    for i := 0 to ButtonCount - 1 do Buttons[i].Down := false;
    Buttons[Index].Down := true;
  end;
end;

procedure TForm1.InputClick(Sender: TObject);
begin
  ButtonSelect(0);
end;

procedure TForm1.OutputClick(Sender: TObject);
begin
  ButtonSelect(1);
end;

procedure TForm1.LineClick(Sender: TObject);
begin
  ButtonSelect(2);
end;

procedure TForm1.ClearClick(Sender: TObject);
begin
  ButtonSelect(3);
end;

procedure TForm1.ImagePress(Sender: TObject);
var
  i,j: integer;
  btn: integer;
  Number: integer;
  CellName: string;
  jPos: integer;
  bmp: TBitmap;
  IsAppropriate: boolean;
begin
  // check which button is down
  btn := -1;
  with ToolBar1 do begin
    for i := 0 to ButtonCount - 1 do begin
      if Buttons[i].Down then begin
        btn := i;
        break;
      end;
    end;
  end;

  if btn > -1 then begin
    if (Sender is TImage) then begin
      CellName := '';
      with (Sender as TImage) do begin
        // determine image coordinates
        jPos := Pos('J',Name);
        i := StrToInt(Copy(Name,2,jPos - 2));
        j := StrToInt(Copy(Name,jPos + 1,Length(Name) - jPos));

        // decide if the J position is appropriate for this type - example:
        IsAppropriate := false;
        if (btn >= 0) and (btn <= Elements - 1) then begin // objects Input and Output
         if Odd(J) then IsAppropriate := true;
        end;
        if (btn >= Elements) and (btn < ToolBar1.ButtonCount - 1) then begin // lines - 2..6 row
          if (J > 1) and (J<Rows) then IsAppropriate := true;
        end;
        if btn = ToolBar1.ButtonCount - 1 then IsAppropriate := true; // clear - always acceptable
        if IsAppropriate then begin
          // Using button.Tag for counter
          ToolBar1.Buttons[btn].Tag := ToolBar1.Buttons[btn].Tag + 1;
          Number := ToolBar1.Buttons[btn].Tag;
          // Make element name
          if btn < 2 then begin // no lines or empty button
            CellName := Copy(ToolBar1.Buttons[btn].Name,1,1) + IntToStr(Number);
          end;

          // Save the info here
          // using i,j - coordinates; ToolBar1.Buttons[btn].Name - type of the element

          // Show image on grid
          if btn < ilLarge.Count then begin
            bmp := TBitmap.Create;
            ilLarge.GetBitmap(btn, bmp);
            Picture.Bitmap.Assign(bmp);
            bmp.Free;
            // Print the cell name
            Canvas.TextOut(3,3,CellName);
          end;
        end;
      end;
    end;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  i, j: integer;
  bmp: TBitmap;
begin
  // bmp contains the last image from ImageList - empty cell image
  bmp := TBitmap.Create;
  ilLarge.GetBitmap(ilLarge.Count - 1, bmp);
  // create image grid
  for i := 1 to Rows do begin
    for j := 1 to Columns do begin
      ImgGrid[i,j] := TImage.Create(Form1);
      with ImgGrid[i,j] do begin
        Parent := Form1;
        Name := 'I'+ IntToStr(i)+'J'+IntToStr(j); // Image name: 'I22J5' = row 22, col 5
        Width := 50;
        Height := 50;
        Left := j*50;
        Top := i*50 + 30;
        // load initial picture (empty with borders for example)
        Picture.Bitmap.Assign(bmp);
        OnClick := ImagePress;
      end;
    end;
  end;
  bmp.Free;
end;

end.
0
 
LVL 17

Author Comment

by:inthe
ID: 6933661
Geo,
would be grateful if you can mail your demo to me ,i have to go shortly but i can take it with me if your within 1/2 hr in sending it so i can examine it later at work.
thanks Barry

mail@inthe.fsnet.co.uk
0
 
LVL 17

Expert Comment

by:geobul
ID: 6933702
Done.
0
 
LVL 17

Author Comment

by:inthe
ID: 6936196
ok thanks that will do for a starting point ,my collegue thinks we made need to know jucnction points positions afterall ,we are not sure yet,im waiting to hear back from him.
0
 
LVL 17

Expert Comment

by:geobul
ID: 6936204
Hi Barry,
Thanks for the points. I'm sending you a little bit improved version now.

Regards, Geo
0
 
LVL 17

Author Comment

by:inthe
ID: 6936219
great :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now