15 #include "userflowcontroller.h"
18 REGISTER_TYPE(
XDriverList, FCST1000,
"Fujikin FCST1000 Series Mass Flow Controllers");
20 XFCST1000::XFCST1000(
const char *name,
bool runtime,
21 Transaction &tr_meas,
const shared_ptr<XMeasure> &meas) :
23 interface()->setSerialBaudRate(38400);
24 interface()->setSerialStopBits(1);
25 interface()->setSerialParity(XCharInterface::PARITY_NONE);
29 XString unit = interface()->query<
XString>(GasCalibrationClass, 1, 0x03);
30 return (unit ==
"SLM");
33 XFCST1000::isController() {
34 unsigned int type = interface()->query<uint8_t>(ValveDriverClass, 1, 0xa0);
41 return interface()->query<uint16_t>(GasCalibrationClass, 1, 0x02) * 0.1;
44 XFCST1000::getStatus(
double &flow,
double &valve_v,
bool &alarm,
bool &warning) {
46 flow = interface()->query<uint16_t>(ValveDriverClass, 1, 0xa9);
47 flow = (flow - 0x4000) / 0x8000;
49 valve_v = interface()->query<uint16_t>(ValveDriverClass, 1, 0xb6);
50 valve_v = (valve_v - 0x4000) / 0x8000 * 100.0;
52 int bits = interface()->query<uint8_t>(ExceptionClass, 1, 0xa0);
57 XFCST1000::setValveState(
bool open) {
58 interface()->send(ValveDriverClass, 1, 0x01, open ? (uint8_t)0x02 : (uint8_t)0x01);
61 XFCST1000::changeControl(
bool ctrl) {
63 interface()->send(ValveDriverClass, 1, 0x01, (uint8_t)0x00);
65 interface()->send(FlowControllerClass, 1, 0x03, (uint8_t)0x01);
66 interface()->send(FlowControllerClass, 1, 0x05, (uint8_t)0x01);
69 interface()->send(FlowControllerClass, 1, 0x03, (uint8_t)0x02);
72 XFCST1000::changeSetPoint(
double target) {
74 interface()->send(ValveDriverClass, 1, 0x01, (uint8_t)0x00);
76 target = std::max(0.0, target);
77 target = std::min(1.0, target);
78 uint16_t x = lrint(target * 0x8000 + 0x4000);
79 interface()->send(FlowControllerClass, 1, 0xa4, x);
82 XFCST1000::setRampTime(
double time) {
83 interface()->send(ValveDriverClass, 1, 0xa4, (uint32_t)lrint(time));