Hello everyone,
@gyrovague I would need some help.
I'm trying to implement an electrical system with avSimpleElectricSystem, but I can not change the bus status.
I tried with several commands but I have no Device response.
If I start with a powered engine mission I have a value of 28 on the two DC_Bus and 0 on the two AC_Bus and I can not change the state and even pushing the motor I have the same values.
my test code
in device_init.lua
creators[devices.TEST_DEVICES] = {"avSimpleElectricSystem", LockOn_Options.script_path.."Test_Devices.lua"}
in Test_Devices.lua
local electric_system = GetSelf()
local update_time_ms = 1.0/20.0
make_default_activity(update_time_ms)
local sensor_data = get_base_data()
local Generator_2 = 10317
electric_system:listen_command(Generator_2)
function SetCommand(command,value)
if command == Generator_2 then
electric_system: AC_Generator_1_on(true)
electric_system: AC_Generator_2_on(true)
electric_system: DC_Battery_on(true)
end
print_message_to_user("AC 1 "..electric_system:get_AC_Bus_1_voltage())
print_message_to_user("AC 2 "..electric_system:get_AC_Bus_2_voltage())
print_message_to_user("DC 1 "..electric_system:get_DC_Bus_1_voltage())
print_message_to_user("DC 2 "..electric_system:get_DC_Bus_1_voltage())
end
I tried these commands
electric_system: DC_Battery_on(1)
electric_system: DC_Battery_on(true)
electric_system: DC_Battery_on(value > 0)
electric_system: DC_Battery_on()
I think you expect a int but I've also tried these
electric_system: DC_Battery_on("1")
electric_system: DC_Battery_on("on")
with different types of variable but without result.
You might have what type of command I need to send, what do you expect the function as a parameter?
Thanks a lot for the help. See you soon