WeldingSpotPerformance/Params.py

29 lines
864 B
Python
Raw Normal View History

import json
from numpy import sqrt
class Params():
def __init__(self, path, file):
config = self.json_load(path, file)
for key, value in config.items():
setattr(self, key, value)
self.smin1t = self.smin1 - self.dblock / 2
self.smin2t = self.smin2 - self.dblock / 2
self.awork = self.umax / (self.l * self.m)
self.fl = self.Fd * (1-self.kturn)
self.flon = self.Fd * self.kturn
self.Fprop = self.kprop * self.Fd
self.Ftg = self.Fd * (1 - self.kprop)
self.Fq = 3 * self.Fd / 2 - 1/2 * sqrt(self.Fd*self.Fd + 16 * self.Fd * self.Fprop - 8 * self.Fprop**2)
def json_load(self, path : str, filename : str):
with open("/".join([path, filename]), "r") as f:
config = json.load(f)
return config