ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 02-01-2013
brett forbes brett forbes is offline
Flexsim User
 
Join Date: Oct 2011
Posts: 34
Downloads: 0
Uploads: 0
Thanks: 27
Thanked 3 Times in 2 Posts
Rep Power: 107
brett forbes is on a distinguished road
Question Using x,y,z in grid and object space

Hi,

I am having some trouble using the x, y, z cordinate system in Flexsim, particularly with the difference in origin placement for grid versus for objects, can you help please?

I am making a model of a coal mine, which is quite large (i.e. 15km x 10km at 1m scale), and I need to layout everything on the basis of GPS coordinates (i.e. eastings and northings in metres from a reference point) on top of a high-resolution aerial photo.

I have been given a series of high-res photo tiles (22MB each), which each represent a 1500mx1500m square (i.e. need 200 for the site), where the filename represents the GPS coordinates of the bottom left-hand corner of the image tile. I have also been given a layout schema which lists the GPS coordinates of key plant (e.g. conveyors), including turns etc.

Thus it is important that I can layout both the background tiles and the equipment accurately so they line up. Fortunately, Flexsim is well-designed for this, and as described on Slide 5 of your Intro to OpenGL powerpoint (see 1st attached zip), both grid space and object space should have the origin of their coordinate system at the bottom left-hand corner. Howevr, this doesn't seem true in practice.

In order to try this, I batch processed a few image files so they were much smaller (about 3MB each), and setup 3 visual tools at the correct locations (grid pts, 7500-9000, 9000-9000, 10500-9000 in this case) using the General tab. Then using the background import wizard button, I imported each of the image files, and set the sizes to sx=1500, sy=1500, as I am using a 1m grid.

I have attached the Flexsim model that contains these three Visual Tools and the three background images, and by loading it you can see that the three images line up perfectly. But when you move the mouse around and looking at the coordinates it is obvious that the origin of coordinates for the visual tools is in fact the top left corner, rather than the bottom left corner.

A bit of experimentation (i.e. dragging in other objects, setting them to large sizes, then moving the mouse around) then showed that all objects have the origin of their coordinates at the same position (i.e. top left corner).

This is extremely inconvenient and awkward when trying to layout resources on the basis of coordinates, since while the x-value matches the grid, the y-value does not, and one must then fiddle every y-coordinate on the basis of the y-depth of the object (e.g. in the case of the background image, you must add 1500 to every y-coordinate).

While this is relatively simple in the case of a background image, it is much more complex when one is laying out curved pathways of different thicknesses (e.g. 9km-long conveyors or pipes). Unfortunately, this make what would've been a simple layout job, a very complex one.

I tried using a negative value in sy, but this flips the image vertically, and I also tried rotations (i.e. rz), but this didn't sem to work either.

Is there any way of setting the coordinates origin of objects so it matches the grid? Or is there any other workaround I can use that will save me having to calulate the y-depth of every single object and, fudging the y-grid value?

I have also uploaded the three image files, relative to the GPS zero point of 644500, 7440500, in case you wish to review them (e.g. see actual orientation of image). Based on the zero point, image 652000-7449500.jpg should be at grid pt 7500-9000, image 653500-7449500.jpg should be at grid pt 9000-9000, and image 655000-7449500.jpg should be at grid pt 10500-9000.

I have my fingers crossed, hoping there is some simple way of using the proper coordinates for all objects, and I hope you can help me.

thanks in advance

Brett
Attached Thumbnails
Click image for larger version
Name:	652000-7449500.jpg
Views:	97
Size:	3.06 MB
ID:	2049   Click image for larger version
Name:	653500-7449500.jpg
Views:	113
Size:	3.00 MB
ID:	2050   Click image for larger version
Name:	655000-7449500.jpg
Views:	84
Size:	3.10 MB
ID:	2051  
Attached Files
File Type: zip Intro to OpenGL.zip (235.6 KB, 127 views)
File Type: fsm PhotoBackground1.fsm (9.32 MB, 93 views)
  #2  
Old 02-02-2013
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

If you have your objects inside visual tools you'll need to map the desired model (x,y,z) coordinates onto those of the object's location/container using vectorprojectx/y/z() functions.

So if variable absx is the absolute model x coordinate that you've found from the gps coordinate, and absy and absz have been founnd the same way, you'd use:

Code:
double objx=vectorprojectx(model(),absx,absy,absz,up(myobject));
double objy=vectorprojecty(model(),absx,absy,absz,up(myobject));
double objz=vectorprojectz(model(),absx,absy,absz,up(myobject));
setloc(myobj,objx,objy,objz);
If you want the center of the object to be at that location, first adjust the absolute values:

Code:
absx=absx-xsize(myobject)/2;
absy=absy+ysize(myobject)/2;
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
brett forbes (02-02-2013)
  #3  
Old 02-02-2013
brett forbes brett forbes is offline
Flexsim User
 
Join Date: Oct 2011
Posts: 34
Downloads: 0
Uploads: 0
Thanks: 27
Thanked 3 Times in 2 Posts
Rep Power: 107
brett forbes is on a distinguished road
Default Further clarifiactions on using x,y,z to position objects

Hi Jason,

Thanks so much for your reply, you're a true legend!

However, I have some further questions about your solution, as perhaps Im a bit slow on the uptake, and I need to make sure I fully understand.

I have reviewed the help system to ensure I understand the functions, you are proposing, and they appear to be functions that project an absolute coordinate (e.g. in model space) onto a relative coordinate (e.g. in object space). I like your use of up(), very neat. So far so good.

As I understand it, if I had a single giant visual tool (e.g. 30,000m x 15,000m), I could use these commands to position objects (e.g. JPEGs) within them, so they line up in the correct absolute position with relation to the grid.

Q1:Where is the reference point that I take my absx and absy from, is it the bottom left hand corner of the object, or the top left hand corner? By looking at your mid-point calc, it seems to be the top left corner as you minus half the width on the x-value, and then add half of the depth on the y-value.

Q2: If I am just considering the placement of an object on the grid (i.e. not inside something), and all of my GPS coordinates (absx, absy) are in reference to the bottom left-hand corner, your midpoint formula suggests that in the General tab x=absx, whereas y=absy+ysize(myobject). Is this correct?

Q3: In the more complex instance of a very long conveyor (e.g. 2m width, but 8 km long) with a number of curves and angles that is not inside some other object, I assume that I need to set the start point in the General tab as above (i.e. x=absx, y=abs+ysize(myobject)), and then I can use the layout tab to set all of the relative lengths, angles and curves. My assumption is that by setting the start position correctly, and then applying relative directions as to layout, the conveyor should be properly positioned. Is this how you see it? In this example, ysize(myobject)=2m, if and only if the conveyor starts out moving horizontally (e.g. constant x for the first section), whereas if it starts off at some angle, then I must use the ysize(myobject) or simple trigonmetry to work out the actual ysize. Is this correct and will the trigonometry approach return the same value as ysize(myobject)?

Q4: Finally, is it better to have a single giant visual tool to hold all 200 of the 1.5kmx1.5km JPEGs, or should I use a visual tool for each JPEG? What do you recommend?

Thanks so much for your technical expertise and help. Sorry that I'm a bit slow on these layout functions.

Best Regards

Brett
  #4  
Old 02-03-2013
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

Can't help thinking 'legend' is a pun on my name . Anyhow, here goes :

A1) Yes, location coordinates are the top left.

A2) Yes, that's it - just add the whole ysize() if your coordinates are the bottom left.

A3) Yes - I'd set the start position and then incrementally add sections while referring to the layout. For the position of a rotated object, trig. will solve most of this - just remember that the position is by default always for an object with zero rotation. So the real question how the coordinate relates to your object - if the conveyor is rotated 90 degrees, is the bottom left at the start actually outside the conveyor surface, or is it one of the corners? Once you know what that is, it's simple to workout the Flexsim locations. Another question is how accurate it needs to be over 1.5km... but hey.

A4) Do you even need visual tools, or do you just need the background layouts? Sometimes people use them to organize the model in a hierarchy in the tree. If that's no benefit, you can just use them as backgrounds and once you've got them aligned relative to each other check the "no select" checkbox to prevent dragged objects from getting placed inside , and to stop you moving them accidentally. Then place all you objects at the model() level and avoid the vectorprojections.
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
brett forbes (02-03-2013)
  #5  
Old 02-03-2013
brett forbes brett forbes is offline
Flexsim User
 
Join Date: Oct 2011
Posts: 34
Downloads: 0
Uploads: 0
Thanks: 27
Thanked 3 Times in 2 Posts
Rep Power: 107
brett forbes is on a distinguished road
Thumbs up Awesome

Hi Jason,

Thanks so much for the clarification on those questions.

You've removed any confusion on how to go ahead, which is awesome, I really appreciate it.

Don't worry, the legend comment was not a pun, if I'd wanted to pun your name I would have enthused over how your vast experience enabled you to step quickly through my issues, enlightening only the key highpoints, flitting through the intracies of the code like Hermes (i.e. winged messenger of the gods), or something similar.

Imagine the puns available if you had been a kickboxer.

Anyway, thanks

Brett

Tags
gps, grid space, object layout, object space


Thread Thread Starter Forum Replies Last Post
Changing grid size Christian Norregaard Q&A 4 04-02-2012 03:49 AM
discharge box on the continuous space Shahin Gelareh Q&A 3 02-02-2012 02:56 AM
Machines have moved out of the Grid naveenkumar Tips and Tricks 3 01-10-2012 02:15 AM
snap to grid with even number on ysize Sebastian Hemmann Q&A 1 06-10-2011 10:52 AM
how to make a object in a userlibrary tree to display in the library grid? zhang xin Q&A 1 11-26-2009 06:29 AM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.