architecture-building-systems / hive

Rhino Grasshopper plug-in for quick & dirty building simulation
https://www.food4rhino.com/en/app/hive
GNU General Public License v3.0
31 stars 4 forks source link

Migrate combustion and EPW-reader from Hive.Core to Hive.IO #692

Closed maxenceryan closed 2 years ago

maxenceryan commented 2 years ago

Issues

Closes #686

Description

Migrate the epw-reader from ghpy to Hive.IO

TODO:

Checklist

christophwaibel commented 2 years ago

hey @maxenceryan , I suggest to keep an option for a simple workflow without needing to go through the whole environment->envDistributor pipeline. Yes, I think it makes sense to move the parsing to the EpwReader component. Please also note our naming convention of using a Prefix Gh(...) for all grasshopper components

maxenceryan commented 2 years ago

an issue with having parsing only in the EPW distributor is that the GhEnvironment component actually needs EPW already parsed in order to set a couple of the default energy potentials, which are passed along at the EnvDistributor.

l69-71 in Environment.SetDefaultEnergyPotentials()

            this.EnergyPotentials[6] = new Air(this.Horizon, null, null, null, this.EpwData.DryBulbTemperature);
            this.EnergyPotentials[6].Name = "DryBulbTemperature";
            this.EnergyPotentials[7] = new Radiation(this.Horizon, this.EpwData.GHI);

We couuuld just say either plug in an Hive.IO.EPW class object OR the filepath into the EPW Distributor component, with priority given to the EPW object if not null.

christophwaibel commented 2 years ago

an issue with having parsing only in the EPW distributor is that the GhEnvironment component actually needs EPW already parsed in order to set a couple of the default energy potentials, which are passed along at the EnvDistributor.

l69-71 in Environment.SetDefaultEnergyPotentials()

            this.EnergyPotentials[6] = new Air(this.Horizon, null, null, null, this.EpwData.DryBulbTemperature);
            this.EnergyPotentials[6].Name = "DryBulbTemperature";
            this.EnergyPotentials[7] = new Radiation(this.Horizon, this.EpwData.GHI);

We couuuld just say either plug in an Hive.IO.EPW class object OR the filepath into the EPW Distributor component, with priority given to the EPW object if not null.

right. then let the GhEnvironment already parse the epw and, as you said, the GhDistEpw either reads in a path (and parses the epw itself), or reads in an epw object and doesn't need to parse itself anymore.

the boolean, I might have explained it incorrectly. So the parsing should happen either way, but just dumping out the DataLists should be optional

maxenceryan commented 2 years ago

sounds good, your comment and commit make sense to me. Hopefully I can wrap this up by monday

maxenceryan commented 2 years ago

@christophwaibel ok so I finished up the EPW reader stuff as per the comments. You can see how it compares to the python solution in GrasshopperExamples\Testing\Hive_Environment_Test.gh. The assert code for comparing C# and python component is a tad messy... but it would throw an error if they didnt match.

image

You can also look in GrasshopperExamples\Testing\Hive_Distributor_Test.gh to see how it would look like from now on.

image image

A few things;

Thanks!

christophwaibel commented 2 years ago

A few things;

  • I still need to update the EPW component in the other GH files, so a commit will be incoming.

should I wait for another commit? otherwise, you can merge this PR, @maxenceryan

  • comment out the python epw-reader building in build.cmd

can't do yet, because there is a ghpython component in the main template that relies on following lines from epw_reader.py:

clr.AddReferenceToFileAndPath(os.path.join(path, "Libraries\Hive", "Hive.IO.gha"))
import Hive.IO.EnergySystems as ensys

I'll make a separate issue about it.

  • delete the python component and assert madness in GrasshopperExamples\Testing\Hive_Environment_Test.gh.

done

  • Finally, i had already migrated the simple combustion components, so they are still there. As you said, we don't need them anymore, so should I for sure delete them or save them somewhere?

as discussed before in the sprint: let's keep them for now

ChrisZenhub commented 2 years ago

@maxenceryan when merging with the current master, you can keep the EaCS3_E04_Hive_Template.gh from this PR and overwrite master. But @mmatache25 did some changes to the EnergySystems Hizard, so keep an eye on what you merge from Hive.IO.csproj.

Also, I'm not sure if this PR already merged the updated PV / BIPV catalogues

maxenceryan commented 2 years ago

ok so merging now. Last thing I did: