Add parameter ctrlthres as switching point for ctrl.

Default is 0.5 V.
This commit is contained in:
Holger Vogt 2025-05-20 22:36:54 +02:00
parent 2ecc63d1a0
commit 9fed0d93d1
2 changed files with 11 additions and 9 deletions

View File

@ -130,6 +130,7 @@ void cm_seegen(ARGS) /* structure holding parms,
double tdelay; /* delay until first pulse */
double inull; /* max. current of pulse */
double tperiod; /* pulse repetition period */
double ctrlthres; /* control voltage threshold */
double ctrl; /* control input */
double out; /* output current */
double *last_t_value; /* static storage of next pulse time */
@ -145,6 +146,7 @@ void cm_seegen(ARGS) /* structure holding parms,
tdelay = PARAM(tdelay);
tperiod = PARAM(tperiod);
inull = PARAM(inull);
ctrlthres = PARAM(ctrlthres);
if (PORT_NULL(ctrl))
ctrl = 1;
@ -169,7 +171,7 @@ void cm_seegen(ARGS) /* structure holding parms,
pulse_number = (int *) STATIC_VAR(pulse_number);
last_ctrl = (double *) STATIC_VAR(last_ctrl);
if (*last_ctrl < 0.5 && ctrl >= 0.5) {
if (*last_ctrl < ctrlthres && ctrl >= ctrlthres) {
*last_t_value = *last_t_value + tcurr;
*last_ctrl = ctrl;
}

View File

@ -65,14 +65,14 @@ Null_Allowed: yes yes
PARAMETER_TABLE:
Parameter_Name: tperiod
Description: "pulse repetition"
Data_Type: real
Default_Value: 0
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
Parameter_Name: tperiod ctrlthres
Description: "pulse repetition" "control voltage threshold"
Data_Type: real real
Default_Value: 0 0.5
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
STATIC_VAR_TABLE: