Running the C program of the wind module

  • Mo11068
  • Topic Author
More
10 Jan 2019 08:52 #6594 by Mo11068
Hi,

I have been trying to run the SAM's C code generated in command prompt. I have used the following command

gcc -o Golden Golden.c

Golden is my file name. However, I have received the error of "undefined resources" which is mostly related to the sscapi.h header file.
Could you please help me about this?

Thanks,
Mohammad

Please Log in or Create an account to join the conversation.

  • pgilman
More
11 Jan 2019 17:50 #6595 by pgilman
Replied by pgilman on topic Running the C program of the wind module
Dear Mohammad,

Please be sure that you are using the same operating system to generate the code from SAM and to run the C program. For example, if you are running the C program in Linux, you should use the Code Generator in the Linux version of SAM to be sure that the code package it creates is for the right operating system.

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

  • pgilman
More
14 Jan 2019 16:45 #6596 by pgilman
Replied by pgilman on topic Running the C program of the wind module
Mohammad,

I just tested the win32 version of the 2018.11.11 release with the default PV/Residential C code generation using mingw 32 bit version on Windows 10. The folder with the code generation has the sscapi.h and appropriate ssc.dll files to run. I matched the results in SAM using the commands in the attached image.

Looking at your command, you are missing the
Code:
-lssc
from the build statement.

For reference, the generated Makefile for the C build is:

Code:
ifdef SystemRoot RM = del /Q EXT = .exe CIFLAGS = -I.. -L. LFLAGS = -lssc #x64 SET PATH=c:\MinGW64\bin;%PATH% #win32 SET PATH=c:\MinGW\bin;%PATH% CCCOMP = gcc else PF = $(shell uname) ifneq (,$(findstring Darwin, $(PF))) VERS = $(shell sw_vers -productVersion) CIFLAGS = -I.. EXT = .dylib else ifneq (,$findstring(Linux, $(PF))) CIFLAGS = -I.. ./ssc.so EXT = .o endif endif RM = rm -f CCCOMP = gcc LFLAGS = -ldl endif PROJ_NAME = untitled JFLAGS = -g all : $(CCCOMP) $(CIFLAGS) -o$(PROJ_NAME) $(PROJ_NAME).c $(LFLAGS) clean : $(RM) $(PROJ_NAME)$(EXT) help: @echo "Please check the settings for your system.Your system may not be supported.Please contact sam.support@nrel.gov"


Let us know if you still are running into issues with the C code.


Please Log in or Create an account to join the conversation.

  • pgilman
More
23 Jan 2019 11:13 #6597 by pgilman
Replied by pgilman on topic Running the C program of the wind module
SAM comes with different ssc.dll files for 32-bit (
Code:
sscx32.dll
and 64-bit
Code:
ssc.dll
Windows operating systems. If you are compiling a 32-bit C program, you will need to use the 32-bit version of SSC.dll.
For a 32-bit C program, you should run the code generator from the 32-bit version of SAM (
Code:
C:/SAM/2018.11.11/win32/sam.exe
).
You can then run the
Code:
mingw32-make
from with the generated code instead of using the
Code:
gcc
command.
To use the
Code:
gcc
command instead on Windows 10 with mingw and mingw64 installed, you can do the following from a windows command prompt:
For 32-bit

  1. Start the 32 bit version of SAM 2018.11.11 as described above.

  2. Use the Code Generator to generate the C code in a folder like
    Code:
    c:\SAM_c_code
    .

  3. Open a windows command prompt go to the folder containing the generated code.

  4. Assuming that the 32-bit version of MinGW is installed in
    Code:
    C:\MinGW
    , type:
Code:
set path=%PATH%;c:\mingw\bin<br /> gcc -I.. -L. -oGolden Golden.c -lsscx32<br /> Golden.exe

64-bit:

  1. Start the 64 bit version of SAM 2018.11.11 as described above.

  2. Generate the C code in
    Code:
    c:\SAM_c_code
    .

  3. Open a windows command prompt and change to the folder.

  4. Assuming the 64-bit version of MinGW is installed in
    Code:
    C:\MinGW64
    :
Code:
set path=%PATH%;c:\mingw64\bin<br /> gcc -I.. -L. -oGolden Golden.c -lssc<br /> Golden.exe

Best regards,

Paul.

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum