c语言错误类型的数据类型,C语言,数据类型错误报告

我正在为TI C2000 Piccolo微控制器编写一系列C文件。以下是我的电池充电状态算法示例。 构建时,Code Composer Studio报告“#31表达式必须具有整数类型”的第三行到最后一行出现错误(第二个“discharge_capacity”)呃,受我的经验限制,我无法多作出贡献。你能提供一些帮助吗?谢谢!C语言,数据类型错误报告

#include "F2806x_Device.h"

#include "math.h"

/*Global Variables*/

//float32 SOC; // State of Charge for the entire battery pack

float32 discharge_capacity; // capacity that that has been discharged by the battery determined the curve fitting equation.

/* Inputs*/

int current = 6500; // Input battery stack current in mA.

float32 voltage = 2.5; // Input battery voltage in V. In this case this should be the average of the 27 cells voltage.

/* Assumed Constants */

int capacity = 3250; // in mAh. Minimum Nominal Capacity at 25 degrees Celcius for an individual cell.

/* Curve Fitting Equation Parameters*/

float32 p1 = 3095.00;

float32 p2 = 40090.00;

float32 p3 = 191000.00;

float32 p4 = 398300.00;

float32 p5 = 310900.00;

float32 socPct;

float32 packSoc;

float32 SOC(float32 voltage, float32 current);

float32 voltage_b;

float32 current_b;

int main()

{

float32 packSoc = SOC(voltage, current); // Average state of charge for each cell in the batter pack.

//printf(packSoc);

}

float32 SOC(float32 voltage_b, float32 current_b)

{

/* Purpose of this code is to receive the (1) average cell voltage

* for all 27 cells and (2) current running through all the cells,

* and output the State of Charge for the entire battery pack.

*

*

*

*

*/

/*Curve fitting algorithm */

float32 x = voltage_b + 0.23*((current_b-650)/3250); // Voltage is adjusted by the current.

if (x >= 4.2)

{// When voltage is at 4.2V or more, battery is at full capacity regardless of the current.

discharge_capacity = 0.00;

}

else {

discharge_capacity = (p5 - p1*x^4 - p2*x^3 + p3*x^2 - p4*x); // Finds the capacity of the batteries that has been used up. ERROR FOUND HERE!!!!!!

}

socPct = 100*(capacity - discharge_capacity)/capacity;

return socPct; // Return State of Charge of a battery in percent.

}

2013-11-01

tm602502

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值