sketchucation logo sketchucation
    • Login
    1. Home
    2. dfwlarch
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    D
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 6
    • Groups 1

    dfwlarch

    @dfwlarch

    10
    Reputation
    1
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    dfwlarch Unfollow Follow
    registered-users

    Latest posts made by dfwlarch

    • RE: Coordinates XYZ of camera and target

      Vince, I had the same question a few months ago.

      I cobbled this together:
      cameraCoords.rb

      You can also look at the code for CameraKeyMaker. I've never used it, but from looking at the code it implements a lot of features that you might be looking for.
      http://sketchucation.com/forums/viewtopic.php?f=323&t=36430

      posted in Plugins
      D
      dfwlarch
    • RE: [Plugin] Plugin to profile/optimize code

      No, I didn't test it with the Developer Console. I was thinking the people who would most want to profile their code would have such a huge trace that they would want to dump to a file. Maybe printing to stdout should have an option of showing the top N entries...

      posted in Plugins
      D
      dfwlarch
    • RE: [Plugin] Solar/daylight analysis (v0.98, 2013-08-11)

      I posted a new version (see original post for files to download). Recent changes:

      ` %(#00BF00)[# Rev. | .Date..... | Notes

      -----|------------|-----------------------------------

      0.98 | 2013-08-11 | Add ability to read weather data from TMY3 file

      .... | .......... | Bug: in fine/tmy3 mode, adjust for surface tilt

      .... | .......... | based on beam strength on horiz. surface, not to

      .... | .......... | normal-to-beam surface

      0.97 | 2013-08-07 | Bug: remove Numeric class overloads, make help

      .... | .......... | file search relative]`

      The enhancement in v0.98 lets you calculate the daylight factor as a ratio of observed weather to clear sky (Bird-Hulstrum model). So for example, this is the clear sky expectation over the course of a year for some geometry geolocated in Seattle, Washington (note the max daylight factor appearing in the bottom left corner area):

      http://farm8.staticflickr.com/7408/9489912899_8d30b0ac60.jpg

      Using a weather file from Seattle, the daylight factor looked like this:

      http://farm8.staticflickr.com/7370/9492664718_87f5fbc91c.jpg

      In other words, over a typical year the cloud cover allows only 78% of the theoretical maximum sunlight reaching a horizontal surface.

      Contrast that with the same geometry geolocated to Phoenix, Arizona. This is the daylight factor using the Phoenix TMY3 weather file. Very little cloud cover.

      http://farm8.staticflickr.com/7385/9492657232_c8a9a7ae59.jpg

      In TMY3 mode (a.k.a weather file), I could also have displayed the results in terms of watts per square meter, to get an idea of the amount of solar energy I could capture with a photovoltaic array. Note, however, that you would have to factor in PV efficiency (or inefficiency).

      It should also be noted that the computations currently take a while. The above test uses really simple geometry. Here is what is being calculated:

      • triangulated network of 96 faces to analyze
      • 27 faces make up the shading structure
      • analyzed from Jan 1 through Dec 31
      • run on a laptop with a core2 duo processor @2.26Ghz, 32 bit OS, 3GB ram
        and it takes 126 secondsto crunch.

      Hence the need for this plugin:
      http://sketchucation.com/forums/viewtopic.php?f=323&t=53685.

      Profiling the code when it's trying to simulate a run of 15 days showed the following:

        %   cumulative   self              self     total
       time   seconds   seconds    calls  ms/call  ms/call  name
       41.80   285.60    285.60   660648     0.43     0.60  BM_SimpleSolarStudy.inShadow
       20.81   427.80    142.20    81464     1.75    23.65  Range#each
        5.69   466.65     38.84  2404861     0.02     0.02  Array#[]
        3.80   492.60     25.96    59682     0.43     0.78  BM_SimpleSolarStudy.adjustForTilt
        1.89   505.49     12.88   660648     0.02     0.02  Geom.intersect_line_plane
        1.81   517.84     12.36   660648     0.02     0.02  Sketchup;;Face#plane
        1.70   529.47     11.63   660857     0.02     0.02  String#to_i
        1.68   540.93     11.46   660648     0.02     0.02  Sketchup;;Face#classify_point
        1.66   552.26     11.33   660648     0.02     0.02  Geom;;Point3d#-
        1.63   563.41     11.15   661263     0.02     0.02  Hash#[]
        1.62   574.51     11.10   662207     0.02     0.02  Fixnum#==
        1.58   585.31     10.80   662137     0.02     0.02  Kernel.nil?
        1.53   595.79     10.48   660853     0.02     0.02  Fixnum#&
        1.51   606.14     10.35   661345     0.02     0.02  Fixnum#>
        1.49   616.29     10.15   660648     0.02     0.02  Sketchup;;Drawingelement#hidden?
        1.40   625.85      9.56   144037     0.07     0.10  Numeric#to_rad
        0.98   632.53      6.68      203    32.89    32.89  Sketchup;;Drawingelement#material=
        0.91   638.75      6.22   660851     0.01     0.01  Kernel.==
        0.80   644.20      5.45   388599     0.01     0.01  Float#*
        0.71   649.05      4.85    63402     0.08     0.10  Numeric#to_deg
        0.62   653.26      4.22   119364     0.04     0.05  Geom;;Vector3d#new
        0.61   657.43      4.16      744     5.60    13.40  BM_SimpleSolarStudy;;SSS_sunData#calcSun
      
      posted in Plugins
      D
      dfwlarch
    • [Plugin] Plugin to profile/optimize code

      This might be a duplicate effort, but I couldn't find anything beyond this thread:
      http://sketchucation.com/forums/viewtopic.php?f=180&t=25101

      So... here is a SketchUp plugin that does basic profiling of each function call. It is modified from the stock profiler.rb that came with Ruby 1.8.7 (see https://github.com/ruby/ruby/blob/ruby_1_8_7/lib/profiler.rb). A good writeup of profiler.rb is found here: http://www.ibm.com/developerworks/opensource/tutorials/os-ruby2/section3.html

      Usage

      1. Add the following line
        require 'SU_Profiler/SU_Profiler.rb'
      2. Add this at the start of the block to profile
        SU_Profiler::start_profile
      3. At the end of the block to profile, add
        SU_Profiler::print_profile() # to print to ruby console
        or
        SU_Profiler::print_profile(filehandle) # to print to file

      Output

      The output will be something like this:

      **```

      % cumulative self self total
      time seconds seconds calls ms/call ms/call name
      29.07 1.87 1.87 48 39.02 39.02 Sketchup;;Drawingelement#material=
      15.49 2.87 1.00 2095 0.48 0.70 BM_SimpleSolarStudy.inShadow
      10.71 3.56 0.69 2066 0.33 5.67 Range#each
      9.20 4.15 0.59 1 593.00 593.00 UI.savepanel
      4.59 4.45 0.30 72 4.11 13.44 BM_SimpleSolarStudy;;SSS_sunData#calcSun
      3.91 4.70 0.25 2376 0.11 0.18 Numeric#to_rad
      3.66 4.94 0.24 8952 0.03 0.03 Float#*
      2.42 5.09 0.16 4086 0.04 0.04 Float#/
      1.68 5.20 0.11 2145 0.05 0.05 Fixnum#&
      1.46 5.30 0.09 2095 0.04 0.04 Geom.intersect_line_plane
      1.44 5.39 0.09 48 1.94 4.23 BM_SimpleSolarStudy.getCentroid
      1.21 5.47 0.08 1668 0.05 0.05 String#==
      1.21 5.54 0.08 9854 0.01 0.01 Array#[]
      1.21 5.62 0.08 1 78.00 78.00 UI.inputbox
      1.20 5.70 0.08 2245 0.03 0.03 Hash#[]
      1.20 5.78 0.08 48 1.60 3.87 BM_SimpleSolarStudy.hsv2rgb
      0.98 5.84 0.06 192 0.33 0.57 BM_SimpleSolarStudy.remapVal
      0.96 5.90 0.06 2240 0.03 0.03 Kernel.nil?
      0.96 5.96 0.06 72 0.86 0.86 BM_SimpleSolarStudy;;SSS_sunData#calcJD
      0.95 6.02 0.06 2095 0.03 0.03 Sketchup;;Face#classify_point

      
      Latest version: 1.00, updated 2013-Aug-8
      [SU_Profiler.zip](/uploads/imported_attachments/24FQ_SU_Profiler.zip)
      
      Example usage:
      [profiler_test.rb](/uploads/imported_attachments/Q1CQ_profiler_test.rb)
      posted in Plugins
      D
      dfwlarch
    • RE: [Plugin] Solar/daylight analysis (v0.98, 2013-08-11)

      Thanks for the feedback and for bearing with me. First SketchUp plugin (and first time coding in Ruby, for that matter! My background is C/C++, Perl and PHP).

      I've updated the original post with the new code.

      posted in Plugins
      D
      dfwlarch
    • [Plugin] Solar/daylight analysis (v0.98, 2013-08-11)

      Daylight analysis using SketchUp has been more or less an interactive affair (turn on shadows, move the sliders, observe the light patterns), or it has required knowledge of external programs (Ecotect, Daysim, Radiance, etc.).

      This plugin calculates the amount of sunlight (insolation) falling on a group of faces over the course of a year, relative to the max sunlight theoretically available under a clear sky with no shade structures. The result is the daylight factor -- a number between 0.00 (completely shaded all year long) and 1.00 (nothing blocking the sun). The plugin color-codes and labels the target faces to indicate their daylight factor.

      http://farm6.staticflickr.com/5472/9454580305_811b64669e.jpg

      (model by Mugur)

      Basic mode:

      http://farm6.staticflickr.com/5525/9457367656_0f25afac4f.jpg

      Advanced mode:

      http://farm3.staticflickr.com/2828/9454585587_c68f956399.jpg

      Feature summary:

      • Sun positions are calculated for each hour, based on latitude and longitude

      • Calculates direct beam and diffuse irradiation (accounts for atmospheric scattering and ground-based reflectance)

      • Output can be written to a comma-separated file

      • Output can be in terms of solar irradiation (in watts per meter squared)

      • Shading structures selected by layer

      • Glass or semi-transparent faces selected by layer (user-input transmissivity)
        Future enhancements:

      • Ability to specify TMY3 weather file for solar insolation actually observed in v0.98

      • Optimize computation time

      Some code was translated from other people’s work. Please see credits, plugin options, and more details in the documentation (updated 2013-08-11)
      SimpleSolarStudy.pdf
      This is still ‘beta’, so please try it out and give me some bug/improvement feedback!

      v0.98 Updated 2013-08-11
      simple_solar_study_v098.rb

      v0.98 Updated 2013-08-11
      .rb and help files (.html and .pdf)
      Test model

      posted in Plugins
      D
      dfwlarch