2

Differences between relative and world coordinate system?

I have a doubt related to the Coordinate System. Looking at the examples files, for instance, the Exercise2C-Solution.idf (see related doc in Getting Started), used Relative, and the origin of all zones is x = 0, y = 0 and z = 0. I don't understand why, agree with me, in that way the Zone Origin coordinates are not specified relative to the Building Origin.

Using any of them (Relative or World), the vertex of the surfaces continues the same?

melanie's avatar
333
melanie
asked 2017-02-01 20:24:02 -0500
Julien Marrec's avatar
29.7k
Julien Marrec
updated 2017-02-02 05:26:57 -0500
edit flag offensive 0 remove flag close merge delete

Comments

Could you always try to tag your question with a specific software if that's appropriate please? A linked to the example in question is useful. I went ahead and made the changes.

Julien Marrec's avatar Julien Marrec (2017-02-02 05:17:36 -0500) edit
add a comment see more comments

1 Answer

4

The Zones indeed all have the same origin at (0,0,0). It helps to visualize this stuff, here I loaded the model and removed the plenum zone in order to see things better. I've selected the zone that's the furthest away from the building origin (which is located at the intersection of the red, blue and green axis). The zone origin indeed is at (0,0,0).

image description

It doesn't matter what the zone origin is as long as the Surfaces are entered properly.

If we look at the difference between the EAST PERIMETER and WEST PERIMETER Zones

image description

Here's the min/max values for each coordinate (x, y, z) for the walls (see code to generate this below)

[1] (main)> west_walls
=> {:all_x=>[0.0, 3.7], :all_y=>[0.0, 15.2], :all_z=>[0.0, 2.4]}
[2] (main)> east_walls
=> {:all_x=>[26.8, 30.5], :all_y=>[0.0, 15.2], :all_z=>[0.0, 2.4]}

So the walls for the "EAST PERIMETER" zone have much higher x coordinates than "WEST PERIMETER" walls, which explains why they are placed where they are even though both Zones have the same origin.


Documentation to read:


Code to generate the above:

workspace = OpenStudio::Workspace.load('Exercise2C-Solution.idf').get

def get_xyz(w)
  all_x = []
  all_y = []
  all_z = []
  for i in 0..w.numExtensibleGroups-1
    e = w.getExtensibleGroup(i)
    all_x << e.getDouble(0).get
    all_y << e.getDouble(1).get
    all_z << e.getDouble(2).get
  end

  return all_x, all_y, all_z
end

west = workspace.getObjectByTypeAndName("Zone".to_IddObjectType, "WEST PERIMETER").get
east = workspace.getObjectByTypeAndName("Zone".to_IddObjectType, "EAST PERIMETER").get

#west_walls = {:walls=>[], :all_x=>[], :all_y=>[], :all_z=>[]}
#east_walls = {:walls=>[], :all_x=>[], :all_y=>[], :all_z=>[]}

west_walls = {:all_x=>[], :all_y=>[], :all_z=>[]}
east_walls = {:all_x=>[], :all_y=>[], :all_z=>[]}


workspace.getObjectsByType("BuildingSurface:Detailed".to_IddObjectType).each do |w|
  if w.getString(1).to_s.upcase == 'WALL'
    if w.getString(3).to_s.upcase == west.name.to_s.upcase
        all_x, all_y, all_z = get_xyz(w)
        west_walls[:all_x] += all_x
        west_walls[:all_y] += all_y
        west_walls[:all_z] += all_z

    elsif w.getString(3).to_s.upcase == east.name.to_s.upcase
        #east_walls[:walls] << w
        all_x, all_y, all_z = get_xyz(w)
        east_walls[:all_x] += all_x
        east_walls[:all_y] += all_y
        east_walls[:all_z] += all_z
    end
  end
end

west_walls.each {|k, v| west_walls[k] = v.minmax}
east_walls.each {|k, v| east_walls[k] = v.minmax}
Julien Marrec's avatar
29.7k
Julien Marrec
answered 2017-02-02 08:43:56 -0500, updated 2017-02-02 08:45:08 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments