Moved SetupTime and pulseLength to sdos.

This commit is contained in:
MetalMusings
2025-10-22 17:18:02 +02:00
parent a6b70bf6c6
commit 9cc9a41ea2
6 changed files with 206 additions and 185 deletions

View File

@@ -101,7 +101,7 @@
</DataType>
<DataType>
<Name>DT1601</Name>
<BitSize>240</BitSize>
<BitSize>208</BitSize>
<SubItem>
<SubIdx>0</SubIdx>
<Name>Max SubIndex</Name>
@@ -154,7 +154,7 @@
</SubItem>
<SubItem>
<SubIdx>5</SubIdx>
<Name>OhmicSensingSetupTime</Name>
<Name>OhmicSensingVoltageLimit</Name>
<Type>UDINT</Type>
<BitSize>32</BitSize>
<BitOffs>144</BitOffs>
@@ -164,20 +164,10 @@
</SubItem>
<SubItem>
<SubIdx>6</SubIdx>
<Name>OhmicSensingVoltageLimit</Name>
<Type>UDINT</Type>
<BitSize>32</BitSize>
<BitOffs>176</BitOffs>
<Flags>
<Access>ro</Access>
</Flags>
</SubItem>
<SubItem>
<SubIdx>7</SubIdx>
<Name>OhmicSensingVoltageDrop</Name>
<Type>UDINT</Type>
<BitSize>32</BitSize>
<BitOffs>208</BitOffs>
<BitOffs>176</BitOffs>
<Flags>
<Access>ro</Access>
</Flags>
@@ -185,7 +175,7 @@
</DataType>
<DataType>
<Name>DT1602</Name>
<BitSize>240</BitSize>
<BitSize>208</BitSize>
<SubItem>
<SubIdx>0</SubIdx>
<Name>Max SubIndex</Name>
@@ -238,7 +228,7 @@
</SubItem>
<SubItem>
<SubIdx>5</SubIdx>
<Name>OhmicSensingSetupTime</Name>
<Name>OhmicSensingVoltageLimit</Name>
<Type>UDINT</Type>
<BitSize>32</BitSize>
<BitOffs>144</BitOffs>
@@ -248,20 +238,10 @@
</SubItem>
<SubItem>
<SubIdx>6</SubIdx>
<Name>OhmicSensingVoltageLimit</Name>
<Type>UDINT</Type>
<BitSize>32</BitSize>
<BitOffs>176</BitOffs>
<Flags>
<Access>ro</Access>
</Flags>
</SubItem>
<SubItem>
<SubIdx>7</SubIdx>
<Name>OhmicSensingVoltageDrop</Name>
<Type>UDINT</Type>
<BitSize>32</BitSize>
<BitOffs>208</BitOffs>
<BitOffs>176</BitOffs>
<Flags>
<Access>ro</Access>
</Flags>
@@ -517,7 +497,7 @@
</DataType>
<DataType>
<Name>DT2000</Name>
<BitSize>64</BitSize>
<BitSize>96</BitSize>
<SubItem>
<SubIdx>0</SubIdx>
<Name>Max SubIndex</Name>
@@ -558,10 +538,30 @@
<Access WriteRestrictions="PreOP">rw</Access>
</Flags>
</SubItem>
<SubItem>
<SubIdx>4</SubIdx>
<Name>OhmicSensingSetupTime</Name>
<Type>UINT</Type>
<BitSize>16</BitSize>
<BitOffs>64</BitOffs>
<Flags>
<Access WriteRestrictions="PreOP">rw</Access>
</Flags>
</SubItem>
<SubItem>
<SubIdx>5</SubIdx>
<Name>OhmicSensingPulseLength</Name>
<Type>UINT</Type>
<BitSize>16</BitSize>
<BitOffs>80</BitOffs>
<Flags>
<Access WriteRestrictions="PreOP">rw</Access>
</Flags>
</SubItem>
</DataType>
<DataType>
<Name>DT2001</Name>
<BitSize>64</BitSize>
<BitSize>96</BitSize>
<SubItem>
<SubIdx>0</SubIdx>
<Name>Max SubIndex</Name>
@@ -602,6 +602,26 @@
<Access WriteRestrictions="PreOP">rw</Access>
</Flags>
</SubItem>
<SubItem>
<SubIdx>4</SubIdx>
<Name>OhmicSensingSetupTime</Name>
<Type>UINT</Type>
<BitSize>16</BitSize>
<BitOffs>64</BitOffs>
<Flags>
<Access WriteRestrictions="PreOP">rw</Access>
</Flags>
</SubItem>
<SubItem>
<SubIdx>5</SubIdx>
<Name>OhmicSensingPulseLength</Name>
<Type>UINT</Type>
<BitSize>16</BitSize>
<BitOffs>80</BitOffs>
<Flags>
<Access WriteRestrictions="PreOP">rw</Access>
</Flags>
</SubItem>
</DataType>
<DataType>
<Name>DT6001</Name>
@@ -743,7 +763,7 @@
</DataType>
<DataType>
<Name>DT7001</Name>
<BitSize>216</BitSize>
<BitSize>184</BitSize>
<SubItem>
<SubIdx>0</SubIdx>
<Name>Max SubIndex</Name>
@@ -800,8 +820,8 @@
</SubItem>
<SubItem>
<SubIdx>5</SubIdx>
<Name>OhmicSensingSetupTime</Name>
<Type>UDINT</Type>
<Name>OhmicSensingVoltageLimit</Name>
<Type>REAL</Type>
<BitSize>32</BitSize>
<BitOffs>120</BitOffs>
<Flags>
@@ -811,21 +831,10 @@
</SubItem>
<SubItem>
<SubIdx>6</SubIdx>
<Name>OhmicSensingVoltageLimit</Name>
<Type>REAL</Type>
<BitSize>32</BitSize>
<BitOffs>152</BitOffs>
<Flags>
<Access WriteRestrictions="PreOP">ro</Access>
<PdoMapping>R</PdoMapping>
</Flags>
</SubItem>
<SubItem>
<SubIdx>7</SubIdx>
<Name>OhmicSensingVoltageDrop</Name>
<Type>REAL</Type>
<BitSize>32</BitSize>
<BitOffs>184</BitOffs>
<BitOffs>152</BitOffs>
<Flags>
<Access WriteRestrictions="PreOP">ro</Access>
<PdoMapping>R</PdoMapping>
@@ -834,7 +843,7 @@
</DataType>
<DataType>
<Name>DT7002</Name>
<BitSize>216</BitSize>
<BitSize>184</BitSize>
<SubItem>
<SubIdx>0</SubIdx>
<Name>Max SubIndex</Name>
@@ -891,8 +900,8 @@
</SubItem>
<SubItem>
<SubIdx>5</SubIdx>
<Name>OhmicSensingSetupTime</Name>
<Type>UDINT</Type>
<Name>OhmicSensingVoltageLimit</Name>
<Type>REAL</Type>
<BitSize>32</BitSize>
<BitOffs>120</BitOffs>
<Flags>
@@ -902,21 +911,10 @@
</SubItem>
<SubItem>
<SubIdx>6</SubIdx>
<Name>OhmicSensingVoltageLimit</Name>
<Type>REAL</Type>
<BitSize>32</BitSize>
<BitOffs>152</BitOffs>
<Flags>
<Access WriteRestrictions="PreOP">ro</Access>
<PdoMapping>R</PdoMapping>
</Flags>
</SubItem>
<SubItem>
<SubIdx>7</SubIdx>
<Name>OhmicSensingVoltageDrop</Name>
<Type>REAL</Type>
<BitSize>32</BitSize>
<BitOffs>184</BitOffs>
<BitOffs>152</BitOffs>
<Flags>
<Access WriteRestrictions="PreOP">ro</Access>
<PdoMapping>R</PdoMapping>
@@ -1069,12 +1067,12 @@
<Index>#x1601</Index>
<Name>In_Unit1</Name>
<Type>DT1601</Type>
<BitSize>240</BitSize>
<BitSize>208</BitSize>
<Info>
<SubItem>
<Name>Max SubIndex</Name>
<Info>
<DefaultValue>7</DefaultValue>
<DefaultValue>6</DefaultValue>
</Info>
</SubItem>
<SubItem>
@@ -1102,21 +1100,15 @@
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingSetupTime</Name>
<Name>OhmicSensingVoltageLimit</Name>
<Info>
<DefaultValue>#x70010520</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingVoltageLimit</Name>
<Info>
<DefaultValue>#x70010620</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingVoltageDrop</Name>
<Info>
<DefaultValue>#x70010720</DefaultValue>
<DefaultValue>#x70010620</DefaultValue>
</Info>
</SubItem>
</Info>
@@ -1127,12 +1119,12 @@
<Index>#x1602</Index>
<Name>In_Unit2</Name>
<Type>DT1602</Type>
<BitSize>240</BitSize>
<BitSize>208</BitSize>
<Info>
<SubItem>
<Name>Max SubIndex</Name>
<Info>
<DefaultValue>7</DefaultValue>
<DefaultValue>6</DefaultValue>
</Info>
</SubItem>
<SubItem>
@@ -1160,21 +1152,15 @@
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingSetupTime</Name>
<Name>OhmicSensingVoltageLimit</Name>
<Info>
<DefaultValue>#x70020520</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingVoltageLimit</Name>
<Info>
<DefaultValue>#x70020620</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingVoltageDrop</Name>
<Info>
<DefaultValue>#x70020720</DefaultValue>
<DefaultValue>#x70020620</DefaultValue>
</Info>
</SubItem>
</Info>
@@ -1407,12 +1393,12 @@
<Index>#x2000</Index>
<Name>Settings_Unit1</Name>
<Type>DT2000</Type>
<BitSize>64</BitSize>
<BitSize>96</BitSize>
<Info>
<SubItem>
<Name>Max SubIndex</Name>
<Info>
<DefaultValue>3</DefaultValue>
<DefaultValue>5</DefaultValue>
</Info>
</SubItem>
<SubItem>
@@ -1433,6 +1419,18 @@
<DefaultValue>0</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingSetupTime</Name>
<Info>
<DefaultValue>100</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingPulseLength</Name>
<Info>
<DefaultValue>5</DefaultValue>
</Info>
</SubItem>
</Info>
<Flags>
</Flags>
@@ -1441,12 +1439,12 @@
<Index>#x2001</Index>
<Name>Settings_Unit2</Name>
<Type>DT2001</Type>
<BitSize>64</BitSize>
<BitSize>96</BitSize>
<Info>
<SubItem>
<Name>Max SubIndex</Name>
<Info>
<DefaultValue>3</DefaultValue>
<DefaultValue>5</DefaultValue>
</Info>
</SubItem>
<SubItem>
@@ -1467,6 +1465,18 @@
<DefaultValue>0</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingSetupTime</Name>
<Info>
<DefaultValue>100</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingPulseLength</Name>
<Info>
<DefaultValue>5</DefaultValue>
</Info>
</SubItem>
</Info>
<Flags>
</Flags>
@@ -1593,12 +1603,12 @@
<Index>#x7001</Index>
<Name>In_Unit1</Name>
<Type>DT7001</Type>
<BitSize>216</BitSize>
<BitSize>184</BitSize>
<Info>
<SubItem>
<Name>Max SubIndex</Name>
<Info>
<DefaultValue>7</DefaultValue>
<DefaultValue>6</DefaultValue>
</Info>
</SubItem>
<SubItem>
@@ -1625,12 +1635,6 @@
<DefaultValue>0</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingSetupTime</Name>
<Info>
<DefaultValue>0</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingVoltageLimit</Name>
<Info>
@@ -1651,12 +1655,12 @@
<Index>#x7002</Index>
<Name>In_Unit2</Name>
<Type>DT7002</Type>
<BitSize>216</BitSize>
<BitSize>184</BitSize>
<Info>
<SubItem>
<Name>Max SubIndex</Name>
<Info>
<DefaultValue>7</DefaultValue>
<DefaultValue>6</DefaultValue>
</Info>
</SubItem>
<SubItem>
@@ -1683,12 +1687,6 @@
<DefaultValue>0</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingSetupTime</Name>
<Info>
<DefaultValue>0</DefaultValue>
</Info>
</SubItem>
<SubItem>
<Name>OhmicSensingVoltageLimit</Name>
<Info>
@@ -1761,19 +1759,12 @@
<Index>#x7001</Index>
<SubIndex>#x5</SubIndex>
<BitLen>32</BitLen>
<Name>OhmicSensingSetupTime</Name>
<DataType>UDINT</DataType>
</Entry>
<Entry>
<Index>#x7001</Index>
<SubIndex>#x6</SubIndex>
<BitLen>32</BitLen>
<Name>OhmicSensingVoltageLimit</Name>
<DataType>REAL</DataType>
</Entry>
<Entry>
<Index>#x7001</Index>
<SubIndex>#x7</SubIndex>
<SubIndex>#x6</SubIndex>
<BitLen>32</BitLen>
<Name>OhmicSensingVoltageDrop</Name>
<DataType>REAL</DataType>
@@ -1814,19 +1805,12 @@
<Index>#x7002</Index>
<SubIndex>#x5</SubIndex>
<BitLen>32</BitLen>
<Name>OhmicSensingSetupTime</Name>
<DataType>UDINT</DataType>
</Entry>
<Entry>
<Index>#x7002</Index>
<SubIndex>#x6</SubIndex>
<BitLen>32</BitLen>
<Name>OhmicSensingVoltageLimit</Name>
<DataType>REAL</DataType>
</Entry>
<Entry>
<Index>#x7002</Index>
<SubIndex>#x7</SubIndex>
<SubIndex>#x6</SubIndex>
<BitLen>32</BitLen>
<Name>OhmicSensingVoltageDrop</Name>
<DataType>REAL</DataType>

View File

@@ -33,7 +33,7 @@
#define SM3_smc 0x20
#define SM3_act 1
#define MAX_MAPPINGS_SM2 15
#define MAX_MAPPINGS_SM2 13
#define MAX_MAPPINGS_SM3 11
#define MAX_RXPDO_SIZE 512

View File

@@ -62,6 +62,20 @@
"value": "0",
"access": "RW",
"data": "&Obj.Settings_Unit1.LowpassFilterPoleFrequency"
},
{
"name": "OhmicSensingSetupTime",
"dtype": "UNSIGNED16",
"value": "100",
"access": "RW",
"data": "&Obj.Settings_Unit1.OhmicSensingSetupTime"
},
{
"name": "OhmicSensingPulseLength",
"dtype": "UNSIGNED16",
"value": "5",
"access": "RW",
"data": "&Obj.Settings_Unit1.OhmicSensingPulseLength"
}
],
"isSDOitem": true
@@ -94,6 +108,20 @@
"value": "0",
"access": "RW",
"data": "&Obj.Settings_Unit2.LowpassFilterPoleFrequency"
},
{
"name": "OhmicSensingSetupTime",
"dtype": "UNSIGNED16",
"value": "100",
"access": "RW",
"data": "&Obj.Settings_Unit2.OhmicSensingSetupTime"
},
{
"name": "OhmicSensingPulseLength",
"dtype": "UNSIGNED16",
"value": "5",
"access": "RW",
"data": "&Obj.Settings_Unit2.OhmicSensingPulseLength"
}
],
"isSDOitem": true
@@ -281,13 +309,6 @@
"access": "RO",
"data": "&Obj.In_Unit1.EnableOhmicSensing"
},
{
"name": "OhmicSensingSetupTime",
"dtype": "UNSIGNED32",
"value": "0",
"access": "RO",
"data": "&Obj.In_Unit1.OhmicSensingSetupTime"
},
{
"name": "OhmicSensingVoltageLimit",
"dtype": "REAL32",
@@ -343,13 +364,6 @@
"access": "RO",
"data": "&Obj.In_Unit2.EnableOhmicSensing"
},
{
"name": "OhmicSensingSetupTime",
"dtype": "UNSIGNED32",
"value": "0",
"access": "RO",
"data": "&Obj.In_Unit2.OhmicSensingSetupTime"
},
{
"name": "OhmicSensingVoltageLimit",
"dtype": "REAL32",

View File

@@ -22,18 +22,16 @@ static const char acName1601_01[] = "VoltageScale";
static const char acName1601_02[] = "VoltageOffset";
static const char acName1601_03[] = "LowPassFilterThresholdVoltage";
static const char acName1601_04[] = "EnableOhmicSensing";
static const char acName1601_05[] = "OhmicSensingSetupTime";
static const char acName1601_06[] = "OhmicSensingVoltageLimit";
static const char acName1601_07[] = "OhmicSensingVoltageDrop";
static const char acName1601_05[] = "OhmicSensingVoltageLimit";
static const char acName1601_06[] = "OhmicSensingVoltageDrop";
static const char acName1602[] = "In_Unit2";
static const char acName1602_00[] = "Max SubIndex";
static const char acName1602_01[] = "VoltageScale";
static const char acName1602_02[] = "VoltageOffset";
static const char acName1602_03[] = "LowPassFilterThresholdVoltage";
static const char acName1602_04[] = "EnableOhmicSensing";
static const char acName1602_05[] = "OhmicSensingSetupTime";
static const char acName1602_06[] = "OhmicSensingVoltageLimit";
static const char acName1602_07[] = "OhmicSensingVoltageDrop";
static const char acName1602_05[] = "OhmicSensingVoltageLimit";
static const char acName1602_06[] = "OhmicSensingVoltageDrop";
static const char acName1A00[] = "Input12";
static const char acName1A00_00[] = "Max SubIndex";
static const char acName1A00_01[] = "Input12";
@@ -72,11 +70,15 @@ static const char acName2000_00[] = "Max SubIndex";
static const char acName2000_01[] = "I2C_devicetype";
static const char acName2000_02[] = "I2C_address";
static const char acName2000_03[] = "LowpassFilterPoleFrequency";
static const char acName2000_04[] = "OhmicSensingSetupTime";
static const char acName2000_05[] = "OhmicSensingPulseLength";
static const char acName2001[] = "Settings_Unit2";
static const char acName2001_00[] = "Max SubIndex";
static const char acName2001_01[] = "I2C_devicetype";
static const char acName2001_02[] = "I2C_address";
static const char acName2001_03[] = "LowpassFilterPoleFrequency";
static const char acName2001_04[] = "OhmicSensingSetupTime";
static const char acName2001_05[] = "OhmicSensingPulseLength";
static const char acName6000[] = "Input12";
static const char acName6001[] = "Out_Unit1";
static const char acName6001_00[] = "Max SubIndex";
@@ -99,18 +101,16 @@ static const char acName7001_01[] = "VoltageScale";
static const char acName7001_02[] = "VoltageOffset";
static const char acName7001_03[] = "LowPassFilterThresholdVoltage";
static const char acName7001_04[] = "EnableOhmicSensing";
static const char acName7001_05[] = "OhmicSensingSetupTime";
static const char acName7001_06[] = "OhmicSensingVoltageLimit";
static const char acName7001_07[] = "OhmicSensingVoltageDrop";
static const char acName7001_05[] = "OhmicSensingVoltageLimit";
static const char acName7001_06[] = "OhmicSensingVoltageDrop";
static const char acName7002[] = "In_Unit2";
static const char acName7002_00[] = "Max SubIndex";
static const char acName7002_01[] = "VoltageScale";
static const char acName7002_02[] = "VoltageOffset";
static const char acName7002_03[] = "LowPassFilterThresholdVoltage";
static const char acName7002_04[] = "EnableOhmicSensing";
static const char acName7002_05[] = "OhmicSensingSetupTime";
static const char acName7002_06[] = "OhmicSensingVoltageLimit";
static const char acName7002_07[] = "OhmicSensingVoltageDrop";
static const char acName7002_05[] = "OhmicSensingVoltageLimit";
static const char acName7002_06[] = "OhmicSensingVoltageDrop";
const _objd SDO1000[] =
{
@@ -143,25 +143,23 @@ const _objd SDO1600[] =
};
const _objd SDO1601[] =
{
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1601_00, 7, NULL},
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1601_00, 6, NULL},
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1601_01, 0x70010120, NULL},
{0x02, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1601_02, 0x70010220, NULL},
{0x03, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1601_03, 0x70010320, NULL},
{0x04, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1601_04, 0x70010408, NULL},
{0x05, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1601_05, 0x70010520, NULL},
{0x06, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1601_06, 0x70010620, NULL},
{0x07, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1601_07, 0x70010720, NULL},
};
const _objd SDO1602[] =
{
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1602_00, 7, NULL},
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1602_00, 6, NULL},
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1602_01, 0x70020120, NULL},
{0x02, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1602_02, 0x70020220, NULL},
{0x03, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1602_03, 0x70020320, NULL},
{0x04, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1602_04, 0x70020408, NULL},
{0x05, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1602_05, 0x70020520, NULL},
{0x06, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1602_06, 0x70020620, NULL},
{0x07, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1602_07, 0x70020720, NULL},
};
const _objd SDO1A00[] =
{
@@ -210,17 +208,21 @@ const _objd SDO1C13[] =
};
const _objd SDO2000[] =
{
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName2000_00, 3, NULL},
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName2000_00, 5, NULL},
{0x01, DTYPE_UNSIGNED8, 8, ATYPE_RW, acName2000_01, 0, &Obj.Settings_Unit1.I2C_devicetype},
{0x02, DTYPE_UNSIGNED8, 8, ATYPE_RW, acName2000_02, 0, &Obj.Settings_Unit1.I2C_address},
{0x03, DTYPE_UNSIGNED32, 32, ATYPE_RW, acName2000_03, 0, &Obj.Settings_Unit1.LowpassFilterPoleFrequency},
{0x04, DTYPE_UNSIGNED16, 16, ATYPE_RW, acName2000_04, 100, &Obj.Settings_Unit1.OhmicSensingSetupTime},
{0x05, DTYPE_UNSIGNED16, 16, ATYPE_RW, acName2000_05, 5, &Obj.Settings_Unit1.OhmicSensingPulseLength},
};
const _objd SDO2001[] =
{
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName2001_00, 3, NULL},
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName2001_00, 5, NULL},
{0x01, DTYPE_UNSIGNED8, 8, ATYPE_RW, acName2001_01, 0, &Obj.Settings_Unit2.I2C_devicetype},
{0x02, DTYPE_UNSIGNED8, 8, ATYPE_RW, acName2001_02, 0, &Obj.Settings_Unit2.I2C_address},
{0x03, DTYPE_UNSIGNED32, 32, ATYPE_RW, acName2001_03, 0, &Obj.Settings_Unit2.LowpassFilterPoleFrequency},
{0x04, DTYPE_UNSIGNED16, 16, ATYPE_RW, acName2001_04, 100, &Obj.Settings_Unit2.OhmicSensingSetupTime},
{0x05, DTYPE_UNSIGNED16, 16, ATYPE_RW, acName2001_05, 5, &Obj.Settings_Unit2.OhmicSensingPulseLength},
};
const _objd SDO6000[] =
{
@@ -250,25 +252,23 @@ const _objd SDO7000[] =
};
const _objd SDO7001[] =
{
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName7001_00, 7, NULL},
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName7001_00, 6, NULL},
{0x01, DTYPE_REAL32, 32, ATYPE_RO, acName7001_01, 0x00000000, &Obj.In_Unit1.VoltageScale},
{0x02, DTYPE_REAL32, 32, ATYPE_RO, acName7001_02, 0x00000000, &Obj.In_Unit1.VoltageOffset},
{0x03, DTYPE_REAL32, 32, ATYPE_RO, acName7001_03, 0x00000000, &Obj.In_Unit1.LowPassFilterThresholdVoltage},
{0x04, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName7001_04, 0, &Obj.In_Unit1.EnableOhmicSensing},
{0x05, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName7001_05, 0, &Obj.In_Unit1.OhmicSensingSetupTime},
{0x06, DTYPE_REAL32, 32, ATYPE_RO, acName7001_06, 0x00000000, &Obj.In_Unit1.OhmicSensingVoltageLimit},
{0x07, DTYPE_REAL32, 32, ATYPE_RO, acName7001_07, 0x00000000, &Obj.In_Unit1.OhmicSensingVoltageDrop},
{0x05, DTYPE_REAL32, 32, ATYPE_RO, acName7001_05, 0x00000000, &Obj.In_Unit1.OhmicSensingVoltageLimit},
{0x06, DTYPE_REAL32, 32, ATYPE_RO, acName7001_06, 0x00000000, &Obj.In_Unit1.OhmicSensingVoltageDrop},
};
const _objd SDO7002[] =
{
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName7002_00, 7, NULL},
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName7002_00, 6, NULL},
{0x01, DTYPE_REAL32, 32, ATYPE_RO, acName7002_01, 0x00000000, &Obj.In_Unit2.VoltageScale},
{0x02, DTYPE_REAL32, 32, ATYPE_RO, acName7002_02, 0x00000000, &Obj.In_Unit2.VoltageOffset},
{0x03, DTYPE_REAL32, 32, ATYPE_RO, acName7002_03, 0x00000000, &Obj.In_Unit2.LowPassFilterThresholdVoltage},
{0x04, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName7002_04, 0, &Obj.In_Unit2.EnableOhmicSensing},
{0x05, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName7002_05, 0, &Obj.In_Unit2.OhmicSensingSetupTime},
{0x06, DTYPE_REAL32, 32, ATYPE_RO, acName7002_06, 0x00000000, &Obj.In_Unit2.OhmicSensingVoltageLimit},
{0x07, DTYPE_REAL32, 32, ATYPE_RO, acName7002_07, 0x00000000, &Obj.In_Unit2.OhmicSensingVoltageDrop},
{0x05, DTYPE_REAL32, 32, ATYPE_RO, acName7002_05, 0x00000000, &Obj.In_Unit2.OhmicSensingVoltageLimit},
{0x06, DTYPE_REAL32, 32, ATYPE_RO, acName7002_06, 0x00000000, &Obj.In_Unit2.OhmicSensingVoltageDrop},
};
const _objectlist SDOobjects[] =
@@ -279,21 +279,21 @@ const _objectlist SDOobjects[] =
{0x100A, OTYPE_VAR, 0, 0, acName100A, SDO100A},
{0x1018, OTYPE_RECORD, 4, 0, acName1018, SDO1018},
{0x1600, OTYPE_RECORD, 1, 0, acName1600, SDO1600},
{0x1601, OTYPE_RECORD, 7, 0, acName1601, SDO1601},
{0x1602, OTYPE_RECORD, 7, 0, acName1602, SDO1602},
{0x1601, OTYPE_RECORD, 6, 0, acName1601, SDO1601},
{0x1602, OTYPE_RECORD, 6, 0, acName1602, SDO1602},
{0x1A00, OTYPE_RECORD, 1, 0, acName1A00, SDO1A00},
{0x1A01, OTYPE_RECORD, 5, 0, acName1A01, SDO1A01},
{0x1A02, OTYPE_RECORD, 5, 0, acName1A02, SDO1A02},
{0x1C00, OTYPE_ARRAY, 4, 0, acName1C00, SDO1C00},
{0x1C12, OTYPE_ARRAY, 3, 0, acName1C12, SDO1C12},
{0x1C13, OTYPE_ARRAY, 3, 0, acName1C13, SDO1C13},
{0x2000, OTYPE_RECORD, 3, 0, acName2000, SDO2000},
{0x2001, OTYPE_RECORD, 3, 0, acName2001, SDO2001},
{0x2000, OTYPE_RECORD, 5, 0, acName2000, SDO2000},
{0x2001, OTYPE_RECORD, 5, 0, acName2001, SDO2001},
{0x6000, OTYPE_VAR, 0, 0, acName6000, SDO6000},
{0x6001, OTYPE_RECORD, 5, 0, acName6001, SDO6001},
{0x6002, OTYPE_RECORD, 5, 0, acName6002, SDO6002},
{0x7000, OTYPE_VAR, 0, 0, acName7000, SDO7000},
{0x7001, OTYPE_RECORD, 7, 0, acName7001, SDO7001},
{0x7002, OTYPE_RECORD, 7, 0, acName7002, SDO7002},
{0x7001, OTYPE_RECORD, 6, 0, acName7001, SDO7001},
{0x7002, OTYPE_RECORD, 6, 0, acName7002, SDO7002},
{0xffff, 0xff, 0xff, 0xff, NULL, NULL}
};

View File

@@ -40,7 +40,6 @@ typedef struct
float VoltageOffset;
float LowPassFilterThresholdVoltage;
uint8_t EnableOhmicSensing;
uint32_t OhmicSensingSetupTime;
float OhmicSensingVoltageLimit;
float OhmicSensingVoltageDrop;
} In_Unit1;
@@ -50,7 +49,6 @@ typedef struct
float VoltageOffset;
float LowPassFilterThresholdVoltage;
uint8_t EnableOhmicSensing;
uint32_t OhmicSensingSetupTime;
float OhmicSensingVoltageLimit;
float OhmicSensingVoltageDrop;
} In_Unit2;
@@ -62,12 +60,16 @@ typedef struct
uint8_t I2C_devicetype;
uint8_t I2C_address;
uint32_t LowpassFilterPoleFrequency;
uint16_t OhmicSensingSetupTime;
uint16_t OhmicSensingPulseLength;
} Settings_Unit1;
struct
{
uint8_t I2C_devicetype;
uint8_t I2C_address;
uint32_t LowpassFilterPoleFrequency;
uint16_t OhmicSensingSetupTime;
uint16_t OhmicSensingPulseLength;
} Settings_Unit2;
} _Objects;

View File

@@ -45,13 +45,14 @@ void ads1014_reset(ADS1014 *ads) {
class OhmicSensing {
public:
void handle(uint8_t voltageState, float inVoltage, float limitVoltage,
float voltageDropLimit, uint32_t setupTime, uint8_t enabled,
uint8_t &sensed);
float voltageDropLimit, uint32_t setupTime, uint16_t pulseLength,
uint8_t enabled, uint8_t &sensed);
// private:
enum OhmicStates { OHMIC_IDLE, OHMIC_SETUP, OHMIC_PROBE };
enum OhmicStates { OHMIC_IDLE, OHMIC_SETUP, OHMIC_PROBE, OHMIC_PULSE };
OhmicStates ohmicState = OHMIC_IDLE;
uint64_t startTime;
uint64_t contactTime;
float_t oldVoltage = 0.0;
std::queue<float> voltages;
float_t refVoltage;
@@ -126,16 +127,20 @@ void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
Obj.Out_Unit2.CalculatedVoltage,
Obj.Out_Unit2.LowpassFilteredVoltage);
Ohm1.handle(
stat_1, Obj.Out_Unit1.CalculatedVoltage,
Obj.In_Unit1.OhmicSensingVoltageLimit,
Obj.In_Unit1.OhmicSensingVoltageDrop, Obj.In_Unit1.OhmicSensingSetupTime,
Obj.In_Unit1.EnableOhmicSensing, Obj.Out_Unit1.OhmicSensingSensed);
Ohm2.handle(
stat_2, Obj.Out_Unit2.CalculatedVoltage,
Obj.In_Unit2.OhmicSensingVoltageLimit,
Obj.In_Unit2.OhmicSensingVoltageDrop, Obj.In_Unit2.OhmicSensingSetupTime,
Obj.In_Unit2.EnableOhmicSensing, Obj.Out_Unit2.OhmicSensingSensed);
Ohm1.handle(stat_1, Obj.Out_Unit1.CalculatedVoltage,
Obj.In_Unit1.OhmicSensingVoltageLimit,
Obj.In_Unit1.OhmicSensingVoltageDrop,
Obj.Settings_Unit1.OhmicSensingSetupTime,
Obj.Settings_Unit1.OhmicSensingPulseLength,
Obj.In_Unit1.EnableOhmicSensing,
Obj.Out_Unit1.OhmicSensingSensed);
Ohm2.handle(stat_2, Obj.Out_Unit2.CalculatedVoltage,
Obj.In_Unit2.OhmicSensingVoltageLimit,
Obj.In_Unit2.OhmicSensingVoltageDrop,
Obj.Settings_Unit2.OhmicSensingSetupTime,
Obj.Settings_Unit2.OhmicSensingPulseLength,
Obj.In_Unit2.EnableOhmicSensing,
Obj.Out_Unit2.OhmicSensingSensed);
Obj.Out_Unit1.RawData = (int)Ohm2.ohmicState;
}
@@ -370,8 +375,8 @@ void lowpassFilter(float &oldLowPassGain,
#define N_VOLTAGES 3
void OhmicSensing::handle(uint8_t voltageState, float inVoltage,
float limitVoltage, float voltageDropLimit,
uint32_t setupTime, uint8_t enabled,
uint8_t &sensed) {
uint32_t setupTime, uint16_t pulseLength,
uint8_t enabled, uint8_t &sensed) {
sensed = 0;
uint64_t dTime;
Obj.Out_Unit1.RawData = ohmicState;
@@ -381,19 +386,18 @@ void OhmicSensing::handle(uint8_t voltageState, float inVoltage,
startTime = longTime.extendTime(micros());
while (!voltages.empty())
voltages.pop(); // Remove history
return;
}
if (ohmicState == OHMIC_SETUP) {
switch (ohmicState) {
case OHMIC_SETUP:
dTime = longTime.extendTime(micros()) - startTime;
if (dTime > setupTime * 1000) {
ohmicState = OHMIC_PROBE;
startTime = longTime.extendTime(micros());
oldVoltage = 0.0;
refVoltage = inVoltage; // RefVoltage = voltage at end of setup
return;
}
}
if (ohmicState == OHMIC_PROBE) {
break;
case OHMIC_PROBE: {
dTime = longTime.extendTime(micros()) - startTime;
voltages.push(inVoltage);
while (voltages.size() > N_VOLTAGES)
@@ -403,6 +407,7 @@ void OhmicSensing::handle(uint8_t voltageState, float inVoltage,
return;
}
byte c1 = (inVoltage <= limitVoltage) ? 1 : 0; // Below starting threshold
byte c2 = (fabs(voltageDropLimit) > 1e-3 &&
refVoltage - inVoltage >= voltageDropLimit)
? 2
@@ -417,10 +422,26 @@ void OhmicSensing::handle(uint8_t voltageState, float inVoltage,
: 0;
Obj.Out_Unit2.RawData = c1 + c2 + c3 + c4;
if (c1 + c2 + c3 + c4 > 0) {
sensed = 1;
if (pulseLength == 0) { // Real pulse length
sensed = 1;
} else { // Timed pulse length
contactTime = longTime.extendTime(micros());
sensed = 1;
ohmicState = OHMIC_PULSE;
}
}
}
oldVoltage = inVoltage;
return;
break;
case OHMIC_PULSE: // For a pulse with a set length
int dTime = longTime.extendTime(micros()) - contactTime;
if (dTime < pulseLength * 1000) {
sensed = 1;
} else {
sensed = 0;
ohmicState = OHMIC_IDLE;
}
break;
}
} else {
ohmicState = OHMIC_IDLE;