live data
This commit is contained in:
parent
7cb3eb4c9a
commit
b337fed520
|
@ -32,7 +32,7 @@ expected<float> InjectorModel::getAbsoluteRailPressure() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float InjectorModel::getInjectorFlowRatio() const {
|
float InjectorModel::getInjectorFlowRatio() {
|
||||||
// Compensation disabled, use reference flow.
|
// Compensation disabled, use reference flow.
|
||||||
if (engineConfiguration->injectorCompensationMode == ICM_None) {
|
if (engineConfiguration->injectorCompensationMode == ICM_None) {
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
@ -53,15 +53,15 @@ float InjectorModel::getInjectorFlowRatio() const {
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pressureDelta = absRailPressure.Value - map.Value;
|
pressureDelta = absRailPressure.Value - map.Value;
|
||||||
|
|
||||||
// Somehow pressure delta is less than 0, assume failed sensor and return default flow
|
// Somehow pressure delta is less than 0, assume failed sensor and return default flow
|
||||||
if (pressureDelta <= 0) {
|
if (pressureDelta <= 0) {
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: live data model
|
pressureRatio = pressureDelta / referencePressure;
|
||||||
float pressureRatio = pressureDelta / referencePressure;
|
// todo: live data model?
|
||||||
float flowRatio = sqrtf(pressureRatio);
|
float flowRatio = sqrtf(pressureRatio);
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
|
@ -73,7 +73,7 @@ float InjectorModel::getInjectorFlowRatio() const {
|
||||||
return flowRatio;
|
return flowRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
float InjectorModel::getInjectorMassFlowRate() const {
|
float InjectorModel::getInjectorMassFlowRate() {
|
||||||
// TODO: injector flow dependent upon temperature/ethanol content?
|
// TODO: injector flow dependent upon temperature/ethanol content?
|
||||||
auto injectorVolumeFlow = engineConfiguration->injector.flow;
|
auto injectorVolumeFlow = engineConfiguration->injector.flow;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "expected.h"
|
#include "expected.h"
|
||||||
|
#include "injector_model_generated.h"
|
||||||
|
|
||||||
struct IInjectorModel : public EngineModule {
|
struct IInjectorModel : public EngineModule {
|
||||||
virtual void prepare() = 0;
|
virtual void prepare() = 0;
|
||||||
|
@ -8,22 +9,21 @@ struct IInjectorModel : public EngineModule {
|
||||||
virtual float getFuelMassForDuration(floatms_t duration) const = 0;
|
virtual float getFuelMassForDuration(floatms_t duration) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class InjectorModelBase : public IInjectorModel {
|
class InjectorModelBase : public IInjectorModel, public injector_model_s {
|
||||||
public:
|
public:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
floatms_t getInjectionDuration(float fuelMassGram) const override;
|
floatms_t getInjectionDuration(float fuelMassGram) const override;
|
||||||
float getFuelMassForDuration(floatms_t duration) const override;
|
float getFuelMassForDuration(floatms_t duration) const override;
|
||||||
|
|
||||||
virtual floatms_t getDeadtime() const = 0;
|
virtual floatms_t getDeadtime() const = 0;
|
||||||
virtual float getInjectorMassFlowRate() const = 0;
|
virtual float getInjectorMassFlowRate() = 0;
|
||||||
virtual float getInjectorFlowRatio() const = 0;
|
virtual float getInjectorFlowRatio() = 0;
|
||||||
virtual expected<float> getAbsoluteRailPressure() const = 0;
|
virtual expected<float> getAbsoluteRailPressure() const = 0;
|
||||||
virtual float correctShortPulse(float baseDuration) const = 0;
|
virtual float correctShortPulse(float baseDuration) const = 0;
|
||||||
|
|
||||||
virtual void postState(float deadTime) const { (void)deadTime; };
|
virtual void postState(float deadTime) const { (void)deadTime; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float m_deadtime = 0;
|
|
||||||
float m_massFlowRate = 0;
|
float m_massFlowRate = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ class InjectorModel : public InjectorModelBase {
|
||||||
public:
|
public:
|
||||||
void postState(float deadtime) const override;
|
void postState(float deadtime) const override;
|
||||||
floatms_t getDeadtime() const override;
|
floatms_t getDeadtime() const override;
|
||||||
float getInjectorMassFlowRate() const override;
|
float getInjectorMassFlowRate() override;
|
||||||
float getInjectorFlowRatio() const override;
|
float getInjectorFlowRatio() override;
|
||||||
expected<float> getAbsoluteRailPressure() const override;
|
expected<float> getAbsoluteRailPressure() const override;
|
||||||
|
|
||||||
// Small pulse correction logic
|
// Small pulse correction logic
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
struct_no_prefix main_relay_s
|
struct_no_prefix injector_model_s
|
||||||
float m_deadtime
|
float m_deadtime
|
||||||
float pressureDelta
|
float pressureDelta
|
||||||
float pressureRatio
|
float pressureRatio
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/fuel/injector_model.txt Sun Dec 26 12:40:58 EST 2021
|
||||||
|
// by class com.rusefi.output.CHeaderConsumer
|
||||||
|
// begin
|
||||||
|
#pragma once
|
||||||
|
#include "rusefi_types.h"
|
||||||
|
// start of injector_model_s
|
||||||
|
struct injector_model_s {
|
||||||
|
/**
|
||||||
|
* offset 0
|
||||||
|
*/
|
||||||
|
float m_deadtime = (float)0;
|
||||||
|
/**
|
||||||
|
* offset 4
|
||||||
|
*/
|
||||||
|
float pressureDelta = (float)0;
|
||||||
|
/**
|
||||||
|
* offset 8
|
||||||
|
*/
|
||||||
|
float pressureRatio = (float)0;
|
||||||
|
/** total size 12*/
|
||||||
|
};
|
||||||
|
|
||||||
|
// end
|
||||||
|
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/fuel/injector_model.txt Sun Dec 26 12:40:58 EST 2021
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
rm gen_live_documentation.log
|
rm gen_live_documentation.log
|
||||||
|
|
||||||
|
bash gen_live_documentation_one_file.sh injector_model InjectorModel.java controllers/algo/fuel
|
||||||
|
[ $? -eq 0 ] || { echo "ERROR generating"; exit 1; }
|
||||||
|
|
||||||
bash gen_live_documentation_one_file.sh launch_control_state LaunchControl.java controllers/algo
|
bash gen_live_documentation_one_file.sh launch_control_state LaunchControl.java controllers/algo
|
||||||
[ $? -eq 0 ] || { echo "ERROR generating"; exit 1; }
|
[ $? -eq 0 ] || { echo "ERROR generating"; exit 1; }
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.rusefi.config.generated;
|
||||||
|
|
||||||
|
// this file was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/fuel/injector_model.txt Sun Dec 26 12:40:21 EST 2021
|
||||||
|
|
||||||
|
// by class com.rusefi.output.FileJavaFieldsConsumer
|
||||||
|
import com.rusefi.config.*;
|
||||||
|
|
||||||
|
public class InjectorModel {
|
||||||
|
public static final Field M_DEADTIME = Field.create("M_DEADTIME", 0, FieldType.FLOAT);
|
||||||
|
public static final Field PRESSUREDELTA = Field.create("PRESSUREDELTA", 4, FieldType.FLOAT);
|
||||||
|
public static final Field PRESSURERATIO = Field.create("PRESSURERATIO", 8, FieldType.FLOAT);
|
||||||
|
public static final Field[] VALUES = {
|
||||||
|
M_DEADTIME,
|
||||||
|
PRESSUREDELTA,
|
||||||
|
PRESSURERATIO,
|
||||||
|
};
|
||||||
|
}
|
|
@ -7,8 +7,8 @@ using ::testing::StrictMock;
|
||||||
class MockInjectorModel : public InjectorModelBase {
|
class MockInjectorModel : public InjectorModelBase {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD(floatms_t, getDeadtime, (), (const, override));
|
MOCK_METHOD(floatms_t, getDeadtime, (), (const, override));
|
||||||
MOCK_METHOD(float, getInjectorMassFlowRate, (), (const, override));
|
MOCK_METHOD(float, getInjectorMassFlowRate, (), (override));
|
||||||
MOCK_METHOD(float, getInjectorFlowRatio, (), (const, override));
|
MOCK_METHOD(float, getInjectorFlowRatio, (), (override));
|
||||||
MOCK_METHOD(expected<float>, getAbsoluteRailPressure, (), (const, override));
|
MOCK_METHOD(expected<float>, getAbsoluteRailPressure, (), (const, override));
|
||||||
MOCK_METHOD(float, correctShortPulse, (float baseDuration), (const, override));
|
MOCK_METHOD(float, correctShortPulse, (float baseDuration), (const, override));
|
||||||
};
|
};
|
||||||
|
@ -97,7 +97,7 @@ TEST(InjectorModel, Deadtime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TesterGetFlowRate : public InjectorModel {
|
struct TesterGetFlowRate : public InjectorModel {
|
||||||
MOCK_METHOD(float, getInjectorFlowRatio, (), (const, override));
|
MOCK_METHOD(float, getInjectorFlowRatio, (), (override));
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TesterGetRailPressure : public InjectorModel {
|
struct TesterGetRailPressure : public InjectorModel {
|
||||||
|
|
Loading…
Reference in New Issue