creating a new aircraft from simpleAirplane questions

For topics related to the creation of simulation objects (SimObjects). This includes development of aircraft, ground, and maritime vehicles.
Post Reply
g1235813
Posts: 16
Joined: Fri May 27, 2022 2:50 am

creating a new aircraft from simpleAirplane questions

Post by g1235813 »

Hi all,
I need to create a new aricraft with highly detailed functions in p3d. However I'm new to p3d and having a pretty hard time getting the whole picture of the strcture of this project. I really hope some of my many questions can be answered here. Thanks in advance!

0 Is there a way to inspect the code in existing airplanes' dll file(such as mooney_bravo.dll)? A complete sample(that is, complete complared to simpleAirplane) would be super helpful for me to understand a lot of things.

1 Relations between aircraft.cfg, [airplane_name].air and simpleAirplane.dll:
As I understand it, in .cfg you can add/set property values, in .air(.asm) you can fill in parameters related to aerodynamics and engine, while the c++ code, used to complile dll file such as simpleAirplane.dll, can be used to implement ALL the functions an airplane needs, INCLUDING those can be done in .cfg and .air.
In other words, if the code is detailed enough, there is no need to have a .air file, and in .cfg only general info is needed ([fltsim] [general] [views] [contact points]). However for some functions, it may be easier to implement by editing the .cfg than coding it in to .dll.
Am I understanding this correctly?

2 Registering and getting/setting properties:
I noticed ISimObjectManagerV520 and IBaseObjectV520 have methods called RegisterProperty() that should be responsible for registering properties. However, I'm not sure the difference between registering a "simvar" and a"event", and what are the difference between the event types? (I noticed an "event" can be modified using setPropertyAction in simdirector, while "simvar" type property can only be added in monitoring files in simDirector, but not in the "property" list in setPropertyAction.)

3 Using .cfg to create properties (what does .cfg actually capable of):
In F-16's aircraft.cfg I copied this section:
[WEIGHT_AND_BALANCE]
max_gross_weight = 42300.0 // (pounds)
into simpleAirplane's sim.cfg, but in simdirector - monitoring files I can't find this property. I assume this is because the property is registered inside F-16's .dll code and what .cfg does is just set a value to a property, not registering a new one?

4 Are there default properties?
Again, using simDirector I can see simpleAirplane's property list, however many of the properties are not registered in the .dll code - actually, I searched those property names in the codes of the whole project of simpleAirplane and can't find a result at all. So when and how are those properties created and registered? If they are created automatically, where can I see documents of a whole list of such properties, including meaning of each one of them?
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: creating a new aircraft from simpleAirplane questions

Post by Clifton Crane »

Hi g1235813,

0. We do not ship source for the mooney_bravo.dll gauge.

1. The aircraft.cfg and .air(.asm) files are used to configure native simulation objects (i.e. category=Airplane). Custom ISimObjects do not inherit native systems in most cases. There are a few exceptions such as [radios], which allow ISimObjects to utilize the core radio systems, simulation variables, and key events. It is up to the ISimObject plugin to implement subsystems such as aerodynamics, contact reaction, etc. As you point out, the SimpleAirplane sim.cfg utilizes [views] and [contact_points], which are also available to the ISimObject, however not all aspects of these sections are supported. For example you'll see contact reaction is handled by the SimpleAirplane UpdateGrounReaction function.

2. You would want to use EVENTTYPE enumerations when a property should be made available for controller input. EVENTTYPE_NORMAL would typically be used for button input, EVENTTYPE_AXIS for axis input, etc. These properties can also be triggered via gauge, SetPropertyAction, or TriggerProperty, and are made available for key binding in the UI. Note that registered properties that do not specify the EVENTTYPE enumeration can still be triggered by other systems depending on how the callbacks are registered (i.e. setter vs getter).

3. This is an example of native system that is not inherited by the ISimObject. You would need to model the weight and balance as needed, and then provide registered properties for other systems to retrieve the data.

4. You are likely seeing events or simulation variables that are supported by both native and ISimObjects. I don't believe we have a 1-to-1 comparison of what's available to the ISimObject, however these properties should use the same names found in the Simulation Variables and Key Events articles in the Learning Center.

Hope this helps.

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
Post Reply