In Structuraid we need to have a system where we centralize all the information regarding design requirements coming from codes and standards. Since these codes are usually mandatory on a regional/country basis, it would be useful for us to be able to support multiple design codes and use one of them according to the project setup.
Here’s the following diagram that explains how the DesignCodes system will work
The system is composed of the following abstractions
Resolver
class that will provide functionality to point to the namespace that corresponds to the desired design codeSchemas
that will ensure that the contract of each requirement abstraction is kept the same no matter which design code is going to be followed.The first thing to do before using the design codes system is to call the resolver in order to point to the right namespace that the project will need to use:
design_code = DesignCodes::Resolver.use('nsr_10')
The resolver will return as a result the namespace that should be used later to call any requirement that needs to be made. For example, if you need to compute the elastic modulus according to the design code, do this:
design_code::RC::ElasticModulus.call(design_compression_strength: 28)
Each Code Requirement abstraction will raise one of the following errors if something went wrong: