-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Systems #53
Comments
the 707 guys also created a nice one |
Basic pressurisation system in issue17 branch. I found the schematics of the electrical circuits. I can send them to you if you are interested. |
I try to create an electrical system which supports bus ties and also simulates currents (most planes only simulate voltages). Even if I found several good documentations, I still don't know which devices are connected to which bus. Example: What about the EFIS systems? Is this essential bus or non essential bus? I guess at least the analog instruments and the radios (RCU) are essential. In the end the electrical system, the OHP and the electrical system page (you can have a look into issue17 branch) must be combined. So still much to do. |
Here is the first version of my new electrical system. Access to property tree is still missing but I will add this of course. Please let me know what you think about it. Nasal Code#!/usr/bin/nasal
var Refresh = 0.1;
# From ATA 24.41: "Two identical nickel cadmium batteries (BAT) 24 V/40 Ah are installed in the aircraft."
var Battery = {
new: func() {
obj = { parents: [Battery],
Connected: 0,
Voltage: 24, #V
RefVoltage: 24, #V
Capacity: 40, #Ah
Charge: 1, #%
Tmp: 0
};
return obj;
},
getCurrent: func {
if(!me.Connected) {
return 0;
}
return -1; #negative value -> producer
},
getVoltage: func {
if(!me.Connected) {
return 0;
}
return me.Voltage;
},
setConnected: func(connected) {
me.Connected = connected;
},
setCurrent: func(current) {
if(me.Connected) {
me.Tmp = (current * Refresh) / 3600.0; # used amp hrs
me.Charge -= (me.Tmp / me.Capacity);
if(me.Charge < 0.0) {
me.Charge = 0.0;
} elsif (me.Charge > 1.0) {
me.Charge = 1.0;
}
me.Tmp = (1.0 - me.Charge) / 10;
me.Voltage = me.RefVoltage - me.Tmp;
}
},
setVoltage: func(volts) {
# TODO: if external smaller -> activated?
}
};
var Consumer = {
new: func(current, minVoltage) {
obj = { parents : [Consumer],
Connected: 0,
Current: current,
Voltage: 0,
Active: 1,
MinVoltage: minVoltage
};
return obj;
},
getCurrent: func {
if(!me.Connected) {
return 0;
}
return me.Current;
},
getVoltage: func {
return 0;
},
setConnected: func(connected) {
me.Connected = connected;
},
setCurrent: func(current) {
},
setVoltage: func(voltage) {
me.Voltage = voltage;
if(me.Voltage < me.MinVoltage) {
me.Active = 0;
}
else {
me.Active = 1;
}
}
};
var Bus = {
new: func() {
obj = { parents: [Bus],
Voltage: 0,
Current: 0,
Cnt: 0,
Max: 0,
Tmp: 0,
Producers: 0,
Devices: {}
};
return obj;
},
append: func(device) {
me.Tmp = size(me.Devices);
me.Devices[me.Tmp] = device;
},
getCurrent: func {
return me.Current;
},
getVoltage: func {
return me.Voltage;
},
getProducers: func {
return me.Producers;
},
setCurrent: func(current) {
me.Current = current;
},
setVoltage: func(voltage) {
me.Voltage = voltage;
},
update: func {
#first set old values, then get new values
#old values can be manipulated by bus tie
me.updateCurrent();
me.updateVoltage();
},
updateVoltage: func {
me.Max = 0;
for(me.Cnt=0; me.Cnt < size(me.Devices); me.Cnt+=1) {
#set old voltage
me.Devices[me.Cnt].setVoltage(me.Voltage);
#get new voltage
me.Tmp = me.Devices[me.Cnt].getVoltage();
if(me.Tmp > me.Max) {
me.Max = me.Tmp;
}
}
me.Voltage = me.Max;
},
updateCurrent: func {
#set old current
for(me.Cnt=0; me.Cnt < size(me.Devices); me.Cnt+=1) {
if(me.Producers > 0) {
me.Devices[me.Cnt].setCurrent(me.Current / me.Producers);
}
else {
me.Devices[me.Cnt].setCurrent(0);
}
}
#get new current
me.Max = 0;
me.Producers = 0;
for(me.Cnt=0; me.Cnt < size(me.Devices); me.Cnt+=1) {
me.Tmp = me.Devices[me.Cnt].getCurrent();
if(me.Tmp < 0) {
me.Producers += 1; #Producer
}
else {
me.Max += me.Tmp; #Consumer
}
}
me.Current = me.Max;
}
};
var Tie = {
new: func(a, b) {
obj = { parents: [Tie],
Connected: 0,
Voltage: 0,
Current: 0,
Bus1: a,
Bus2: b,
Producers: 0,
Tmp: 0
};
return obj;
},
setConnected: func(connected) {
me.Connected = connected;
},
update: func {
if(me.Connected) {
me.updateCurrent();
me.updateVoltage();
}
},
updateCurrent: func {
me.Current = me.Bus1.getCurrent();
me.Current += me.Bus2.getCurrent();
me.Producers = me.Bus1.getProducers();
me.Producers += me.Bus2.getProducers();
if(me.Producers > 0) {
me.Current /= me.Producers;
me.Bus1.setCurrent(me.Current);
me.Bus2.setCurrent(me.Current);
}
else {
me.Bus1.setCurrent(0);
me.Bus2.setCurrent(0);
}
},
updateVoltage: func {
me.Voltage = me.Bus1.getVoltage();
me.Tmp = me.Bus2.getVoltage();
if(me.Tmp > me.Voltage) {
me.Voltage = me.Tmp;
}
me.Bus1.setVoltage(me.Voltage);
me.Bus2.setVoltage(me.Voltage);
}
};
var battery1 = Battery.new();
var battery2 = Battery.new();
var dc1 = Bus.new();
var dc2 = Bus.new();
var dc1load = Consumer.new(100, 18); #amps, required volts
var dctie = Tie.new(dc1, dc2);
dc1.append(battery1);
dc1.append(dc1load);
dc2.append(battery2);
print("\n");
update = func(loops) {
for(var i=0; i<loops; i+=1) {
dc1.update();
dc2.update();
dctie.update();
}
}
#Test 1
print("battery1: on, battery2: off, dc1load: off, tie: off\n");
battery1.setConnected(1);
update(10);
print("dc1: " ~ dc1.getVoltage() ~ "V, " ~ dc1.getCurrent() ~ "A\n");
print("dc2: " ~ dc2.getVoltage() ~ "V, " ~ dc2.getCurrent() ~ "A\n");
print("\n");
#Test 2
print("battery1: on, battery2: off, dc1load: on, tie: on\n");
dctie.setConnected(1);
dc1load.setConnected(1);
update(10);
print("dc1: " ~ dc1.getVoltage() ~ "V, " ~ dc1.getCurrent() ~ "A\n");
print("dc2: " ~ dc2.getVoltage() ~ "V, " ~ dc2.getCurrent() ~ "A\n");
print("\n");
#Test 3
print("battery1: on, battery2: on, dc1load: on, tie: on\n");
battery2.setConnected(1);
update(10);
print("dc1: " ~ dc1.getVoltage() ~ "V, " ~ dc1.getCurrent() ~ "A\n");
print("dc2: " ~ dc2.getVoltage() ~ "V, " ~ dc2.getCurrent() ~ "A\n");
print("\n");
#Test 4
print("battery1: on, battery2: on, dc1load: off, tie: off\n");
dctie.setConnected(0);
dc1load.setConnected(0);
update(10);
print("dc1: " ~ dc1.getVoltage() ~ "V, " ~ dc1.getCurrent() ~ "A\n");
print("dc2: " ~ dc2.getVoltage() ~ "V, " ~ dc2.getCurrent() ~ "A\n");
print("\n");
#Test 5
print("battery1: off, battery2: on, dc1load: on, tie: on\n");
dctie.setConnected(1);
battery1.setConnected(0);
dc1load.setConnected(1);
update(10);
print("dc1: " ~ dc1.getVoltage() ~ "V, " ~ dc1.getCurrent() ~ "A\n");
print("dc2: " ~ dc2.getVoltage() ~ "V, " ~ dc2.getCurrent() ~ "A\n");
print("\n"); The output is as follows:
|
I have not much knowledge of electrical systems overall, but that it models currents is long waiting feature! |
Knowledge about electronics does not really help here because the devices are not directly connected to the bus as you may think. If this would be the case you would get problems if the generators deliver different voltages. For this reason each generator has a "Generator Control Unit" and there is also a "Bus-Power Control Unit" which control the load distribution. Since I don't really know how they behave this simulation is just my guess - nothing more. What I found in the documentations is that most consumers need at least 18V, the batteries deliver 24V (fully loaded) and the generators and inverters deliver 28V. The batteries are NiCds so I'm not sure if they can be charged in flight. Unlike Li-Ion batteries, NiCds must be completely drained before re-charging (memory effect). |
The following systems need improvements:
The text was updated successfully, but these errors were encountered: