I’m trying to pass a string to a C-Block. This is not a problem.
However, I’m trying to programmatically pass a concatenated string that includes subparts which include the file extension and at least one simulation parameter as a part of the filename.
I’ve tried a number of different ways that I’ve used under “C”, “C++” and other programming languages. No luck.
Are you trying to concatenate the substrings in the schematic before passing them into the C-Block as a parameter? Or just passing in the substrings and want C++ code to build the string?
Seems like you’re asking for the former. Pretty sure that Mike hasn’t implemented string manipulation of text in QSpice yet. (I think that he has plans but know no more than that.)
As far as I know, Mike hasn’t implemented anything that will do this in QSpice. You’ll have to pass the substrings into the C-Block and concatenate them there. Or maybe ask Mike to add the feature.
Does this fulfill your requirement to pass substrings into the C-Block to build up the filename? If this meets your requirement, you should wait for @RDunn to review this code as handling strings in C is not something I am good at.
Thank you for the effort. I want the string concatenation BEFORE passing it into the C-Block. I can pass substrings into the C-block and concatenate them in C++ until the “cows come home”.
I was hoping there was QSpice compiler/interpreter function that would allow me to do that.
Have you consider to add system clock (date and time) into your filename? Every simulation run should generate a new name without overlapping previous one.
However, the log file is already timestamped when it is created and updated. There’s no value in adding the timestamp in the name.
Additionally, it doesn’t tell me the sim/step parameters used when I look at the log file 1 year later. This is the reason for creating a complex log file name.
Effectively, you are assembling the string for the log file inside the C-Block.
I’m resisting doing that since the number of parameters to be used in naming the log file can be 2 to 10. A C-block that can assemble this variable number is possible but unwieldy. I’m avoiding that.
I’ve tried once again using different methods of string concatenation within QSpice compiling using substrings and .param values. No good results.
Maybe a request to Mike E. makes sense. Maybe using the ‘&’ as concatenation character makes consistent sense since that character is also used for that purpose in other languages.
Here’s a simple example of passing a parameterized string into a C-Block. arg_test.cpp (4.0 KB) Arg_test.qsch (2.4 KB)
For testing purposes, look at the Output window dumps.
the resultant parameterized string could be used to create/open files.
Well…This is first time I know that param can input as a string from instance parameter of Ø-Device. I just check my notes and in related to this is .display and EndAtof()