Commit 6cafd09a authored by Sean Leavey's avatar Sean Leavey
Browse files

Support input noise in LISO input files

parent f149b556
......@@ -87,6 +87,7 @@ class LisoParser(metaclass=abc.ABCMeta):
"input_node_n": None,
"input_impedance": None,
"output_type": None,
"input_refer": None,
"noise_output_element": None,
"response_outputs": [],
# Displayed noise.
......@@ -471,6 +472,7 @@ class LisoParser(metaclass=abc.ABCMeta):
if self.output_type == "noise":
analysis_args['sink'] = self.circuit[self.noise_output_element]
analysis_args['impedance'] = self.input_impedance
analysis_args['input_refer'] = self.input_refer
return analysis.calculate(self.input_type, **analysis_args, **kwargs)
......@@ -602,6 +604,15 @@ class LisoParser(metaclass=abc.ABCMeta):
self._circuit_properties["output_type"] = output_type
@property
def input_refer(self):
"""Whether noise is project to the input."""
return self._circuit_properties["input_refer"]
@input_refer.setter
def input_refer(self, input_refer):
self._circuit_properties["input_refer"] = bool(input_refer)
def _set_inductor_couplings(self):
# discard name (not used in circuit mode)
for _, value, inductor_1, inductor_2 in self.inductor_couplings:
......
......@@ -43,6 +43,7 @@ class LisoInputParser(LisoParser):
"uoutput": "UOUTPUT",
"ioutput": "IOUTPUT",
"noise": "NOISE",
"inputnoise": "INPUTNOISE",
"noisy": "NOISY"
}
......@@ -304,11 +305,13 @@ class LisoInputParser(LisoParser):
self._parse_current_output(p[2])
def p_noise(self, p):
'''instruction : NOISE CHUNK chunks end'''
'''instruction : NOISE CHUNK chunks end
| INPUTNOISE CHUNK chunks end'''
noise_str = p[2] + " " + p[3]
input_noise = p[1] == "inputnoise"
# parse noise node
self._parse_noise_output(noise_str)
self._parse_noise_output(noise_str, input_refer=input_noise)
def p_noisy(self, p):
'''instruction : NOISY chunks end'''
......@@ -514,12 +517,13 @@ class LisoInputParser(LisoParser):
# add output
self.add_response_output(LisoOutputCurrent(component=component_name, scales=scales))
def _parse_noise_output(self, noise_str):
def _parse_noise_output(self, noise_str, input_refer=False):
# split by whitespace
params = noise_str.split()
# noise output
self.output_type = "noise"
self.input_refer = input_refer
# noise output
self.noise_output_element = params[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment