The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

RF::Component::Multi - Multi-element vectorized handling of RF::Component objects.

DESCRIPTION

This module enables loading Measurement Data Interchange Format (MDIF) files and operating on each component them as a vector. Each RF::Component::Multi object is a blessed arrayref containing a list of RF::Component objects, so you can use it as a normal array to get a particular component. You can also run RF::Component methods on an RF::Component::Multi object to return a vector of results, one result for each RF::Component object in the arrayref.

SYNOPSIS

        use RF::Component::Multi;

        # Build an object from existing components:
        $multi = RF::Component::Multi->new(@components);

        # Save to an MDF:
        $multi->save('mydata.mdf', vars => { pF => 'value' }, ...)

        # Load an MDIF file and interpolate from 100 MHz to 1GHz (100e6 - 1e9):
        my $mdf = RF::Component::Multi->load('t/test-data/muRata/muRata-GQM-0402.mdf',
                        load_options => { freq_range => '100e6 - 1e9 x10' }
                );

        # Query a single component in the MDIF:
        my $component1 = $mdf->[1];
        print $component1->cap_pF;

        # Query all components in the MDF with a vectorized result:
        my $cap_pF = $mdf->cap_pF;

        # Print the result value (same as $component1->cap_pF, above):
        print $cap_pF->[1];

Constructor

The constructor is simple, it just takes an array of RF::Component objects and returns a blessed arrayref:

        $m = RF::Component::Multi->new($c1, $c2, ...);

IO Functions

RF::Component::Multi->load - Load a multiple-data file

Currently only MDIF files are supported, other formats are possible. Usage:

        my $mdf = RF::Component::Multi->load($filename, %options);
  • The %options hash is passed to RF::Component's load function.

  • If load_options is provided in %options then load_options is passed to PDL::IO::MDIF's rmdif function.

$self->save - Save a multiple-data file

        $mdif->save($filename, %opts)
  • $filename - path to file to output file.

    Currently only MDIF files are supported.

  • %opts - Options:

    vars: a hashref of arbitrary variable/value mappings:

    Generically: { var1 => var_name1, var2 => sub { $_[0]->something } }

    Since this is a multi-data format, the name var_name1 must be a valid field in RF::Component. For example, you might specify { pF => 'value'} to use the "value" field from the component if it was parsed at load time.

    You may also use a coderef, in which case the RF::Component object will be passed to the function. For example:

            vars => {
                            component => sub {
                                    our $i //= 0;
                                    my $c = shift;
                                    my $t = "$i. $c->{value} $c->{value_unit} $c->{model}";
                                    $i++;
                                    return $t;
                            }
                    }

    Would produce variables which may show in your EDA software like this:

            component="0. 0.1 pF GRM1555C1HR10WA01" [v]

    which convieniently provdes the index number, value, and component model so it is readable in your EDA software and you know what parts to order.

    MDIF structure being written. Each variable should uniquely identify a component. So far only single-variable MDIF files have been tested. The format supports multiple variables, but it isn't clear how EDA software (like Microwave Office) will handle the extra variables. Please send me an email with commentary if you know what (if anything) should be done here! See the MDIF format specification linked below.

    save_options: These options are passed to RF::Component->get_wsnp_list when generating to array structure expected by wmdif.

SEE ALSO

RF::Component - An object-oriented encapsulation of PDL::IO::Touchstone.
PDL::IO::MDIF - A PDL IO module to load Measurement Data Interchange Format (*.mdf) files.
Building MDIF/MDF files from multiple S2P files: https://youtu.be/q1ixcb_mgeM, https://github.com/KJ7NLL/mdf/
Optimizing amplifer impedance match circuits with MDF files: https://youtu.be/nx2jy7EHzxw
MDIF file format: https://awrcorp.com/download/faq/english/docs/users_guide/data_file_formats.html#i489154

AUTHOR

Originally written at eWheeler, Inc. dba Linux Global Eric Wheeler to transform .s2p files and build MDF files to optimize with Microwave Office for amplifer impedance matches.

COPYRIGHT

Copyright (C) 2022 eWheeler, Inc. https://www.linuxglobal.com/

This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This module is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this module. If not, see <http://www.gnu.org/licenses/>.