Commit a3caae5a authored by Daniel Brown's avatar Daniel Brown

extending length of tokens for larger transfer function pole and zero inputs

parent 1f0fac49
......@@ -19,7 +19,8 @@ added features:
to the terminal
o added the ability to generate mutli-mode squeezing. This is done by using the `tem' command to set the mode content of a squeezer, like a normal laser component. The only difference being the amplitude part inputs the mode squeezing in dB and phase input sets the squeezing rotation.
o Introduced `--pykat=pipename` flag. This opens a pipe between Finesse and whatever else (typically Pykat) so that data can be sent and requested between the two.
o tf2: For each pole or zero added the funcion will automatically add the conjugate pole
so you don't need to specify each
bug fixes:
o noxaxis no longer tries to call gnuplot/python plotting
o fixed roundtrip gouy phase sign
......
......@@ -66,7 +66,7 @@
#define BUFF_LEN 1024 //!< Stream buffer length
#define ERR_MSG_LEN 1024 //!< Error message length
//! Max length of tokens when reading command strings from kat files
#define MAX_TOKEN_LEN 256
#define MAX_TOKEN_LEN 512
#define REST_STRING_LEN 82 //!< Length of "rest" of string when reading cmds
#define SMALL 1e-9 //!< The definition of a small number
#define ZERO 1e-15 //!< The definition of zero
......@@ -134,7 +134,7 @@
#define MAX_MAPS 20 //!< maximum number of maps per mirror
#define MAX_VARIABLES 30 //!< maximum number of dummy parameters
#define MAX_TIMERS 10 //!< maximum number of timers that can be going at once
#define MAX_POLES_ZEROS 40 //!< maximum number of poles or zeros for a transfer function
#define MAX_POLES_ZEROS 100//!< maximum number of poles or zeros for a transfer function
#define MAX_DOF_ITEMS 5 //!< maximum number of elements that can be included in one degree of freedom
#define NOT_FOUND -32768 //!< not found error code
#define GND_NODE -1 //!< unconnected node (beam dump)
......
......@@ -2254,6 +2254,7 @@ void print_help() {
" qshot[S/N] name n f1 [phase1 [f2...]] node[*] - quantum shotnoise detector\n"
" qnoised[S/N] name n f1 [phase1 [f2...]] node[*] - quantum noise detector\n"
" pgaind name component motion - open loop param. gain det.\n"
" xd name component motion - motion detector (See second help for motions)"
"** Available commands:\n"
" fsig name component [type] f phase [amp] - apply signal\n"
" fsig name component [type] f transfer_func - signal wth transfer function\n"
......
......@@ -1377,13 +1377,13 @@ void read_frequency_command(const char *command_string){
}
void read_general_mech_transfer_function(const char *command_string){
char command_name[MAX_TOKEN_LEN] = {0};
char component_name[MAX_TOKEN_LEN] = {0};
char gain[MAX_TOKEN_LEN] = {0};
char phase[MAX_TOKEN_LEN] = {0};
char poles[MAX_TOKEN_LEN] = {0};
char zeros[MAX_TOKEN_LEN] = {0};
char rest[MAX_TOKEN_LEN] = {0};
char command_name[LINE_LEN] = {0};
char component_name[LINE_LEN] = {0};
char gain[LINE_LEN] = {0};
char phase[LINE_LEN] = {0};
char poles[LINE_LEN] = {0};
char zeros[LINE_LEN] = {0};
char rest[LINE_LEN] = {0};
int n = sscanf(command_string, "%s %s %s %s %s %s %[^\n]",command_name, component_name, gain, phase, poles, zeros, rest);
//[%[^]]]
......@@ -1418,17 +1418,22 @@ void read_general_mech_transfer_function(const char *command_string){
a = strtok(tmp, ",");
while(a != NULL){
if(mtf->num_poles >= MAX_POLES_ZEROS)
gerror("Line `%s' : Exceeded maximum number of poles (%i)\n", command_string, MAX_POLES_ZEROS);
if(mtf->num_poles >= MAX_POLES_ZEROS) {
gerror("Line `%s' : Exceeded maximum number of poles (%i)\n", command_string, MAX_POLES_ZEROS);
}
n = sscanf(a, "%lf%lfi", &(mtf->poles[mtf->num_poles].re), &(mtf->poles[mtf->num_poles].im));
if(n != 2)
gerror("Line `%s' : could not process pole value `%s'. Format must be `+-[real]+-[imag]i' no whitespace and both real and imag must be stated even if 0\n", command_string, a);
mtf->poles[mtf->num_poles+1].re = mtf->poles[mtf->num_poles].re;
mtf->poles[mtf->num_poles+1].im = -mtf->poles[mtf->num_poles].im;
if(n != 2) {
gerror("Line `%s' : could not process pole value `%s'. Format must be `+-[real]+-[imag]i' no whitespace and both real and imag must be stated even if 0\n", command_string, a);
}
a = strtok(NULL, ",");
mtf->num_poles++;
mtf->num_poles += 2;
}
}
......@@ -1438,17 +1443,22 @@ void read_general_mech_transfer_function(const char *command_string){
a = strtok(tmp, ",");
while(a != NULL){
if(mtf->num_zeros >= MAX_POLES_ZEROS)
gerror("Line `%s': Exceeded maximum number of zeros (%i)\n", command_string, MAX_POLES_ZEROS);
if(mtf->num_zeros >= MAX_POLES_ZEROS) {
gerror("Line `%s': Exceeded maximum number of zeros (%i)\n", command_string, MAX_POLES_ZEROS);
}
n = sscanf(a, "%lf%lfi", &(mtf->zeros[mtf->num_zeros].re), &(mtf->zeros[mtf->num_zeros].im));
n = sscanf(a, "%lf%lfi", &(mtf->zeros[mtf->num_zeros].re), &(mtf->zeros[mtf->num_zeros].im));
mtf->zeros[mtf->num_zeros+1].re = mtf->zeros[mtf->num_zeros].re;
mtf->zeros[mtf->num_zeros+1].im = -mtf->zeros[mtf->num_zeros].im;
if(n != 2) {
gerror("Line `%s': could not process zeros value `%s`. Format must be `+-[real]+-[imag]i` no whitespace and both real and imag must be stated \n", command_string, a);
}
if(n != 2)
gerror("Line `%s': could not process zeros value `%s`. Format must be `+-[real]+-[imag]i` no whitespace and both real and imag must be stated \n", command_string, a);
a = strtok(NULL, ",");
mtf->num_zeros++;
mtf->num_zeros += 2;
}
}
......@@ -7697,15 +7707,19 @@ int get_attribute_type(const char *parameter_name,
strcasecmp("Mass", parameter_name) == 0) {
attribute_type = MASS;
} else if (strcasecmp("ix", parameter_name) == 0 ||
strcasecmp("moix", parameter_name) == 0) {
strcasecmp("moix", parameter_name) == 0||
strcasecmp("iyaw", parameter_name) == 0)) {
attribute_type = MOIX;
} else if (strcasecmp("iy", parameter_name) == 0 ||
strcasecmp("moiy", parameter_name) == 0) {
strcasecmp("moiy", parameter_name) == 0 ||
strcasecmp("ipitch", parameter_name) == 0) {
attribute_type = MOIY;
} else if (strcasecmp("xbeta", parameter_name) == 0 ||
strcasecmp("yaw", parameter_name) == 0 ||
strcasecmp("xBeta", parameter_name) == 0) {
attribute_type = XANGLE;
} else if (strcasecmp("ybeta", parameter_name) == 0 ||
strcasecmp("pitch", parameter_name) == 0 ||
strcasecmp("yBeta", parameter_name) == 0) {
attribute_type = YANGLE;
} else if (strcasecmp("gx", parameter_name) == 0 ||
......@@ -7735,9 +7749,11 @@ int get_attribute_type(const char *parameter_name,
} else if (strncasecmp("mech", parameter_name, 4) == 0 ||
strncasecmp("zmech", parameter_name, 5) == 0) {
attribute_type = MECH_TF;
} else if (strncasecmp("rxmech", parameter_name, 6) == 0) {
} else if (strncasecmp("rxmech", parameter_name, 6) == 0 ||
strncasecmp("yawmech", parameter_name, 7) == 0) {
attribute_type = MECH_RX_TF;
} else if (strncasecmp("rymech", parameter_name, 6) == 0) {
} else if (strncasecmp("rymech", parameter_name, 6) == 0 ||
strncasecmp("pitchmech", parameter_name, 9) == 0 ) {
attribute_type = MECH_RY_TF;
} else if (strncasecmp("homangle", parameter_name, 8) == 0) {
attribute_type = HOM_ANGLE;
......
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