Class celerotonCC75

class celerotonCC75.celerotonCC75(serPort)[source]

Bases: serial.serialwin32.Serial

Class for the celeroton CC75 frequency converter.

The class celerotonCC75 is used for frequency converters of the CC75 series. pyserial is applied for serial communication with the controller. Furthermore, threading is used for the monitoring.

Requires:pyserial (>=2.7)
Parameters:serPort (int or str) – Serial port of controller

Example:

ctCC75_400 = celerotonCC75('COM10')
# Set up a temperature monitoring
monitVar = "temperature"
threshold = 60
ctCC75_400.monitor(monitVar, threshold)
time.sleep(2)
print(ctCC75_400.thread.is_alive())
# Get the reference motor speed
wantedVar = "reference speed"
result = ctCC75_400.readValue(wantedVar)
print("Motor will start with", result, "rpm.")
ctCC75_400.start()
time.sleep(3)
ctCC75_400.stop()
ctCC75_400.close()
ackError(statusCode, statusStr)[source]

Acknowledge an error

The method takes the answered statusCode of the controller and the already found statusStr. The user is asked to acknowledge the error and, if answered with yes, the error is aknowledged.

Parameters:
  • statusCode (bytes) – Complete answer of the controller
  • statusStr (str) – String of the status (for user)
checksum(command)[source]

Computes the checksum

For a given command, which is intended to be sent to the controller, the method computes the checksum

Parameters:command (tuple/list of int, bytes) – Command for the controller
Returns checksum:
 String of the status (for user)
Rtype checksum:int
errCheck(answer)[source]

Takes the answer of the controller and raises error.

Parameters:answer (bytes) – Answer of the controller
getStatus()[source]

Get the current status.

The method demands the current status of the controller. If there is a problem, the funtion tries to use method ackError to clear them.

monitor(varName, threshold)[source]

Monitor a variable and stops motor on threshold.

The method sets up a threading class object and monitors varName until the thread is closed. In case of threspassing the threshold, the motor is stopped and a runtime error is raised. The function creates a Thread instance of class threading.

Parameters:
  • varName (str) – Name of variable to be monitored
  • threshold (int) – Threshold for value
Returns self.thread:
 

Running monitor thread

Rtype self.thread:
 

threading.Thread

readValue(varName)[source]

Read a selected value.

The method reads the value of varName. Currently implemented:

  • “reference speed” in rpm
  • “actual speed” in rpm
  • “temperature” in Celsius
Parameters:varName (str) – Desired value
Returns varValue:
 Actual value
Rtype varValue:int
reset()[source]

Resets the controller.

Because of invalid commands the controller can remain in a faulty state. The method sends 17 zero bits to the controller to clear the command status.

start()[source]

Starts the motor.

stop()[source]

Stops the motor.

writeValue(varName, varValue)[source]

Write a selected value.

The method writes the varValue of varName. Currently implemented:

  • “reference speed” in rpm
  • “actual speed” in rpm
  • “temperature” in Celsius
Parameters:
  • varName (str) – Desired value
  • varValue (int) – Actual value