07-27-2015 01:27 PM
I am trying to use matlab to run a bunch of simulations in Multisim. I managed to get it to talk to multisim and run the simulations and return the data. Now, the whole point of this is to use matlab to automatically change parameters in the circuit which is where my problem starts. I can use the command
circuit.CircuitParameterValue('R1')
which correctly returns the value of R1 which is a parameter. So how to I change that parameter say from 10 to 11? I tried a lot of combinations of "=11" with the above to no avial. If you look in the manual it does not have an example it just says this:
Syntax
Property CircuitParameterValue ( _
CircuitParameterName
ByVal As String) _
As Double
Parameters
CircuitParameterName—The name of the circuit parameter to get/set.
Remarks
This read/write property allows the user to get/set the value of a circuit parameter.
If the circuit parameter does not exist in the circuit, an error occurs.
Attempting to change circuit parameter values while a simulation is running causes an error. The simulator must be in the stopped state.
If a circuit parameter contains an expression, it will be evaluated first. For example if x=1
, x+1
will return 2
, not “x+1
”. If an error occurs, 0
will be returned.
When setting a circuit parameter value, only numeric values are supported, not expressions.
To access parameters inside sub-sheets, use:
<HB/SC refdes>.<parameter name>
For example, SC1.Vin
Anything helps, especially an autmoation example from something other than labview.
07-28-2015 07:49 PM
Hello,
Are you creating this API, or are you using an existing one?
07-28-2015 09:21 PM
07-29-2015 10:54 AM
Can you tell me where in the multisim enviorment do you find the COM toolkit, I have not been able to found any info related to it.
07-29-2015 12:01 PM
07-30-2015 04:36 PM
Did you do that post?
I have to be honest I have never see that API before. I will try to do some research.
03-23-2016 12:39 PM
I would still like to get this to work, I posted this on the matlab forum recently:
I am working with NI multisim and have an issue with a few of the commands using a COM interface. I can get it to connect and run certain commands but I have not been able to change values via matlab. This part of the code seems to work:
% Open interface to multisim msim = actxserver('MultisimInterface.MultisimApp');
%conect msim.Connect;
%set circuit Circuit = msim.OpenFile('filename.ms13');
%request inputs from multisim inputs = Circuit.EnumInputs('SimulationIOAll');
I can successfully request the value of resistor R1 from the circuit using this command:
Circuit.RLCValue('R1')
But I cannot change the value of R1 from matlab. For reference, within VB I can change the resistor value with this command
Circuit.RLCValue("R1") = 2
in matlab when I try the same command I get the following response:
No public field RLCValue exists for class Interface.NI_Circuit_Design_Suite_Multisim_13.0.IMultisimCircuit.
I think this is because it is trying set an equality in matlab whereas in VB it seems to be sending this command to multisim somehow.
Any help is appreciated. The helpfile for this command is here http://zone.ni.com/reference/en-XX/help/375482A-01/multisim/rlcvalue/#wp270431 and the helpfile for the API is here http://zone.ni.com/reference/en-XX/help/375482A-01/TOC275.htm