ladybug-tools / honeybee

:honeybee: A python library to create, run and visualize radiance studies. Core library of Honeybee[+].
http://ladybug-tools.github.io/honeybee/docs
GNU General Public License v3.0
93 stars 25 forks source link

1. Solution exception:Failed to find AngleBasisName in first 2000 lines. #248

Closed cyshimz closed 6 years ago

cyshimz commented 6 years ago

Hi all! I'm currently trying out the Honeybee[+] components, but I have trouble running example files 11 and 12. I'm stuck at the BSDFMaterial part, where it states: 1. Solution exception:Failed to find AngleBasisName in first 2000 lines.

I saw a similar problem where the error was at 100 lines, but I can't seem to find a solution to my error. Is it a Radiance version problem? I am currently using Radiance 5.2.1 (released Jun 21).

I've attached a screenshot below of the workflow, with the error.

image

sariths commented 6 years ago

@cyshimz This is a parsing issue with the Honeybee python script. This has cropped up on the forum too. Can you share the BSDF that you are using?

@mostaphaRoudsari

mostaphaRoudsari commented 6 years ago

See this: https://discourse.ladybug.tools/t/importing-nrel-bsdf-materials-through-hb-error-failed-to-find-anglebasisname-in-first-100-lines/3369/3

@cyshimz, Can you open the xml file and search for ? If it exist in which line?

sariths commented 6 years ago

@mostaphaRoudsari This will likely be a recurring problem as people start playing around with BSDFs for more complex geometries and generate BSDFs with the +geom option. The mgf format, which encapsulates rad geometry data in xml files, gets written over a large number of lines. It might be useful to do a test upfront if the xml file is a BSDF and throw an exception right at the end if no AngleBasisName was found. There appears to be a proper XML schema for BSDF files (the link http://windows.lbl.gov/BSDF-v1.4.xsd is dead):

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by: genBSDF -n 21 -s n=b00kT -r -ab 12 -ad 20000 -lw 5e-05 +geom meter +f +b -c 25600 -t4 4 ./cfs/b00.rad -->
<WindowElement xmlns="http://windows.lbl.gov" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://windows.lbl.gov/BSDF-v1.4.xsd">
<WindowElementType>System</WindowElementType>
<FileType>BSDF</FileType>
<Optical>
<Layer>
    <Material>

Since the format is defined upfront, you can do a test for locatingFileType in the first 200 lines or so and then keep parsing till you reach the AngleBasis part. Incidentally, there is "AngleBasisName" in the tensor tree files created through genBSDF (examples). Since line reading happens through generator patterns I can't imagine there being too much of an overhead even if you read the file till the end.

cyshimz commented 6 years ago

@sariths @mostaphaRoudsari

I've... actually not started to change anything in the example file, because I'm still trying to understand the workflow. So, I'm using the xml files available on github: https://github.com/ladybug-tools/honeybee-grasshopper/tree/master/plugin/grasshopper/sampleFiles/xmls

In the clear.xml file, there are 2 instances of AngleBasisName, both in line 751.

In the diffuse.xml file, there are also 2 instances of AngleBasisName, both in line 734.

I've pasted my search screenshot, because I consider myself very new at Grasshopper and Ladybug Tools. Please let me know if I've been doing something wrongly!

image

sariths commented 6 years ago

@cyshimz Are you sure that you are feeding the right path to the _xmlFile input? I am not too keyed-in on Grasshopper and am just wondering if the input path itself is mangled.

mostaphaRoudsari commented 6 years ago

Maybe we should enhance our parsing. @cyshimz can you direct me to the exact file that is causing the issue? Thanks.

cyshimz commented 6 years ago

@sariths Yes, I'm pretty sure that the file path is correct for clear.xml and diffuse50.xml, as a different error message shows up when the file path is entered wrongly - that happened early on when I was trying out the example file.

@mostaphaRoudsari I've tried 2 example files so far: 11_five_phase_I_gridbased.gh & 12_five_phase_II_gridbased.gh on: https://github.com/ladybug-tools/honeybee-grasshopper/tree/master/plugin/grasshopper/sampleFiles

The links for the xml files that I'm using: https://github.com/ladybug-tools/honeybee-grasshopper/tree/master/plugin/grasshopper/sampleFiles/xmls

mostaphaRoudsari commented 6 years ago

@cyshimz, You can see the xml files on GitHub and they don't match your screenshots. The AngleBasis is on line 43 as you can see here:

https://github.com/ladybug-tools/honeybee-grasshopper/blob/ce97782d0b4e5250f4e2daa0404ca7be9eff1089/plugin/grasshopper/sampleFiles/xmls/clear.xml#L43

What I noticed is that in your screenshot there are extra characters that are not in the original file. Are you sure you are using the files from GitHub? Can you upload the files here?

mostaphaRoudsari commented 6 years ago

@sariths, I checked the Radiance generated TensorTree BSDFs and it is using it's own new structure! The tag for TensorTree4 is IncidentDataStructure and instead of using AngleBasisName it is using AngleBasis. The AngleBasis is important for setting up the header for receivers and we can neglect them for TensorTree files but for Klems files we should parse it correctly.

</MGFblock></Geometry>
    <DataDefinition>
        <IncidentDataStructure>TensorTree4</IncidentDataStructure>
    </DataDefinition>
    <WavelengthData>
        <LayerNumber>System</LayerNumber>
        <Wavelength unit="Integral">Visible</Wavelength>
        <SourceSpectrum>CIE Illuminant D65 1nm.ssp</SourceSpectrum>
        <DetectorSpectrum>ASTM E308 1931 Y.dsp</DetectorSpectrum>
        <WavelengthDataBlock>
            <WavelengthDataDirection>Transmission Back</WavelengthDataDirection>
            <AngleBasis>LBNL/Shirley-Chiu</AngleBasis>
            <ScatteringDataType>BTDF</ScatteringDataType>
            <ScatteringData>
mostaphaRoudsari commented 6 years ago

@cyshimz, I think I finally figured what is going on with your files. You have saved the html page instead of only saving the XML file. That's why you get extra characters and the keyword is not in the same line. Try to download the files from raw preview. Here are the links:

https://raw.githubusercontent.com/ladybug-tools/honeybee-grasshopper/master/plugin/grasshopper/sampleFiles/xmls/diffuse50.xml

https://raw.githubusercontent.com/ladybug-tools/honeybee-grasshopper/master/plugin/grasshopper/sampleFiles/xmls/clear.xml

Let me know if the issue is addressed and we should close this issue here.

sariths commented 6 years ago

@sariths, I checked the Radiance generated TensorTree BSDFs and it is using it's own new structure!

Well, that throws the utility of the XML schema out of the window :(

cyshimz commented 6 years ago

@mostaphaRoudsari Thank you very much for spotting what I did wrongly! The BSDFMaterial seems to be working properly now. However the example simulation still failed during a later component - I'm going to try and troubleshoot it, and ask for help in a different thread if necessary. I think that this issue can be closed :)

Thanks again!

AntoineDao commented 6 years ago

Taking it this issue can be closed then. Feel free to re-open if not.

Also worth noting that issue below should be resolved by #250

@sariths, I checked the Radiance generated TensorTree BSDFs and it is using it's own new structure!