-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_generic_models.py
44 lines (33 loc) · 1.54 KB
/
run_generic_models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from os.path import join as os_join
import json
from source.model.structure_model import StraightBeam
from source.analysis.analysis_controller import AnalysisController
# ==============================================
# Model choice
# NOTE: all currently available models
available_models = [
'TestParametersStraightBeam.json',
'ProjectParameters3DGenericBuilding.json',
'ProjectParameters3DGenericPylon.json'
]
for available_model in available_models:
# ==============================================
# Parameter read
with open(os_join(*['input', 'parameters', available_model]), 'r') as parameter_file:
parameters = json.loads(parameter_file.read())
# create initial model
beam_model = StraightBeam(parameters['model_parameters'])
# additional changes due to optimization
if 'optimization_parameters' in parameters:
# return the model of the optimizable instance to preserve what is required by analyzis
from source.model.optimizable_structure_model import OptimizableStraightBeam
beam_model = OptimizableStraightBeam(
beam_model, parameters['optimization_parameters']['adapt_for_target_values']).model
else:
print('No need found for adapting structure for target values')
# ==============================================
# Analysis wrapper
analyses_controller = AnalysisController(
beam_model, parameters['analyses_parameters'])
analyses_controller.solve()
analyses_controller.postprocess()