104 lines
3.0 KiB
Plaintext
104 lines
3.0 KiB
Plaintext
PROGRAM VFD_ConfigMap
|
|
IF VFD_Read THEN
|
|
(* Nameplate HP *)
|
|
VFD_R_NPHP(TRUE, VFD_IPAddress, 500, 37);
|
|
cfg_NameplateHP := ANY_TO_REAL(VFD_R_NPHP.ParameterValue) / 100.0;
|
|
|
|
(* Nameplate FLA *)
|
|
VFD_R_NPFLA(TRUE, VFD_IPAddress, 500, 34);
|
|
cfg_NameplateFLA := ANY_TO_REAL(VFD_R_NPFLA.ParameterValue) / 10.0;
|
|
|
|
(* Nameplate Volts *)
|
|
VFD_R_NPVolts(TRUE, VFD_IPAddress, 500, 31);
|
|
cfg_NameplateVolts := ANY_TO_REAL(VFD_R_NPVolts.ParameterValue);
|
|
|
|
(* Nameplate Hertz *)
|
|
VFD_R_NPHz(TRUE, VFD_IPAddress, 500, 32);
|
|
cfg_NameplateHz := ANY_TO_REAL(VFD_R_NPHz.ParameterValue) / 10.0;
|
|
|
|
(* Nameplate RPM *)
|
|
VFD_R_NPRPM(TRUE, VFD_IPAddress, 500, 36);
|
|
cfg_NameplateRPM := ANY_TO_REAL(VFD_R_NPRPM.ParameterValue);
|
|
|
|
(* Nameplate OL Current *)
|
|
VFD_R_NPOLCurrent(TRUE, VFD_IPAddress, 500, 33);
|
|
cfg_NameplateOLCurrent := ANY_TO_REAL(VFD_R_NPOLCurrent.ParameterValue) / 10.0;
|
|
|
|
(* Motor Poles *)
|
|
VFD_R_MotorPoles(TRUE, VFD_IPAddress, 500, 35);
|
|
cfg_MotorPoles := VFD_R_MotorPoles.ParameterValue;
|
|
|
|
(* Max Frequency *)
|
|
VFD_R_MaxFreq(TRUE, VFD_IPAddress, 500, 44);
|
|
cfg_MaxFreq := ANY_TO_REAL(VFD_R_MaxFreq.ParameterValue) / 100.0;
|
|
|
|
(* Min Frequency *)
|
|
VFD_R_MinFreq(TRUE, VFD_IPAddress, 500, 43);
|
|
cfg_MinFreq := ANY_TO_REAL(VFD_R_MinFreq.ParameterValue) / 100.0;
|
|
|
|
(* Stop Mode [HARD CODED TO COAST] *)
|
|
VFD_R_StopMode(TRUE, VFD_IPAddress, 500, 45);
|
|
cfg_StopMode := VFD_R_StopMode.ParameterValue;
|
|
|
|
(* Torque Perf Mode [HARD CODED TO V/Hz] *)
|
|
VFD_R_TorquePerfMode(TRUE, VFD_IPAddress, 500, 39);
|
|
cfg_TorquePerfMode := VFD_R_TorquePerfMode.ParameterValue;
|
|
|
|
IF VFD_readTimer.Q THEN
|
|
VFD_read := FALSE;
|
|
END_IF;
|
|
END_IF;
|
|
|
|
|
|
IF VFD_Write THEN
|
|
(* Nameplate HP *)
|
|
temp_nphp := ANY_TO_UINT(cfg_NameplateHP * 100.0);
|
|
VFD_W_NPHP(TRUE, VFD_IPAddress, 3, 37, temp_nphp);
|
|
|
|
(* Nameplate FLA *)
|
|
temp_fla := ANY_TO_UINT(cfg_NameplateFLA * 10.0);
|
|
VFD_W_NPFLA(TRUE, VFD_IPAddress, 3, 34, temp_fla);
|
|
|
|
(* Nameplate Volts *)
|
|
temp_volts := ANY_TO_UINT(cfg_NameplateVolts);
|
|
VFD_W_NPVolts(TRUE, VFD_IPAddress, 3, 31, temp_volts);
|
|
|
|
(* Nameplate Hertz *)
|
|
temp_hz :=ANY_TO_UINT(cfg_NameplateHz * 10.0);
|
|
VFD_W_NPHz(TRUE, VFD_IPAddress, 3, 32, temp_hz);
|
|
|
|
(* Nameplate RPM *)
|
|
temp_rpm := ANY_TO_UINT(cfg_NameplateRPM);
|
|
VFD_W_NPRPM(TRUE, VFD_IPAddress, 3, 36,temp_rpm);
|
|
|
|
(* Nameplate OL Current *)
|
|
temp_olcurrent := ANY_TO_UINT(cfg_NameplateOLCurrent * 10.0);
|
|
VFD_W_NPOLCurrent(TRUE, VFD_IPAddress, 3, 33, temp_olcurrent);
|
|
|
|
(* Motor Poles *)
|
|
VFD_W_MotorPoles(TRUE, VFD_IPAddress, 3, 35, cfg_MotorPoles);
|
|
|
|
(* Max Frequency *)
|
|
temp_maxfreq := ANY_TO_UINT(cfg_MaxFreq * 100.0);
|
|
VFD_W_MaxFreq(TRUE, VFD_IPAddress, 3, 44, temp_maxfreq);
|
|
|
|
(* Min Frequency *)
|
|
temp_minfreq := ANY_TO_UINT(cfg_MinFreq * 100.0);
|
|
VFD_W_MinFreq(TRUE, VFD_IPAddress, 3, 43, temp_minfreq);
|
|
|
|
(* Stop Mode [HARD CODE TO COAST] *)
|
|
VFD_W_StopMode(TRUE, VFD_IPAddress, 3, 45, 1);
|
|
|
|
(* Torque Perf Mode [HARD COAD TO V/Hz] *)
|
|
VFD_W_TorquePerfMode(TRUE, VFD_IPAddress, 3, 39, 0);
|
|
|
|
|
|
IF VFD_WriteTimer.Q THEN
|
|
VFD_Write := FALSE;
|
|
END_IF;
|
|
END_IF;
|
|
|
|
VFD_WriteTimer(VFD_Write, VFD_RW_Time);
|
|
VFD_ReadTimer(VFD_Read, VFD_RW_Time);
|
|
|
|
END_PROGRAM |