domthom21 / eurocodedesign

Typed python framework for eurocode calculations
https://eurocodedesign.readthedocs.io/
Mozilla Public License 2.0
5 stars 1 forks source link

[ENH] NDP implementation proposal, German Gamma_M1 in EC3 #78

Open domthom21 opened 1 year ago

domthom21 commented 1 year ago

Is your feature request related to a problem? Please describe. The eurocodes allow the national annexes to set national defined parameters (NDP). For example in germany $\gamma_{M1} = 1.10$ is set in their national annex to EN 1993-1-1.

A list of the national standardization committess can be found in https://support.clearcalcs.com/article/150-eurocodes-and-national-annexes-where-to-get-them

Describe the solution you'd like I propose adding a @NDP decorator in a new module eurocodedesign.core.NA. A function with this decorator supports/uses a national defined parameter and must have a country parameter to set the national defined parameter internally.

The national country is set with the national country code as string, like de (ISO-3166-1 ALPHA-2), not the abbreviation of the standard comittee like DIN. It can be set globally via the function eurocodesign.core.NA.set_country(country='de') or by calling the function directly with function_name(country="de"). For the last call, the national country is only set for the function context.

Each Eurocode standard directory gets an internal folder _NA/, which has mutiple csv-file for each country containing the columns 'NDP_identifier,version,NDP,comment', e.g. de.csv, nl.csv containing the necessary infos for the nationalization of the function.

The nationalized function can call the helper function eurocodedesign.core.NA.load_NDP(ndp_id='5.11#gamma_M1', country='de')

Example:

ec3/_NA/de.csv
NDP_id, version, NDP, comment 
"5.11#gamma_M1", "2020-10", 1.10, "gamma_M1" #The NDP_identifier could also be the calling function name
...
@NDP
def gamma_M1(..., country=None) -> float:
   # Value according to EN 1993-1-1
   if country is None:
      gamma_M1: float = 1.00
      return gamma_M1
   # country not None -> look at NDP in national annex
   gamma_M1: float = float(eurocodedesign.core.NA.load_NDP(NDP_id='5.11#gamma_M1', country=country))
   return gamma_M1

Describe alternatives you've considered

Additional context

domthom21 commented 10 months ago

We can add functionality later to automatically list the functions with NDPs

domthom21 commented 10 months ago

We must think about the case where the NA does not define a value for the current country. At the moment if some countries define a NDP and some don't, a NotImplementedError is thrown

domthom21 commented 10 months ago

Überlegung zu NA 1993-1-1 6.1 notwendig, da unterschiedliche gamma_M2-Werte für Hochbauten und außergewöhnliche Bemessungssituationen

domthom21 commented 10 months ago

84

nc-hsu commented 10 months ago

We must think about the case where the NA does not define a value for the current country. At the moment if some countries define a NDP and some don't, a NotImplementedError is thrown

In the NA.csv we could have a line referencing this parameter just like in the other NA that do have a value for the NDP except instead of a value it could be a flag value/string etc, that triggers a call to the default value. That way we have to programme it to intentionally access the default value. And if we haven't programmed it it will still throw the not implemented error.