• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

C to XML

Marco,

C++ is easy for me while the XML side will be extremely difficult to understand (especially stack based operations) but I will try

XML scripts will be easy for you as well once you fully understand the RPN logic (think in .ASM! ;)).

Tom

PS: My XML side's code can be optimized more than it is. For example, <Macro Name="StrChar"> would not be necessary at all just by doing small changes in the C++ code. I'm sure you'll figure out those if you decide to follow that method.
 
Hello Tom,
XML scripts will be easy for you as well once you fully understand the RPN logic (think in .ASM! ;))
Noo, ASM is MUCH easier! One line, one operation, what could be simpler than that?

RPN is a nightmare for me and stack operations on top of it makes it even worse, if possible :confused:
I'm currently chewing those scripts, sooner or later I hope I'll see the light!

My XML side's code can be optimized more than it is
Optimization of something you don't understand is impossible. So phase zero is understanding how those scripts work, but thanks for the hint!

Marco
 
Except for my wife, who's badly upset because I didn't have dinner with her :rolleyes:, I got somehow things working!

I (partially, I must admit :)) understood your code, Tom, and I was able to build a mixed version of your code and my original BCD idea.

This is the "relevant" XML part:
Code:
<Macro Name="Bcd2Char">'R' 'L' '9' '8' '7' '6' '5' '4' '3' '2' '1' '0' ' ' 13 @1 case</Macro>
<Macro Name="Bcd2String5">
     (@1, number) 16 >> 0x0F &amp; sp1 @Bcd2Char(l1)
     (@1, number) 12 >> 0x0F &amp; sp1 @Bcd2Char(l1) scat
     (@1, number)  8 >> 0x0F &amp; sp1 @Bcd2Char(l1) scat
     (@1, number)  4 >> 0x0F &amp; sp1 @Bcd2Char(l1) scat
     (@1, number)       0x0F &amp; sp1 @Bcd2Char(l1) scat
</Macro>

Within an <Element> use:

<String>%(@Bcd2String5(L:"LVARNAME", number))%!s!</String>

The example shows the XML macro to be used to decode a 5 characters long string (I will later post macros to decode strings up to the maximum allowed length which is 9 characters). The limitation of this technique is that the XML part must know in advance the length of the string to be decoded and, for this reason, there will be one dedicated macro for each target string length.

Please note I had to change the way BCD is encoded and decoded so that binary zero does not correspond to '0' digit but instead to a blank. In this way, uninitialized variable gets filled with (invisible) blanks and not with zeros.
I'm cleaning up the C++ (actually plain C) routine to encode a string, I'll post it soon.

Thank you so much Tom for your help and patience dealing with me!

Marco
 
Here is the 'C' routine.
The only argument is a C, NULL terminated, string (again maximum supported length is 8 characters).
It returns an unsigned long value which is ready to be used in a call to set_named_variable_typed_value(), to pass it to an XML gauge.

Code:
//
// Routine to convert a string into a "pseudo" BCD encoded unsigned long type variable
//
// Maximum allowed string length is 8 characters
//
// Encoding map:
//
// ' ' -> 0x0
// '0' -> 0x1
// '1' -> 0x2
// '2' -> 0x3
// '3' -> 0x4
// '4' -> 0x5
// '5' -> 0x6
// '6' -> 0x7
// '7' -> 0x8
// '8' -> 0x9
// '9' -> 0xa
// 'L' -> 0xb
// 'R' -> 0xc
//
unsigned long PbcdEncode ( char * pszStr )
{
   int            iCnt;
   int            iVal;
   int            iLength = strlen ( pszStr );
   int            iBitsToShift = ( iLength - 1 ) * 4;
   unsigned long  ulRetVal = 0;

   for ( iCnt = 0 ; iCnt < 8 && iLength ; iCnt++, iBitsToShift -= 4, iLength-- )
   {
      if ( pszStr [ iCnt ] > 0x2f && pszStr [ iCnt ] < 0x3a )
         iVal = ( int ) ( pszStr [ iCnt ] - 0x2f );
      else if ( pszStr [ iCnt ] == ' ' )
         iVal = 0x00;
      else if ( pszStr [ iCnt ] == 'L' )
         iVal = 0x0b;
      else if ( pszStr [ iCnt ] == 'R' )
         iVal = 0x0c;
      else
         iVal = 0x0d;
    
      ulRetVal |= ( unsigned long ) ( iVal << iBitsToShift );
   }
 
   return ( ulRetVal );
}

NOTE: In "BCD terms" you could encode up to 0x0f (that's 16) characters.
This encoding is specific to what required by the CIVA INS, if you have different needs just change the way characters are encoded and then change the Bcd2Char XML macro accordingly. They MUST match!

If the original C string includes an "illegal" (out of range) character, it will be encoded as 0x0d, in the hope the problem will become visible on the XML side. You may decide to simply discard it instead, it's up to you.

Marco
 
Marco,

I see you've advanced a lot!
I will be out of home till next tuesday, not quite available to FS stuff. Keep on good postings!

Tom
 
I see you've advanced a lot!
Thanks Tom, but it's easy to advance a lot when you start from absolute zero and have a great teacher!

Anyway I moved to the optimization phase and, compared to previous macro version posted, there were useless sp1 and l1 instructions.

Here is the revised version:
Code:
   <Macro Name="Bcd2S5">
      @Bcd2Char((@1, number) 16 >> 0x0F &amp;)
      @Bcd2Char((@1, number) 12 >> 0x0F &amp;) scat
      @Bcd2Char((@1, number)  8 >> 0x0F &amp;) scat
      @Bcd2Char((@1, number)  4 >> 0x0F &amp;) scat
      @Bcd2Char((@1, number)       0x0F &amp;) scat
   </Macro>
NOTE: This has been tested and it works.
The 8 characters long string is this one:
Code:
   <Macro Name="Bcd2S8">
      @Bcd2Char((@1, number) 28 >> 0x0F &amp;)
      @Bcd2Char((@1, number) 24 >> 0x0F &amp;) scat
      @Bcd2Char((@1, number) 20 >> 0x0F &amp;) scat
      @Bcd2Char((@1, number) 16 >> 0x0F &amp;) scat
      @Bcd2Char((@1, number) 12 >> 0x0F &amp;) scat
      @Bcd2Char((@1, number)  8 >> 0x0F &amp;) scat
      @Bcd2Char((@1, number)  4 >> 0x0F &amp;) scat
      @Bcd2Char((@1, number)       0x0F &amp;) scat
   </Macro>
NOTE: This has NOT been tested yet.
As you can see it's just a matter of bit-shifting, convert, and move to next nibble.
I believe, to make this kind of macros more efficient, an XML guru can code a generic macro accepting also @2 specifying the string length to be decoded, but for sure it's beyond my current capabilities so I'm currently coding separate macros, one for each target string length...(shame on me :().
Note the 'C' routine posted earlier is still valid, encoding side has not changed.

Thank you!
Marco
 
Tom,

Honestly, I never liked that your INS depens on the autopilot heading hold mode to follow a track. Instead, I developed a custom PID which commands ailerons to maintain a crosstrack error of zero degrees, leaving the AP HDG mode free to the pilot, like the rest of AP commands

Speaking about custom autopilot functionalities, and in this case an alternate "heading hold" or "heading control" function, apart from implementing the code itself, how do/could you interface the FS/P3D built in flight director?

Thank you!
Marco
 
Marco,

It can be done through custom LVars. The third party developer must use them when AP lateral navigation selector is in INS position.

Tom
 
It can be done through custom LVars. The third party developer must use them when AP lateral navigation selector is in INS position.
Surely with custom coded attitude indicators (for FD) and HSIs (for deviation) it's feasible, but with gauges not sensible to a custom LVar, like FS/P3D default gauges, it is impossible I fear.
Consequently CIVA will have to keep (ab)using :cool: of default A/P HDG mode.

Thank you,
Marco
 
Marco,

I think it is clear that you are aiming the CIVA interface for third party developers, not end users, right? And I believe a TPD planning to include a CIVA system with his product will also develop custom 3D models (Ext, VC,) as well as many panel instruments. So should be reasonable to expect that HSI/PFD would be custom, not FS/P3D default.

Tom
 
I think it is clear that you are aiming the CIVA interface for third party developers, not end users, right? And I believe a TPD planning to include a CIVA system with his product will also develop custom 3D models (Ext, VC,) as well as many panel instruments. So should be reasonable to expect that HSI/PFD would be custom, not FS/P3D default.

You're 100% right, my goal is to let third party developers integrate CIVA into their instruments/panels/aircrafts.
But at the same time I am willing to let end users "enjoy" CIVA as a stand alone gauge.
For this reason, the stand alone CIVA uses default A/P HDG mode.
Those willing to integrate CIVA into their aircraft system already have the chance to get, through the SDK, all required data, including the CIVA commanded magnetic heading, normally used to feed the default AP, and there is also the possibility to command CIVA NOT to control A/P HDG. So far such data was available only to C/C++, now I'm bridging that as well to XML so that what was possible to achieve only from C/C++ will be extended also to XML.

Marco

P.S.: I'm currently looking for a "beta tester" TPD willing to integrate CIVA into a panel/aircraft :D
 
Marco,
But at the same time I am willing to let end users "enjoy" CIVA as a stand alone gauge.

Right now end users can integrate CIVA 2D panels in CIVA current status (C++, panel .gau files). IMO the XML interface makes sense only for TPD building 3D VC with CIVA units, as it would be easier for them to work with similar scripts to those in Modeldef file. And as a bonus they could design custom CDU and MSU units for 2D panels, using custom graphics slightly different perhaps to the embedded in your .gau files.
Is in this situation where developing specific HSI/ADI gauges to handle FD commands in INS mode makes sense to me as well.
Maybe you could think of including both methods, AP Heading and INS custom PID :cool:

Tom
 
Tom Ruths Boeing 727 models have a VC variation with a CIVA fit, intended for use with your C++ gauge. So you can give it a try.

If you consider your XML port usable, why not open a thread in the Showroom here to lure in some lab ra-...interested simmers.
 
Hello Bjoern,
Tom Ruths Boeing 727 models have a VC variation with a CIVA fit, intended for use with your C++ gauge. So you can give it a try
I didn't know and I'll check it out, but, if it's using the C/C++ gauge and it worked before then it will hopefully still work. What I'm really looking for is a guinea pig developer ;) willing to implement a 3D MSU and CDU in VC, using the XML interface, to test it, understanding what's wrong, what's missing, how to make things more comfortable on her/his side (if possible), etc.
If you consider your XML port usable, why not open a thread in the Showroom here to lure in some lab ra-...interested simmers.
I believe this is a great idea. No, it isn't usable yet, but I'll seriously consider what you suggested once I'll be happy with what I got. I don't want/like to provide partial or bad implementations, even to beta testers.

Thank you very much,
Marco
 
Hello Tom,
IMO the XML interface makes sense only for TPD building 3D VC with CIVA units, as it would be easier for them to work with similar scripts to those in Modeldef file. And as a bonus they could design custom CDU and MSU units for 2D panels, using custom graphics slightly different perhaps to the embedded in your .gau files.
Both possible targets you described are THE reason I'm currently "wasting" all my available time to building a new CIVA version. The new version will be the first one allowing custom coding (2D/3D) of MSUs and CDUs, both from C++ and XML.
Maybe you could think of including both methods, AP Heading and INS custom PID :cool:
Although playing with PID controllers is something I've always found interesting, and willing to dig into sometime, I find, speaking about CIVA/AP interaction, more logic if it gets implemented within a specific aircraft/panel (which means "implemented by who is implementing the specific A/P system) and tailored for it, I believe the final result would be more consistent with the other A/P functions. If, the TPD, is not going to implement a custom A/P and asks for such functionality to be built in CIVA, I still have the chance to build an additional gauge, using the SDK, providing just that (but I believe it will take quite a lot of time).

BTW It's always a pleasure to discuss with you!

Marco
 
I didn't know and I'll check it out, but, if it's using the C/C++ gauge and it worked before then it will hopefully still work. What I'm really looking for is a guinea pig developer ;) willing to implement a 3D MSU and CDU in VC, using the XML interface, to test it, understanding what's wrong, what's missing, how to make things more comfortable on her/his side (if possible), etc.

As far as I know, there are no current aircraft projects requiring an INS. (Michael2's DC-8 doesn't count as he did his own version.) However, as long as your button and knob variables are exposed via XML or as C: type variables, any developer may integrate it at any point.

If the visual layout of your XML CIVA is exactly the same as in v1.51, you can easily integrate it into the 727. It has 3D modeled MSU and CDU elements that are mapped with a gauge poly (which is using the 2D gauge). The only drawback is that the buttons and knobs are not animated, but other than that, your CIVA is fully functional.


Since you asked for input on the gauge itself, here's a list of some optional features that would make an INS more attractive for me:
- Fast/instant align
- Auto-add current position
- Auto-fill waypoints from flight plan
- Auto-correct for drift

These functions could be integrated into a gauge manager panel, so that you won't have to hide them on the MSU and CDU. The panel should also list all the waypoint coordinates in the currently loaded (FSX) flight plan to have them at hand at a glance whenever you need to enter new waypoints. I know that all the optional automation would decrease realism, but they're more intended as time-savers or for flattening the learning curve. Entering new waypoints, positions and correcting for drift would be job of the "pilot not flying" anyway.

It's been a while since I've used (or tried to use) the CIVA 1.51, but I remember that it can only be used on either the 2D panel or in the VC, but not in both since the gauges could not communicate with each other. Is this still an issue in the XML version?


- E:

Time permitting, I'd give the XML CIVA a spin in the 727.
 
I use the CIVA INS on David Maltby's VC10 model. When I updated the panel I did away with the "modern" autopilot altogether just leaving the "original" VC10 AP. One reason for doing this was that there were conflicts between the two.
Anyway the VC10 AP has a "NAV" switch. So All I did was to introduce an L:var (L:Autopilot heading lock, bool) so that it could have the appearance of working separately to the HDG selector. In other words the NAV switch works independantly. If I want the INS to navigate I select the NAV switch. If I want to navigate by changing my heading then I turn the HDG knob. In effect all I do is compare (L:Autopilot heading lock, bool) with (A:Autopilot heading lock, bool) making one switch slave to the L:var and the other slave to the A:var.

ap.jpg

34.jpg
 
As far as I know, there are no current aircraft projects requiring an INS. (Michael2's DC-8 doesn't count as he did his own version.) However, as long as your button and knob variables are exposed via XML or as C: type variables, any developer may integrate it at any point.

If the visual layout of your XML CIVA is exactly the same as in v1.51, you can easily integrate it into the 727. It has 3D modeled MSU and CDU elements that are mapped with a gauge poly (which is using the 2D gauge). The only drawback is that the buttons and knobs are not animated, but other than that, your CIVA is fully functional.


Since you asked for input on the gauge itself, here's a list of some optional features that would make an INS more attractive for me:
- Fast/instant align
- Auto-add current position
- Auto-fill waypoints from flight plan
- Auto-correct for drift

These functions could be integrated into a gauge manager panel, so that you won't have to hide them on the MSU and CDU. The panel should also list all the waypoint coordinates in the currently loaded (FSX) flight plan to have them at hand at a glance whenever you need to enter new waypoints. I know that all the optional automation would decrease realism, but they're more intended as time-savers or for flattening the learning curve. Entering new waypoints, positions and correcting for drift would be job of the "pilot not flying" anyway.

It's been a while since I've used (or tried to use) the CIVA 1.51, but I remember that it can only be used on either the 2D panel or in the VC, but not in both since the gauges could not communicate with each other. Is this still an issue in the XML version?


- E:

Time permitting, I'd give the XML CIVA a spin in the 727.

With today's plethora of GPS fixes one would have to spend the entire flight entering waypoints. However Franco did also model Concorde's ADEU unit which I installed into the panel upgrade of DM's VC10. That saves loads of time. Coupled with the fact that in reality you don't need to include "all" the wypts on the same airway unless there is a course change etc..
In the days when the CIVA INS was the last word the number of waypoints were a fraction of today's. So for realism don't include every single waypoint. Only if it is a reporting point, a course change, change of airway or needed for off-airway navigation.

I don't think it is correct to add extra layers of automation to a system that didn't have them in the first place. Otherwise you can't simulate the piloting skills needed for aircraft of that era.
 
Since you asked for input on the gauge itself, here's a list of some optional features that would make an INS more attractive for me:
- Fast/instant align
- Auto-add current position
- Auto-fill waypoints from flight plan
- Auto-correct for drift
Fast alignment is available, it's not "instant" but still much faster than normal alignment.
The other 3 points are a no go for me because they would completely destroy the INS simulation, I totally agree with what vololiberista wrote. Not willing to appear disrespectful but that is the way FS GPS or many aircraft equipped with an FMS capable of reading a .PLN file do. If you (or anybody else) prefer more modern and more automated systems then move on to modern navigation instruments, I'm not going to build an old INS behaving like an FMC.
Imagine I was reluctant when I was asked to add the ADEU, because I thought it could make life too easy. Only copies of the original Concorde manuals, showing it was equipped with ADEU, convinced me to proceed.
It's been a while since I've used (or tried to use) the CIVA 1.51, but I remember that it can only be used on either the 2D panel or in the VC, but not in both since the gauges could not communicate with each other. Is this still an issue in the XML version?
This is totally new to me, nobody ever reported this issue in the CIVA forum. If I'll be able to put CIVA into Thomas' 727 I'll check this. Should the XML interface overcome this? I don't know because I don't know what the issue is due to... Thanks for informing me.
Time permitting, I'd give the XML CIVA a spin in the 727
Is this a suggestion or an offer? :D

Marco
 
I don't think it is correct to add extra layers of automation to a system that didn't have them in the first place. Otherwise you can't simulate the piloting skills needed for aircraft of that era.

There are situations in which I do need some degree of automation, such as the descent phase. Remember, you're on your own in MSFS with no first officer or flight engineer to lend a hand.
And there's a learning curve involved and automated features do help to get to know the system piece by piece.



The other 3 points are a no go for me because they would completely destroy the INS simulation, I totally agree with what vololiberista wrote. Not willing to appear disrespectful but that is the way FS GPS or many aircraft equipped with an FMS capable of reading a .PLN file do. If you (or anybody else) prefer more modern and more automated systems then move on to modern navigation instruments, I'm not going to build an old INS behaving like an FMC.

It's not that I wouldn't try to operate the INS like a real one, it'd be more of a backup feature for moments when I just don't have the time to monitor flight progress and system operation for the entire flight.
Also, I find the CIVA quite unintuitive to use, but that's hardly your fault.

Imagine I was reluctant when I was asked to add the ADEU, because I thought it could make life too easy. Only copies of the original Concorde manuals, showing it was equipped with ADEU, convinced me to proceed.

As mentioned to Nicholas above, on real aircraft, the pilot not flying was responsible for managing the INS. In MSFS, you're on your own in the flight deck.

This is totally new to me, nobody ever reported this issue in the CIVA forum. If I'll be able to put CIVA into Thomas' 727 I'll check this. Should the XML interface overcome this? I don't know because I don't know what the issue is due to... Thanks for informing me.

Check Tom's readme as he made a mention of the issue in there.

XML shares variables across 2D and 3D panels, so I hazard a guess that the issue will resolve itself.

Is this a suggestion or an offer? :D

I'm not sure anymore.
 
Back
Top