Johan G wrote in Fri Nov 08, 2013 4:52 pm:A project that is similar in that it tries to interface avionics and instruments is The L-1011 Project which is documented in a blog. You might find it interesting, though one has to wade through a lot of posts to find what one is looking for at times. I tend to drop in there once in a while, though often more or less unintentional while doing Google image searches.
Philosopher wrote in Fri Nov 08, 2013 4:59 am:Sounds like more than two sig digs to me! Excellent reasearch, how long does it take to run the tests, and is it one single script?
var vector = [25, 25, 25];
var time0 = systime();
var i = 0;
var out = 0;
for (i = 0; i < 10000000; i += 1)
out = 25;
var time1 = systime();
for (i = 0; i < 10000000; i += 1)
out = vector[1};
var time2 = systime();
print("vector / const = ", (time2 - time1)/(time1 - time0));
var suction = func (rpm, pressure) {
# This magic formula yields about 4 inhg at 700 rpm
var suction = pressure * rpm / (rpm + 4875.0);
# simple regulator model that clamps smoothly to about 5 inhg
# over a normal rpm range
var max = (rpm > 0 ? 5.39 - 1.0 / (rpm * 0.00111) : 0);
if (suction < 0.0) suction = 0.0;
if (suction > max) suction = max;
return suction;
};
var rpm1 = PropertyReader.new("/engines/left/rpm");
var rpm2 = PropertyReader.new("/engines/right/rpm");
var pressure = PropertyReader.new("/environment/pressure-inhg");
# Select the source with higher rpm
var rpm_source = MaxInput.new(
inputs: [rpm1, rpm2]);
var sys_suction = CustomFunction.new(
inputs: [rpm_source, pressure],
function: suction,
on_update: update_prop("/systems/vacuum/suction-inhg"));
var vacuum_system = UpdateLoop.new(
components: [rpm1, rpm2, rpm_source, sys_suction]);
setlistener("/systems/static/serviceable",
func (prop) { rpm_source.scale = prop.getValue()? 1 : 0 });
dede wrote in Fri Nov 08, 2013 5:29 pm:I love it Thanks
galvedro wrote in Tue Nov 05, 2013 1:53 pm:Yes, sure! I have managed to get my development environment up at home, and I am now able to build FG again. I think what I am going to do is to grow a little library in a sandbox (i.e. not interacting with the main code) by borrowing exiting components, and do some experiments with the cppbind framework. I have seen the cppbind code, and it looks really nice indeed!
Hooray wrote in Sat Nov 16, 2013 3:30 am:And for the sake of accessibility, I'll probably keep on referring to "cppbind" either way, simply because I do know that most search forms (forum, mailing list archives, wiki) do not respond all too well to characters like ++
Using forum/wiki/list search breaks often enough already when looking for source code, which tends to include such characters.
var gain = Gain.new(2);
var filter = Dampener.new(dampening: 3);
connect("/environment/temperature-degc", gain.input);
connect(gain.output, filter.input);
connect(filter.output, "/instrumentation/my-instrument/my-property");
galvedro wrote in Wed Nov 20, 2013 8:24 pm:The connect() function is kind of "intelligent", and allows you to connect, not only IO ports, but also properties and constants, making it rather intuitive to use. For example:
- Code: Select all
var gain = Gain.new(2);
var filter = Dampener.new(dampening: 3);
connect("/environment/temperature-degc", gain.input);
connect(gain.output, filter.input);
connect(filter.output, "/instrumentation/my-instrument/my-property");
...
Now, you create the components, and then define the connections as you like. Easy peasy!
Users browsing this forum: No registered users and 0 guests